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)
Good Idea, but I think it’s already made. Every application developed usually has business classes like Employee, Company, Department…etc
The only difference is that those classes are implemented by the developer (only once) and then re-used. So, the concept of re using is applied for the rest of the application.
Well, The point is not about re-using within the application. This is a basic thing to do.
My point is about why waste time building an address class for example, Why not have some open source library containing such a class that you can use directly without needing to build it -even for the first time.
Why waste time creating all validations on zip code for example when this is more or less what everyone dealing with address will need to do at some point in time?
We just need to start an open source project to build such classes and use them to save a lot of time
Well I personally think it will be beneficial in the logic more than the UI. I was using ASP.NET validator components with traditional UI components (textbox etc.). Those were places in a CreateUserWizard, it simply didn’t work for some mysterious reason. My validators weren’t working. Perhaps they had some validators that were named the same as the ones I named. Its a mystery, I ended up writing my own validators not to mention the amount of time I wasted debugging.
What I’m trying to say, they might be helpful in the logic side more than the UI side. Cause in the UI side you can never implement the controls in such a way it would fit everybody’s use.
At the very end there are lots of languages with lots of compliers to implement each class on, but it can be done. However in certain cases implementing them from scratch will still be the ideal way of doing a task.
I am a fan of one platform for development for any type of application which can implement from extreme low level (Assembly Language) to extreme high level (Java and C#). With the power of todays processors it can be done. I know thats the road map with the processors and graphic cards GPGPU thing. I can’t see why it can’t be done in software (might be what Java was trying to do, but its high level only. Perhaps ANSII C++ is a hint here.).
If you are willing to start that project open source in source forge, we can start it, im willing to help in. Perhaps in different languages 😉
I think if these class libraries were built this would save much time and minimize the business-logic-hassle that developers find themselves forced to deal with.
I would be interested to join if you decided to start working on these class libraries.
I totally agree. It needs to be implemented. But on the other hand, if people are not doing it, then i think there are two possibilities:
1- People have tried but it failed, possible reattempt will be good here.
2- People never bothered trying.
Both cases i suggest trying it, worth a shot.
I would suggest using a meta-language like XML and code generators to generate such libraries.
Though it will add an extra step, but will give you the benefit of customizing the generated code (generate only a subset of the objects for example) and the support of multiple languages and platforms.
Another thing is logic reuse. Validation logic, calculated fields can be defined in the meta data, and the code generator flushes out the proper programming language specific code.
I did not look into Microsoft Domain Specific Langauges tools, but it can be used for business objects RAD scenarios too.