locked
which patterns I am I use ? RRS feed

  • Question

  • User739395576 posted

    Could any one tells ?

    If you have normal simple website consist of only pages (aspx and aspx.cs).

    then if u decide to enhance the website little bit and separate the logic from UI means u put the logical code into classes (.cs) files

    which patterns u r using ?

    Tuesday, August 19, 2014 7:48 AM

Answers

  • User-821857111 posted

    You aren't applying any formal design or architectural pattern. You are just organising your code.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 19, 2014 3:02 PM
  • User-821857111 posted

    An application layer sits between the business layer and the end points of your application (which can be the UI or web services, for example). It will be called by the UI to obtain view data from the business layer for example, or it might be called to pass data back to the business layer for persisting. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 20, 2014 2:20 AM

All replies

  • User-821857111 posted

    Sounds like you are beginning to employ an n-layer approach to development. What you describe is the beginnings of a Business Logic Layer.

    Tuesday, August 19, 2014 7:59 AM
  • User739395576 posted

    what do u mean ?

    I need a pattern name

    see this link

    http://en.wikipedia.org/wiki/Software_design_pattern

    i dont know which one is correct to my project

    and yes i am new learner

    Tuesday, August 19, 2014 8:02 AM
  • User-484054684 posted

    If you need to separate your logical code into classes (.cs) files, for this situation, you can create a C# class library and you can consider it as Business Logic Layer.

    You can add assembly reference from your website to this dll - and you can start writing the methods. This is first step of layering approach. If you want, you can further divide your data related functionality into a separate class library, say, Data Access Layer. All your entities can go into Business Entities as next step. It depends on how many layers needed for your code structure.

    But be ware, again - too many layers increase complexity too. See this discussion: http://forums.asp.net/t/2003754.aspx?N+Tier+Architecture

    Tuesday, August 19, 2014 8:05 AM
  • User-484054684 posted

    Ok, above is way of organizing your code when there is a requirement to modularize your code.

    However, as far - Design Patterns - are concerned - for your requirement - you can have look at Façade Pattern for this requirement. Your business logic layer can expose a Façade kind of class as an interface - and your website (and any other clients) can consume this BAL layer through façade.

    From your reference: http://en.wikipedia.org/wiki/Facade_pattern

    Tuesday, August 19, 2014 8:07 AM
  • User739395576 posted

    Focus I already separate it I want only the name of patterns i am applying 

    Tuesday, August 19, 2014 8:07 AM
  • User-484054684 posted

    Yes, the pattern name described above is Facade pattern.,

    Tuesday, August 19, 2014 8:09 AM
  • User739395576 posted

    I only have 4 classes and Facade for huge number of classes 

    Tuesday, August 19, 2014 8:11 AM
  • User-821857111 posted

    I want only the name of patterns i am applying

    Well, you aren't really applying a recognised pattern. You are taking an n-layer approach to your application's architecture.

    Tuesday, August 19, 2014 8:26 AM
  • User-821857111 posted

    Yes, the pattern name described above is Facade pattern.,

    You usually employ the Facade pattern when you create a simplified wrapper over a complex API. If you have to create a Facade for your own BLL, you are doing something badly wrong IMO. 

    Incidentally, nothing in the description provided by the OP sounds like a Facade to me.

    Tuesday, August 19, 2014 8:30 AM
  • User-484054684 posted

    Hi Mike,

    Completely agree that Façade abstracts the heavy complex business logic to it's clients and acts some thing like an interface to that complex world.

    Thank you for highlighting this to OP so that OP will be aware of this fact.

    Best Regards

    Siva.

    Tuesday, August 19, 2014 8:39 AM
  • User739395576 posted
    At the end which pattern am i applying ?
    Tuesday, August 19, 2014 2:54 PM
  • User-821857111 posted

    You aren't applying any formal design or architectural pattern. You are just organising your code.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 19, 2014 3:02 PM
  • User739395576 posted
    Okayy thanks a lot
    Tuesday, August 19, 2014 5:36 PM
  • User739395576 posted
    Could u tell me what is normally be inside applicationLayer.cs ?
    I know dataLayer is for database
    but what about app layer ?
    Tuesday, August 19, 2014 5:37 PM
  • User-821857111 posted

    An application layer sits between the business layer and the end points of your application (which can be the UI or web services, for example). It will be called by the UI to obtain view data from the business layer for example, or it might be called to pass data back to the business layer for persisting. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 20, 2014 2:20 AM