I want to be able audit user actions on the domain model - I want to track when & what they've changed. Now I can do this at the course grained level using nHibernate event listeners, they can tell me when an entity is loaded, saved, updated etc. But without interrogating the state of the entity in depth I'm unable to determine what's gone on between loading an entity and it being saved.This is where the idea of domain events comes the rescue - the idea of generating events from the domain model. Now this could be done using the standard .Net...
Friday, 23 October 2009
Wednesday, 21 October 2009
Unstructured development opportunity
Posted on 10:07 by Unknown
Anyone spot the oxymoron in the snippet of a job spec I received today:Ability to handle multiple competing priorities, work with minimal formal specifications, and deliver at the highest levels.It then goes on to say:Experience of designing, building and maintaining sophisticated automated trading applications with a large userbase and significant business dependency. Equity, future and option experience and working closely with business users.There really must be some telepathic developers out there - no specification but expected to do some...
Monday, 19 October 2009
Property setters are just wrong!
Posted on 01:43 by Unknown
In general I think the use of property setters on classes is a sign of bad class design and a lack of OO principles - in most cases when you modify the 'state' of a class some 'behaviour' is invoked whether it be implicit or explicit;e.g. when I change the address on a user account I want to make sure the address object has been populated (at least).So these days I've started to design classes that have public getters & private setters, and if you want to modify state you are required to call a method, e.g. 'ChangeAddress'. This is nothing...
Sunday, 11 October 2009
Lambda beats magic string
Posted on 09:16 by Unknown
Okay magic strings are a pain, in the worst cases they're bugs waiting to happen but I've been living with the following for while and it's always been nagging me when ever I look at the code.public abstract class Observable<T> : IEntity<T>, INotifyPropertyChanged{public event PropertyChangedEventHandler PropertyChanged = delegate { };private T _id;public virtual T Id{ get { return _id; } private set { ChangePropertyAndNotify(ref _id, value, "Id"); }}protected void ChangePropertyAndNotify<T2>(ref T2 value, T2 newValue, string...
Thursday, 8 October 2009
Using repositories inside a domain entity
Posted on 08:51 by Unknown
If you follow the principles of DDD you'll be well aware of the persistence ignorance discussion\argument. I believe domain entities should be agnostic of the persistence layer and therefore not statically bound at compile time. Overall I'm happy with this approach but it does give issues when trying to place certain business logic on the entity that requires access to some service (read repository).Now obviously you can use the 'double-dispatch' approach and pass in the repository via an interface and only couple the entity to an interface, but...
Wednesday, 7 October 2009
Functional intro
Posted on 02:37 by Unknown
Jeremy Miller has a great article in this months MSDN magazine introducing functional programming for the OO developer. If you've been using the features of .Net 3.5 - Func, Action, etc. you've probably been using these techniques & patterns without realising. I know I have.It's a good read!You might also be interested in Jon Skeet's new book release later this month.Awkward Co...
Subscribe to:
Posts (Atom)