Designing namespaces

13 views
Skip to first unread message

Mark Allison

unread,
Dec 19, 2011, 5:29:56 AM12/19/11
to nhusers
Hi there,

I am learning ORM at the moment and building an app to help me learn
it. I want to build a WinForms app in C# 4 which connects to a
SqlExpress 2008 database. The application will record and report on
financial trades. As I am fairly inexperienced I'm wondering which is
the best way to design the app.

I have created the main WinForms app and two separate assemblies, one
for Data Access Layer (NHibernate) and one for Unit Tests with NUnit.
My app is called MooDB. I was thinking of something like this for the
namespaces:

MooDB.FE - Front End GUI classes
MooDB.BusinessLayer - business layer classes
MooDB.DataLayer - data access classes with NHibernate
MooDB,Tests - unit test classes

What do professionals do?

Itzik Saban

unread,
Dec 19, 2011, 7:44:49 AM12/19/11
to nhu...@googlegroups.com
Professionals will work with a methodology called Domain Driven Design, or DDD in short.

In this methodology you'll find more layers and more abstractions.

But if you'll choose not to follow DDD as a whole, my tip is: decouple the Business Layer from the DAL by using interfaces and IoC. There are few reasons to that but the most important on for me is: you can run your tests with no dependency on a DB. 

Best Regards, 

Itzik Saban


2011/12/19 Mark Allison <marka...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.



--

Øyvind Valland

unread,
Dec 19, 2011, 8:25:41 AM12/19/11
to nhu...@googlegroups.com
I agree with what Itzik says. However, it does sound like you're writing this app to learn about ORM - so I'd simplify your project structure to just two assemblies: your front-end assembly and your test assembly. I'd separate business/domain concerns and data access concerns by namespaces (folders in your solution).


sbohlen

unread,
Dec 19, 2011, 8:26:54 AM12/19/11
to nhu...@googlegroups.com
I'd recommend taking a look at this article: http://msdn.microsoft.com/en-us/magazine/ee819139.aspx ("Building a Desktop To-Do Application with NHibernate").  It tries to focus on the mechanics of leveraging NH in the context of a desktop client app vs. a web app to handle common scenarios (session lifecycle management, optimistic concurrency conflict resolutions, etc.)

-Steve B.
Reply all
Reply to author
Forward
0 new messages