0

I am writing a simple data- displaying app that has a UI presentation layer, a data access layer, and a commons layer which includes the data sets. Since this application will be relatively light weight (no writing / updating data) I figured it would be easier to use the Data Facade pattern instead of writing the Business Logic Layer.

The question: I have been following this article on Facades: http://msdn.microsoft.com/en-us/library/orm-9780596527730-01-04.aspx and in Fig 4.5 the Facade is written into the same library as the sub systems (which in my case would be the data adapters). Would you take this approach vs. writing a new C# class library for a Data Facade all together?

In my UI I am utilizing the Data Facade in this way:

public partial class MyDataApp : Form
{
    DataFacade ApplicationDataFacade = new DataFacade();
}
Kapil Khandelwal
  • 15,958
  • 2
  • 45
  • 52

1 Answers1

0

According to the definition of the facade pattern, the point is to simplify complex libraries or APIs into simple ones using a class that creates a simple interface to the whole library.

So to answer your question, a facade pattern makes sense when complex libraries are involved, meaning it cant be a substitute to creating a business logic, it's an abstraction of it. If you choose to use a single class for the whole layer, it will have all those responsibilities in a single class, which is not what the facade pattern is after.

It's understandable to try to use this approach when the project is small, but remember to evaluate how much your system can grow in time, to avoid having hard times at maintenance.

RaulMonteroc
  • 176
  • 14
  • The Data Facade I'm writing houses (no pun intended) several data adapters that correspond to different data bases. It has methods that return filled data tables to say, a grid view in the UI. – discofighter411 Apr 29 '13 at 16:15
  • in that case, if the only thing you are doing is getting data from a database, you are not required to use a bussiness logic. But, evaluate if that data needs to be filtered and validated in wich case a bussiness logic might comme in handy. – RaulMonteroc Apr 29 '13 at 16:24