Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
Pluralsight + Digital-Tutors - 3,000 tech & creative courses - starting at $29/month Get it now →

Tag: DDD 11 posts

On Immutability

By Keith Sparkjoy on June 25, 2013

At Pluralsight, we’ve been programming with immutable objects for a couple of years now, and I know some of the team is wondering why we bother. When you’re a traditional OO developer used to updating the state of objects in place, it sure feels weird to go to the trouble of building immutable objects using [...]


My Clojure Journey: Simple Expressive Tests

By Keith Sparkjoy on April 22, 2013

One thing my team has struggled with in enterprise C# development is the complexity of unit test setup. This is complicated by Domain Driven Design, which encourages the use of concrete classes for entities and values. Test setup often becomes nontrivial as you are often required to set up considerably more of the object graph [...]


Branching by Abstraction

By Keith Sparkjoy on April 18, 2012

Last month we shipped an update to our website that didn’t add any features, but was a major refactoring for us. We moved the thousands upon thousands of user accounts in our system out of our old file “database” if you will, into a document database called RavenDB. But more importantly, we also completely redesigned [...]


What’s the Single Responsibility of an Entity in Domain Driven Design?

By Keith Sparkjoy on March 2, 2012

When I was first getting my head around Domain Driven Design (DDD), I had a hard time reconciling Entities with the Single Responsibility Principle. By their very nature, some entities can have an awful lot of state hanging off them. Take for example our UserAccount entity at Pluralsight. There’s a lot of stuff associated with [...]


Domain Driven Design in C# – implementing immutable value objects

By Keith Sparkjoy on February 1, 2012

In his book, Domain Driven Design (DDD), Eric Evans encourages the use of Value Objects in domain models. Here at Pluralsight we are using the DDD approach to modeling, and we are taking his advice and using immutable objects to implement all of our Value Objects in our domain layer. What we’re finding is that we are [...]


How to reduce ambiguity in C# method calls using named arguments

By Keith Sparkjoy on January 31, 2012

As of .NET version 4.0, C# supports named and optional arguments. This comes in really handy for distinguishing method parameters that have the same type. For example: public interface IGenerator<T> { T Generate(T min, T max); } It would be really easy to accidentally pass arguments to Generate in the wrong order, since they have the same [...]


Domain Driven Design in C#: Equals and GetHashCode – part 5

By Keith Sparkjoy on January 21, 2012

This series of posts starts here, covering some discoveries I’ve made about implementing equality semantics in DDD, test coverage of equality, etc. I last left off by concluding that I didn’t want to implement Equals or GetHashCode until I had a good reason to need either of them. But seeing as they surface by default [...]


Domain Driven Design in C#: Equals and GetHashCode – part 4

By Keith Sparkjoy on January 21, 2012

In my last three posts, I gave some background about how we’re using DDD and TDD and how we’ve been overriding Equals and GetHashCode to provide semantically correct equality for our domain objects. It’s felt convenient because unit tests could make use of Assert.AreEqual to compare value objects and entities, and our slide into the [...]


Domain Driven Design in C#: Equals and GetHashCode – part 3

By Keith Sparkjoy on January 21, 2012

In my last posts, I talked about how we’re using DDD to approach design, and TDD in our implementation, and how we found ourselves taking shortcuts by implementing equality using ReSharper‘s code gen feature. One practical offshoot of implementing equality semantics on an object is that you can use Assert.AreEqual() in tests and it’ll be [...]


Domain Driven Design in C#: Equals and GetHashCode – part 2

By Keith Sparkjoy on January 21, 2012

In my last post, I talked about the difference between entities and value objects in terms of how you’d overload Equals and GetHashCode. One thing is clear: the default implementation of equality and hashing supplied by Object in C# (and object in Java) are incorrect for both entities and values. As we’ve been implementing entities [...]


Domain Driven Design in C#: Equals and GetHashCode – part 1

By Keith Sparkjoy on January 21, 2012

As our dev team here at Pluralsight continues its journey into Domain Driven Design, we’re constantly learning how to do it better. One of the most important differences between an entity and a value object is equality semantics. In DDD, entities typically have a unique symbol associated with them, say a property called “Id”, that [...]