Sunday, November 9, 2008

Application Architecture

Last days I was busy in discussion architecture of an Application.
Without going in any further detail we divided our application architecture (Arch) into traditional three layers. But throughout the whole design of application Arch that implementation should be separate from the communication between layers.
I explain what I did with it.

User Interface
First of all discuss UI actually it depends on the technology you are using like I was on .net then .net provides you controller class in shape of aspx.cs ,but it would be different in case of Java.
In Java usually most of architects use Front Controller Pattern but in case of .net we usually prefer Page Controller Pattern I will not delve into the detail of patterns because this is not our target.
I really love this pattern(FCP) to use in my application .In we have facilitated by web Framework of .net it handles itself all the requests,but if needed more control on application or new request handler so go to FCP.

Page control pattern should be use in every application it reduce our calling from every instance, it take care of all prevention that we have to do on every page.

Like session, security, some cached object, most visited objects and all decision we have to take on most of the pages we promoted it into base controller. Base controller will handle it, now it’s time to move on Facade thin layer.

As our focus on we want to separate implementation from its abstraction. Actually this is very important for us to know this rule. Everyone can implement own its own way. I do it on my own way , Everyone do it according to his business needs and its convenience. But rule should be same.We use FAÇADE because of facade can call BAL or might be outside of our domain like web service etc.
So, UI layer shouldn’t be affected and free from this knowledge that where it gets data and what is the complexity or calling cost.

BAL (Business Access Layer)

Business Manager contains all the business knowledge of Application, Transactions ensures, maintain abstraction between UI and DAL. Architecture should have BaseManager which responsibility is control transaction, most frequently called methods actually this is contract between Façade and BAL so, FACADE doesn’t know about the implementation of Managers. There is a question manager can’t have same methods then we have to make interface for each manager just for separating it from implementation because you can have two managers for same purpose for any need/requirment, it provides you a flexibility to change your implementation according to your need and your application other part will work smothly.
In every BAL class should be singleton just for ensuring a single object and avoiding unnecessary object on every call.

Another good Idea about it is I read something about spring framework this is excellent it takes all the responsibility of making object we just pass the object name and it creates it for us. Great thing of this framework is you can also define dependency and it will create object for you with all of its dependencies.
Great work!

Data Access Layer

Data Access Layer also the same rule we define interface for every DAO. Every DAO object should be singleton because otherwise might be there is a huge amount of unnecessary object creation.
For avoiding this extra object creation implement singleton in every DAO

This is BaseDao responsibility to control the internal transaction and all search criteria, Creation, Deletion and Updating method to avoid redundancy of same implementation. It can be possible to have object caching because it will avoid your round trip of server each time and improve the performance of your application. Most important thing to use this framework is work with objects rather xmlDataset. For Object Relational Mapping you can use

• Nhibernate
• ORM Tool
• Opf3
• Entity Framework

For avoid creation of Dao object every time in BAL you can use As I discussed earlier some Framework following Inversion of control prevent us to couple other layer and take responsiblity of object creation. I am discussing here Spring Framework we have also other Framework available you can use according to your requirement and ease of use.
So, this framework responsibility to create, session and keep all its dependencies and return on calling correctly.

Sunday, November 2, 2008

cutomize workflow

I have updated my previous workflow blog with detail example see