When developing software you’ll find yourself sometimes repeating the same lines of code between projects to accomplish similar tasks. When this situation occurs, you probably can build frameworks that can be reused later on projects.
The problem with developing frameworks is that it takes more time to build them and sometimes the project constraints don’t allow investing time in this type of issues.
Frameworks are generally composed of objects and libraries that can be used to extend a new set of objects, removing the need to rewrite code. Also, when changes are needed in these extended objects, is basically simple to add them because the framework handles most of the logic. Also fixing bugs is easier as a fix in the framework, which means all extended objects are fixed.
In our case, we develop all our products and projects on frameworks developed during the years and using freely available ones.
Data layer
Our data layer is completely automated. I really don’t remember the last time we had to write a SQL statement to access the database.
First we started using Gentle.NET that was very powerful at the moment. It allowed us to create tables, views with an easy object representation. It also provided CRUD methods out of the box.
Later we migrated to Enterprise Framework that provided a similar set of features but performance was even better and the possibility to use LINQ gave us a lot of flexibility for writing custom queries. Adding columns to tables is easy as adding the property to the data objects. The whole application then notices the changes and continues working.
The business (or logic) layer
For this one we created a custom framework. We have a set of classes that automatically handles CRUD operations with objects in the data layer. On all our products we have a set of separate objects for logic and data. This gives us lot flexibility when making future changes.
This business layer also includes functionality for getting a list of objects and some basic filtering methods for these objects.
Authentication and authorization
We have a set of classes that handles authentication and authorization at the object level for users. Each object checks by itself if the current user has permissions to perform the selected operation. This verification is even made in relation to the object and user. In essence, is the current object owned by the current user and then can the current user perform the actual operation.
All this is a part of a framework and objects get the functionality by inheriting from the framework objects. No need to code and recode again these validations.
Email handling
We have a container that has all email templates configured and just need to plug it into the application for it to work. We just need to configure the content for the emails and the events the application will respond to for sending the emails (user registered, forgot password, etc.).
All SMTP send and receive is already coded.
Do you think frameworks can help reduce development time?