Re: How to motivate use of OO?
- From: Robert Martin <unclebob@xxxxxxxxxxxxxxxx>
- Date: Tue, 4 Jul 2006 17:52:33 -0500
On 2006-07-04 02:50:42 -0500, nassegris@xxxxxxxxx said:
Hello all!
[...snip...]
So now I'm asking you people, what should I tell him? Why should he use
objects instead of plain functions? Please give me some good arguments
to use!!!
I presume, since it's just your friend writing it, that the site is relatively small as sites go. Since he doesn't seem to be particularly knowledgeable in the craft of software, and since he has a structure that he already understands, I suggest that creating an object model is not the right solution for him.
The motivation to use OO is to decrease coupling between modules, and manage the interdependencies of the source code. This becomes more and more important as the size of a project grows. You know you need OO when a small change to the requirements causes you to change many different modules, or when one small change in one part of the program causes other unrelated parts to break. These are symptoms of unmanaged dependencies.
Typically these symptoms (called rigidity and fragility) become geometrically worse the larger the system becomes. Dependencies grow with the square of the number of modules. So if your friend plans to grow the system beyond it's current limits, then ask him to watch for the symptoms described above. If the system starts to become rigid (too many modules need changing for simple requirements changes), or fragile (other unrelated modules break when any particular module is changed), then he should consider a redesign using some OO techniques.
Take care not to foist the whole OO religion upon him. It's not likely that he will need a whole object model, or dabatase insulation, or tools like hibernate or EJB. As his system grows what he'll need are the simple tools of OO. A little bit of polymorhism here and there can keep the depencencies in check, and stave off the symptoms of rigidity and fragility.
One other tool your friend will need is tests. Tests will allow him to make changes to the system, and eventually to add OO structures to his system, without breaking anything.
Advise your friend to read "Test Driven Development in C#" by Jim Newkirk. Encourage him to use the technique as he rewrites his system in C#. Advise him that as his system grows, those tests will enable him to make changes with much less risk than he's previously experienced.
And, just between you and me, writing tests is a very good way to force someone to start using OO techniques. Since the tests need to access independent modules, the use of interfaces and polymorphism to isolate modules from each other becomes obviously necessary.
--
Robert C. Martin (Uncle Bob) | email: unclebob@xxxxxxxxxxxxxxxx
Object Mentor Inc. | blog: www.butunclebob.com
The Agile Transition Experts | web: www.objectmentor.com
800-338-6716 |
.
- References:
- How to motivate use of OO?
- From: nassegris
- How to motivate use of OO?
- Prev by Date: Re: Template method: delegation vs inherritance -> insights needed
- Next by Date: Re: How to motivate use of OO?
- Previous by thread: Re: How to motivate use of OO?
- Next by thread: Re: How to motivate use of OO?
- Index(es):
Relevant Pages
|