.net - State pattern in the domain could affect service layer badly -


we have n-layered application try design ddd in mind. app exposed rest service. have domain entity utilizes state pattern. interface state this

interface idomainobjectstate {     void setpassed();     void setfailed();     void setincomplete();     void pause();     void block(); } 

this entity has status field. state methods beginning "set" supposed change field if object's state allows.

while allows have rather clean code in domain, it's pain @ service layer: use separate rest resource change status of entity (say, put /result this). problem makes me cry have switch on new status came in dto select 1 of 3 methods (and way in application layer, guess).

is idea merge 3 "set*" methods one? please suggest refactoring if not!

is idea merge 3 "set*" methods one?

it isn't idea if motivation streamline integration http interface. imo, switch statement isn't terrible because part of adapter/acl code straightforward, tested , doesn't require great design. ideally, http adapter call application service encapsulates behavior @ hand. if wanted to, create mapping between specific http resource/verb combinations , application service methods, doesn't add value overall.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -