About the importance of the layers on a distributed application


often I give sessions to customers on the infrastructure the company I work for developed (my team), when I get to talk on the importance of every layer and how it is crucial that the Business Logic layer should not know the GUI layer many of the customer says “sure, that’s how we do it” but when you come to see the sources , the facts are different.

a part of the problem is lack of designing, because on many occasions the same developer is responsible for the GUI as for the business logic. he builds the business logic to respond only  the gui. the developer doesn’t think in terms of Services, then when the company wants to upgrade their system to talk with other systems they have to go to the drawing board and re-architect the whole application.

the Business logic is responsible for giving SERVICES to the gui layers, those services needs to be defined and enforced all the time. if a programmer gets to a point where he take into consideration the buttons the user presses on the gui when implementing the Business logic then SOMETHING IS WRONG.  The Business logic must be totally separated from having to know about buttons and gui elements. when you’ll come to think about it , you could use the same code from different GUI technogies like ASP.NET , WINFORM and even web services. on many occasions I consider web services as another gui technology.

in Spl Software we’ve built the biggest .net project in Israel (around 100 men years). we’ve implemented the Business logic in such a way that the programmer doesn’t even know if the code he writes will run under a batch process / Web Service/ GUI. let’s face it the Business logic is almost all about validations.

I’m sure that many will say this fits only on large scale system, I disagree , small projects can benefit the same from this approach. anyway just look up SOA in Google and move on…..

Comments (4)

  1. Udi Dahan says:

    I totally agree.

    I find that the best way to build systems is by chaining together simple components in simple ways. Also, I try to let the compiler help me as much as possible by keeping everything strongly typed ( collections ) and by trying to avoid reflection.

    What do you think ?

  2. Yosi Taguri says:

    I agreem but it’s only a fraction of the philosophy a distributed application can have.

  3. Mehran Nikoo says:

    Unfortunately software archictecture is overlooked these days and it is a controversial subject as well since it is influenced by personal preferences.

    Very good point about importance of layers, but I don’t agree with some of your ideas, like considering Web Services part of Presentation Layer. Web Services act as a facade layer to the business components, and so are part of the business layer. Microsoft uses the term "Service Interface" for it. Then "Service Agents" which are web services clients will talk to these Service Interfaces to consume services. For more information refer to Microsoft Patterns and Practices site.

    Also you mentioned that business layer is almost about validation. Although validation is part of the responsibility of business layer, but the main responsibility of business layer is to "apply business rules".

  4. Yosi Taguri says:

    Mehran,

    please notice the mark of almost when I speak of validation, processing data and enforcing business rules are there too.

    if you build you BackEnd services in a Service oriented manner you could expose those services thru web services, so it’s ok for me to say that in many ways I consider webservices to be a gui technology.