When developing applications of a more complex nature your role as an architect or senior developer is to create reusable patterns that your development team can implement and follow. Even if the application is not an enterprise level piece of software, having clean patterns in place make your development and code implementation much smoother and easier to follow.
The reason for these patterns is very important: Each developer will of course have their own way of implementing certain things; it’s the nature of a human being to do things the best way they see fit. While each developer may have a perfectly acceptable method of implementation the fact remains that they will all be individually different, and that can create confusion in the code.
As the architect your job is to ensure the development team sticks within certain boundaries of coding and the way to achieve that is through patterns. The key to adoption within the team is to brainstorm and discuss certain implementation strategies. Then a decision is made based on the collective ideas from the team and a pattern is created that all developers will then follow.
The pattern itself shouldn’t be considered as the ultimate way to implement certain chunks of code but rather be perceived as a best effort and most importantly a uniform way of defining code segments.
That being said the purpose of this tutorial is to take a common pattern found in almost any application and define it in a simple and reusable fashion using Object Oriented (OO) techniques. The pattern we will look at relates directly to database modelling and representing single entities of information once they have been extracted from a data store.
The goal is to map an object to a database record and use OO techniques to make a developers life easier when working with these objects. For this tutorial we will use ASP.NET to implement an example application although the code and pattern can be applied to any .NET project type.
Note: ASP.NET running version 1.1 is required for this tutorial. Both VB.NET and C# code samples will be provided