ILearnable .Net

December 6, 2005

Christmas Calendar 6/24

Filed under: Uncategorized — andreakn @ 06:38

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”

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: