This blog post is written by Abhishek Chhatterjee.
Application Framework would be a generic term for any framework that helps build particular type of an application with ease. Most software project requirements would allow us to figure out what type of an application it intends to be and an appropriate application framework can be chosen for it. As an example, let’s say the application we intend to make is an intense 3D game. Throw the requirements at a technical architect or solution architect, they would instantaneously figure out that all the action is supposed to happen on a 3D framework like DirectX or OpenGL. Now analyzing a bit deeper, frameworks like DirectX or OpenGL are very low level frameworks whose primary intentions were not to allow building games or video editing software but to abstract the graphics rendering and hardware acceleration details. So when we go back to the architects, they identify a tier for the application which would abstract the games redundant operations like world-setup, physics, AI, state-management, network play etc. Clearly these features can be packaged into a reusable component which future projects can utilize and build upon and ease development of similar applications. Some examples of such frameworks would be Venom, Panda3D, 3D State, Genesis etc. Obviously a video editing software project which also runs on top of DirectX or OpenGL would have nothing to borrow from this framework and hence would create demand for a different one.
Let’s extend this philosophy to Business Applications and we realize that most Business applications would work on data and revolve around how that data is processed and presented. A database is a component that is almost taken for granted in all such applications. Let’s again involve our Technical Architects and ask for their opinion. Since all major databases are relational and most modern programming languages and platforms are object oriented, there is an effort required to bridge the gap and the process is often known as object-relational-mapping (ORM). This process is definitely redundant and is a candidate for our business application framework. Once we have these Business Objects with us following the process of ORM, we need to knit them for our business requirements and set up how they interact with each other. Most of these tasks would happen in the Middle Tier or the Business Logic tier in our case. Most talented architects would emphasize that each and every piece of business logic should mandatorily go in here, whether it is redundant on the UI tier is left to the discretion of the User Experience (UX) team. This calls in for a Business Rules framework that can effectively and efficiently allow such rules/processes to be put in place and hence another candidate for our framework. Let’s back up a bit. What about the Data Access Layer (DAL) which most applications use to interact with the database or a data source? Good catch! It’s one of the primary candidates for being shoved into the framework. The reason we mentioned it after mentioning Business Objects (BO) is because of the fact that a good system architecture would allow flexibility in setting up the underlying data source of a BO. For example, my customer data comes from a web service as an XML file. This data needs to be processed upon and inserted into the database. An effective design would demand that BO’s should be unaware of what data source is providing them with the data. It could be XML, a plain text file, an Oracle database, a MySQL database etc., and should allow easy switching of the data sources in the future as well. A legacy system exposing itself via an ODBC connection could anytime switch over to the more modern web services and something like this shouldn’t be a pain for our architecture to adapt to. Apart from that, another pain in the @$$ is to deal with transactions and proper handling of database connections (closing and disposing objects properly etc) which are very low level yet always there. They too can be encapsulated inside the DAL framework. Coming to the UI tier, there are some very basic tasks like CRUD operations that most systems would perform on their BOs. Set of configurable UI components that can connect to our BOs and provide these operations would make a mighty impact and drastically reduce development time and let us focus more on the key operations. Also let’s not forget the Unit Testing framework. Looking back at the areas we have identified for our Business Application Framework it is apparent that by using such a framework we would cut tremendously on time, development effort, the number of bugs and above all increase quality of code by having higher degree of stability and reliability. The million dollar question is whether such framework exists or not. The answer is, not one, but many! Architects and Solution Designers have a wide choice over choosing what suits their application the most. The good news is that Open Source world offers some of the most reliable and stable frameworks which have existed for many years in the Java world and have been ported to .NET. Many of the open source frameworks exist as independent frameworks which can be integrated together to lay the foundation of your application. For example, NHibernate as the DAL and ORM framework, NUnit as the unit testing framework, Log4Net for logging, NMock for mock object etc. Spring.NET is more of an integrated framework based on the Dependency Injection pattern and it also integrates many of the individual components. Since it comes from the Java world, it comes with a good community support and is built upon robust code. Another open source project called the Castle Project is a very ambitious and claims to become the best .NET application framework. It is based on the Ruby On Rails programming paradigm and is indeed very attractive. There are commercial frameworks too which are very capable. One such framework we had an opportunity to work with was the Milos Application Framework and it comes with an ORM, Business Logic/Middle tier, Test Driven Development and UI components. StrataFramework is another commercial option which provides most of the above. Microsoft isn’t far behind, and is trying to build many open source frameworks for its platform which it hopes developers will willingly use and promote. Most notable ones are the ADO.NET Entity Framework, Managed Extensibility Framework, Task Parallel (for parallel computing) and DynamicData framework.
As the complexity of computation grows we will see many more such frameworks coming in which will allow us to focus on solving business problems instead of worrying about the underlying technical details.