Tuesday, December 06, 2005

Christmas Calendar 6/24

Never ever ever ever ever ever ever ever ever ever ever ever ever ever
declare Enums / constants in the business layer of an application (or any other conventional layer for that sake).

Before you know it you will need to access those from a layer that doesn't have access to the business layer, and then my friend you are screwed.

Put them instead in a util - project that is included into every other project, that way you won't have to use sql like "where ProjectStatusId = 23" in your dataaccess-code.

The same goes for accessing application configuration settings. Write the code once in a util-project and walk away knowing that it's there.

"but why not just put this stuff into the domain model" - you ask...
1) because Andreas says so
2) because more stuff gets configured through config settings and constants than just domain logic. keep it clean and DRY!.. take it out into a separate (small and cute) util-project

how does the lyrics to that song lyric go?

--"you got to keep 'em separated .. *DÆNH DÆNH DÆNH DÆNH"

No comments: