none
Need some guidance about projects makeup and design patterns RRS feed

  • Question

  • Hi guys,

     

    I am a java programmer whose next project is a .NET one. This app will have 2 different types of interfaces: Web or Windows. One client may use the Web one while another one may use the Windows one. I am planning to control it through an entry in app.config file.

    Code Snippet

    <configuration>
      <appSettings>
        <add key="UserInterface" value="Web"/>
      </appSettings>
    </configuration>

     

     


    My concern is

    (1) how to build projects for this app in Visual Studio 

    (2) how to use design patterns in .NET environment.

     

    After reading some info on internet it looks like I have to follow this pattern:

    User Interface --> Business Facade --> Business Logic -- > DAL.

     

    If this is the case then I have come up with these projects in Visual Studio:

     

    Web (User Interface Layer)

    Windows (User Interface Layer)

    BusinessFacade (Business Service Layer)

    BusinessLogic (Business Service Layer)

    BusinessObject (Business Service Layer)

    DAL (Data Access Layer)

    DALFactory (Data Access Layer)

    Config (System Frameworks Layer)

     

    Am i going to the right path?

     

    Thanks

     

    Monday, October 27, 2008 9:19 PM

All replies

  • You have mentioned your requirements only on UI. So it's hard to comment on other layers.

     

    Depending on the complexity of your UI, you can break it further down into more layers using standard patterns like MVC or MVP

     

    Hope this helps

     

    --Pavan

    Tuesday, October 28, 2008 12:30 AM
  • I think you are heading towards the right direction.  I use JEE and .NET pretty much everyday, based on that I see where you are coming from and looks like you are correct.

     

    Your windows application will be like

     

    Windows UI -> Business facade -> Business Logic -> DAL

     

    Your web application will be

     

    Web UI -> Business facade -> Business Logic -> DAL

     

    As Pavan suggested in his response, you could use MVP for your windows UI and MVC for your Web UI - although your asp.net webpages are by default page controller pattern instead of front controller.  Creating a true front controller itself is a project of can use www.asp.net/mvc for front controller.  Caveat, there is limited support for www.asp.net/mvc.

     

    Finally, I dont know the need for the config section you have mentioned above.  Both your Windows UI and Web UI as applications will have its own config files.  Unless you need to know the client type at the service layer (although there are better ways to manage that).

     

    You can use pretty much use all the design and architectural patterns that you may have used in JEE world.  In my experience I dont know if there is any that is specific to one of the platform.

     

    Hope this helps.

     

    { Gaja; }

    http://gajakannan.com/netarch.aspx

    Tuesday, October 28, 2008 2:49 AM
  • Thanks for reply. Its good to know I am on the right path.

     

    The Config project will manage the application config file. I want only one config file for the whole application. So for example to manage a UserInterfaceType configuration, i put this entry in IRM.config file:

    Code Snippet

    <configuration>

      <appSettings>

        <!-- Valid values: WEB, WINDOWS -->

        <add key="UserInterfaceType" value="WEB"/>

      </appSettings>

    </configuration>

     

     

    Then I create an enum

    Code Snippet

    public enum UserInterfaceType

    {

      WEB,

      WINDOWS

    }

     

     

     

    Then I created a method in my config class to access this file:

    Code Snippet

    public static class IRMConfigManager

    {

      public static UserInterfaceType GetUserInterfaceType()

      {

        // read the value from IRM.config file, convert it to enum and return it

      }

    }

     

     

     

    Tuesday, October 28, 2008 4:22 PM