Categories
Development

Code reuse is a myth

Arash Barirani is pondering why domain models is so rarely reused. After all they did teach us in school that reuse is one of the big advantages of object orientation. Everyone could see that the Car and Tire objects the teacher used for illustration easily could be reused in another car and tire application.

He still seems to be having some faith in the concept though, and is still wondering how to achieve it. I on the other hand has lost all faith. Well, not all, but most of it. The problem is: Different customers has different views of their domain, even though they might be doing the same stuff.

Some domains like accounting could probably be used across companies. It is strictly defined, and there are common rules for how to account for everything that happens through a year. Other domains like running a big warehouse will not be the same unless both organizations believe in the exactly same way of running their business. Depending on processes and the people in it the domain can be completely different. There might be some similarities, but even the language might be different. And you sure as hell can’t march in there and tell them to change their language and processes just to fit to an existing model.

It depends on the people running it. As they change or leave, the company will need to change too. That’s when you need SOA… Of course not. But you will need a flexible well designed system that copes with change and is easy to maintain.

2 replies on “Code reuse is a myth”

Hehehe – Accounting domain models may be able to be re-used across companies, but not government. I was recently asked to provide estimates for a government based financial system. For some reason standard practice accounting rules from the private sector don’t seem to apply to the government in the same way. The smaller program units that made up the government department I worked with couldn’t seem to agree on a common accounting model with each other, let alone agreeing with the way accounting is handled in the private sector. The funny thing is, deep down they’re are all the same … core accounting principles shouldn’t change, but add politics into the mix and it’s amazing what can happen. Quite frustrating, but definitely lends credibility to your “code reuse is a myth” statement … and has helped me lose hair …

Why don’t you think of designing a domain model which uses the common things of most different “real” domains and spezializing this model by customizing it with extension points?

Leave a Reply

Your email address will not be published. Required fields are marked *