Click here to Skip to main content
13,447,776 members (49,516 online)
Click here to Skip to main content
Add your own
alternative version


50 bookmarked
Posted 9 Aug 2004

Business Façade Logic in distributed n-tier applications

, 9 Aug 2004
Rate this:
Please Sign up or sign in to vote.
Explains how to implement a Business Façade logic layer between the Presentation logic and the Business logic in an n-tier application


If you are focused on implementing a distributed application architecture in .Net and if you are looking for an interface between the Presentation tier and the Business Logic tier, then the Business Façade classes would provide you with the interface you need, along with its advantages.

What's a Façade

Façade is a Design Pattern. It provides a unified interface to a set of interfaces in a subsystem. It defines a higher-level interface that makes the subsystem easier to use.

If the Façade is placed between the Business logic and the Client interface, it offers a single, simple interface to the Business logic subsystem.

Why do I have to use the Façade

The purpose of using the façade class is to eliminate the difficulties that the client would otherwise have in sending requests to a complex set of service objects. The client sends its requests to an instance of the façade class, which acts as an agent manipulating the requests as necessary and sending them on to the set of business classes.

At the cost of one class, the Façade makes it very easy for the Presentation Tier to access the methods of the Business Tier without having to navigate a bunch of potentially complex interfaces. The Façade class also promotes a weak coupling between the Business Rules Tier and the Presentation tier and hence lets you vary the components of the Business Rules without affecting the Presentation tier.

Façade Logic

The Façade layer used in the sample source has the following components
  • Factory Class - MyFactory
  • Façade Interface - IMyFacade
  • Façade Class - MyFacade


MyFactory is a Factory Class. This is another Design Pattern. Factory class lets a class defer instantiation to subclasses. It is an interface for creating objects of the Façade Class. The Factory class implements a method called CreateFacade which is solely responsible for instantiating objects of the IMyFacade interface class.


The IMyFacade is the Façade Interface that defines the methods implemented in the Façade classes. IMyFacade delegates the requests to appropriate classes that implement the methods.


This class contains different subclasses:

  • UIFacade - used by component located on Web Server
  • WSFacade - used by Web Services
  • NRFacade - used through .Net Remoting

Each of these classes contain their own implementation of the methods that are defined in the interface IMyFacade. These methods make use of the Business Logic functionality. It is upto these classes to handle the interaction between the Business Logic.

Class Diagram


Dim iFacade As IMyFacade  '   Facade Interface
Dim Factory As MyFactory  '   Factory Class 
'   Create a new factory class
Factory = New MyFactory()
'   Create a new Facade class. In this case we create a new instance of UIFacade
iFacade = Factory.CreateFacade(MyFactory.MyFType.UIF) '   Type UIF 
'   Call the required methods which inturn make use of the Business Logic methods
Dim strReturn As String
strReturn = iFacade.DoSomeLogic()

The Presentation layer creates an instance of the Factory class MyFactory.This instance is used to call the Factory method CreateFacade. CreateFacade requires a Enumerated type as a parameter which will decide the type of the Façade class to be instantiated.

The method calling the CreateFacade recieves an object of type specified in the parameter. This object is then used to call the relevant method in the Façade class.

For example :

iFacade = Factory.CreateFacade(UIF)
returns an instance of UIFacade.
iFacade = Factory.CreateFacade(WSF)
returns an instance of WSFacade
iFacade = Factory.CreateFacade(NRF)
returns an instance of NRFacade

The CreateFacade is implemented as follows

Public Function CreateFacade(ByVal nType As Integer) As Object

    '   Create an instance of the Façade classes based on the Type required.
    If (nType = MyFType.UIF) Then
        Return New MyFacade.UIFacade()

    ElseIf (nType = MyFType.WSF) Then
        Return New MyFacade.WSFacade()

    ElseIf (nType = MyFType.NRF) Then
        Return New MyFacade.NRFacade()
    End If

End Function

That's it

The source code contains a sample console application illustrating the use of the Façade Classes. The Façade logic can be used as an interface between your Presentation Tier and Business Logic giving you the following advantages

  • Provides you with a level of isolation between the Presentation Logic and the Business Logic. The Façade shields the Presentation Logic from the inner workings of the Business Logic.
  • Interfacing between many modules and classes is made more manageable. It makes the architecture more simpler.
  • Minimizes the communication and dependency between subsystems. Provides an amount of weak coupling between the Presentation Logic and the Business Logic

The Presentation Logic will now be only involved in presenting the UI. The Business Logic will only be involved in delivering the Business related logic. All the communication between the Presentation Layer and the Business Logic Layer will now be fully handled by the Business Façade, thus isolating the components of the application in terms of functionality.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Tingz Abraham
United States United States
When Tingz Abraham was old enough to realize that computers were going to invade the world, he decided to pursue a career that would keep him close to computers. That landed him a job as an IT Solutions Consultant in Seattle, USA where he currently works. He believes he can program in many languages, including English. Ctrl+C and Ctrl+V are his favorite keys on the keyboard.

After he found he sucked real bad at playing the violin, he just stuck to the guitar and piano. He has a ravishing need for speed and takes a fancy to anything with wheels, including his black Mustang which he's aptly named 'Tingzmobile'.

At work you can constantly hear him say - "Oh! The things I learn after I know it all!" He keeps himself very busy, and in his spare time he keeps wondering why '24 hours a day is just not enough'.

He exists at

You may also be interested in...


Comments and Discussions

Generalfacade architecture Pin
rvps21-May-08 1:28
memberrvps21-May-08 1:28 
GeneralClear, concise, and to the point Pin
dasypha9-Jun-07 7:39
memberdasypha9-Jun-07 7:39 
GeneralRe: Clear, concise, and to the point Pin
TiNgZ aBrAhAm12-Jun-07 5:56
memberTiNgZ aBrAhAm12-Jun-07 5:56 
Questionpresentation logic? Pin
Umer Khan12-Apr-07 21:58
memberUmer Khan12-Apr-07 21:58 
should we use asppage.cs file to put function like Gridbinding?and things realted to them? i mean can we have a seperate class where we put such function ?
and what is the actual use of .cs file?
QuestionNice Article, I have a couple questions. Pin
Kevin Jensen23-Mar-07 4:01
memberKevin Jensen23-Mar-07 4:01 
AnswerRe: Nice Article, I have a couple questions. Pin
TiNgZ aBrAhAm23-Mar-07 7:10
memberTiNgZ aBrAhAm23-Mar-07 7:10 
GeneralGood one!! Pin
Pasham28-Mar-06 19:18
memberPasham28-Mar-06 19:18 
GeneralRe: Good one!! Pin
TiNgZ aBrAhAm28-Mar-06 19:24
memberTiNgZ aBrAhAm28-Mar-06 19:24 
GeneralGood article Pin
b_raja4-Oct-05 3:28
sussb_raja4-Oct-05 3:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01-2016 | 2.8.180318.3 | Last Updated 10 Aug 2004
Article Copyright 2004 by Tingz Abraham
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid