views:

43

answers:

2

Hi Everyone,

At our company we are developing an application that has a large number of winforms that are all created in the same UI layer, namespace and assembly. Is there a decent way / design pattern to structure this layer?

Our UI layer communicates with the business layer wich consists of mutiple namespace like business.calculation and business.logistics. Can this structure also be used in the UI layer? It just doesn't feel right to create 100+ winforms in the same winform project.

Cheers!

A: 

Yes. A good structure will help keep your sanity as the applcation grows. You'll have some challenges:

  1. Identifying good namespaces
  2. Finding depdencies between them, which results in a logical build order
  3. Maintaining the namespaces as developers add new forms

For example, you might consider grouping the forms into namespaces like:

business.library.ui -- common, reusable UI components might go here

business.calculation.ui -- UI related to the calculation, which depends on the library UI

business.logistics.ui -- UI related to the logistics business area, which depends on the library and calculation UI

Paul Williams
Oke thanks, that confirms my thoughts exactly. I was wondering if I should make use of some navigator class that is responsible for showing forms from different namespaces or should forms just have direct calls to each other. I can image that forms from the calculation namespace may open forms from the logistic namespace and vice versa but this wil cause reference problems without a navigator class.
Lionel
If you have two assemblies referencing classes in each other's assembly, you might consider moving these classes into a lower-level assembly both can access. We have several forms like this.
Paul Williams
A: 

I find it easier to structure my namespaces according to the subsystems that make up the whole application, then organise the namespaces for the UI according to use cases.

jeyoung