Thursday, 10 May 2012

Styles, Data Triggers and State Machines

Highlighting ListView Items

I've not needed to post on here for a while as I've been busy building out Oxyrhynchus.  Today I added a feature to display jobs that had been invoiced for, but were unpaid.,  The requirement was to have unpaid jobs that were 30 days past the invoice raised date to be highlighted.  I found a good article explaining how to use style resources and data triggers to achieve this on the view:

http://www.codeproject.com/Articles/18585/Highlighting-Items-in-a-WPF-ListView


Replacing status enums with State Pattern

While fixing a small problem with the quick action button logic I became aware that my manuscript workflow logic had become distributed between three classes -  the EntityBase class contained some default logic and the Manuscript and ManuscriptService classes also contained the received to returned state transitional logic.  Although this is manageable now, it could quickly turn into a 'code smell' that would require refactoring.  Typically, this would be addressed by refactoring to the State pattern and have state-based behaviour encapsulated.  I've done some reading around this:

http://stackoverflow.com/questions/7217125/how-to-map-abstract-class-using-entity-code-first-and-state-pattern
http://stackoverflow.com/questions/10011859/state-pattern-and-domain-driven-design

No comments:

Post a Comment