Whenever programmers start any project that involve business objects (examples: Customer, Bank, Account, Check, Purchase Order, Invoice, etc.), we start designing each object and deciding what properties each object should have:
Example:
Class Customer
{
public String FirstName;
public String LastName;
…
}
This means we basically start from scratch, we build these business objects from Integers, Strings, floats, boolean, Dates, etc.
Why are we content with doing this when we know that for any banking application for example, we will always have a customer object that will always have a “Name”, “ID”, “Address”, etc. ? Moreover, within any domain (banking, retail, travel, etc…) There will be always a given set of basic business objects with some given set of properties and methods.
If we take retail applications for example, we will always have classes like Customer (with properties like: Name, ID, Phone, etc.) , Product(with properties like: ID, Description, Price, etc.) , Invoice (with properties like: Date, Total Price, etc.)
For Medical applications, we will always have classes like Patient, Physician, Diagnosis, etc.
For Education applications, we will have classes like: Student, Class, Course, Instructors, etc.
Why then don’t developers just use ready made libraries that can be domain specific. For example:
- in the health care field we will have a library having classes like: Patient, Provider, Claim, Physician, Hospital, etc.
- For Banking field we have: Customer, Account, Transaction, etc.
- For Retail field we have: Customer, Order, Invoice, Product, etc.
This could prove to be a huge time saver and also may help reuse some of the logic, analysis and effort that was already put in that area.
So Next time I need to start a banking application for example, All I need to do is:
- Reference the banking.dll in my project (or import the project having the source code)
- Subclass the different classes I need to fine tune.
- Bingo !
Imagine how much time could be saved that way.
Surely enough not all projects are the same even within the same domain. Object oriented programming have a solution for that: “Inheritance”. Any developer can simply subclass whichever class they want and add / Customize the properties and fine tune it to their needs. At least all the basics will be ready to use, a developer will just add the extra work needed for their own unique project.
I was in a store the other day and found many ready made “paper” invoices, purchase orders, etc. for people to buy and use. Companies find that it makes sense to invest money producing such hard copies and people buy them because such items are more or less the same across the board. How come then that we don’t have the same approach in software where we have a much higher degree of ability of customization and fine tuning?
The same argument applies for Database tables. The difference is that customizing the tables simply means editing the tables structures to fit the exact needs.
Or to take it a step further, maybe these libraries will come along with database scripts and O/R classes or data layer classes or Stored procedures to slash even more of the time needed to persist the classes in the library.
Programmers use ready made components all the time. in User interface design, It doesn’t make sense for a programmer to build his own Text box or data grid. We simply use ready-made text boxes and data grids.
This approach is used to some extent in the data layer as well, we use application blocks that handle database operations rather than than doing all the tedious work.
Why then when it comes to Business objects, everyone is content with starting everything from strings, integers, Dates, etc.?
We can start open source project to build such libraries that will benefit everyone. Would anyone join?
“If I could see further, It’s because I stood on the shoulders of the giants who preceded me” (Sir Isaac Newton)
Read Full Post »