domain driven design - Should Nancy modules be DDD app services? -


i've used nancy web framework in few projects already. of developed using domain-driven design.

my current approach

what did in these application following:

  • use nancy modules define http endpoints (obviously).
  • call application service (implemented in class) module carry out application logic defined ddd.
  • take return value app service call (e.g. dto or view-model) , format appropriately (e.g. convert json or render in view.

the reason why separated nancy module app service have "clean" app services, i.e. dependencies injected through constructor, no logic in constructor , no mutable state. also, dynamic stuff restricted modules.

note goal of approach explicitly not make app services web-agnostic.

problems (or rather code smells)

the problem approach is not clear separation of concerns. in cases app service needs format response based on condition. or needs return specific http status code. stuff i'd rather in nancy module.

question

what preferred approach implement ddd app services nancy? should resort putting app service code in modules , accept have not-so-clean constructor?


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -