domain-object

Constructing a Domain Object from multiple DTOs

Suppose you have the canonical Customer domain object. You have three different screens on which Customer is displayed: External Admin, Internal Admin, and Update Account. Suppose further that each screen displays only a subset of all of the data contained in the Customer object. The problem is: when the UI passes data back from each ...

How do you use Intefaces with the Factory Pattern in Domain-Driven Design?

Does it make sense to use interfaces for your domain object factories by default, or should interfaces be reserved for the factory classes only when you need them? public IUserFactory { User CreateNewUser(); } public UserFactory : IUserFactory { public User CreateNewUser() { return new User(); } } ...

Is a "domain object" any class that represents business rules?

I came across the term "domain object" and found a couple of definitions on Google but I just want to verify that my understanding is correct. Is this simply any class that represents business rules - since the word 'domain' usually means rules that are specific to some local problem set such as how to calculate income taxes. So the ...

Mapping domain objects to web service proxy objects in Java

Hi, I am trying to find a way for mapping domain objects to web service proxy objects, generated by various Java web service stacks. Both the web service (.NET) and the Java code use implementations of a particular specification. The specification is meant to provide very detailed description of domain classes, which should be implement...

How do I initialise a Date field in a Grails domain object to act as a timestamp?

I have a domain class which has two dates in it and I want one of them populated with the current time when a record is created for the object, like a create timestamp... class Contact { Date initiatedDate Date acceptedDate } Is it sufficient just to new a Date object on one of them and make the other nullable until such a tim...

Is this a valid use of Grails transients?

I have a domain object on which I want to store a few things which only exist at runtime. I looked at the documentation and found the transients keyword, which, on the face of it was what I was looking for. Here is what my domain object looks like... class Contact { def Seeker def beforeInsert() { initiatedDate =...

Usage patterns/use cases for DI or when to start using it

I'm not sure for which use cases one should to use DI in the application. I know that injecting services like PlaceService or CalculationService etc fits very well but should I also create my domain objects with DI like a User? What is if the User has only one constructor which requires a first and lastname. Is this solveable with DI? S...

Unit of Work pattern, getters, setters and contracts (PHP)

I'm not sure if the title is the best way to describe this question. This book - http://apress.com/book/view/9781590599099 - illustrates an implementation of the Unit of Work pattern. It goes a little something like this. class UoW(){ private array $dirty; private array $clean; private array $new; private array $delete; ...