Re: How to motivate use of OO?



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                  |



.



Relevant Pages

  • Re: is there alternititve medicine for a cat with feline leukemia
    ... Just my opinion but your friend is doing the beloved cat no favours by ... him down until he came down full-blown with symptoms. ... bout of illness, and stayed healthy almost another year. ... The #1 most important thing to keep a FeLeuk patient healthy is to ...
    (rec.pets.cats.anecdotes)
  • Re: Cannot create new documents in Word or edit existing documents.
    ... Yes there are viruses with these sorts of symptoms. ... with the problem following your friend -- presumably she tried opening the ... > It seems that the problem has occurred on two separate computers, ...
    (microsoft.public.word.docmanagement)
  • Re: When Comfort Food Doesnt
    ... Probably of a heart attack ... >>(symptoms of indigestion mentioned). ... > Yikes, Barb...it is getting dangerous to be a friend of yours. ... Then there's the 31-year-old daughter of a good friend who was diagnosed ...
    (rec.food.cooking)
  • Dimension 8200 beeps twice, no video
    ... I'm working on a Dell Dimension 8200 for a friend and don't really ... know the history of the problem, but here are the symptoms. ...
    (alt.sys.pc-clone.dell)
  • Re: Training to Overcome Cultural Bias
    ... Another friend was told, by teachers, ... his son needed to take Ritalin to control his agressive behavior in class. ... WHAT TRAINING TECHNIQUES CAN YOU USE TO OVERCOME THIS ... FOR SELF DEFENSE WHAT KIND OF TRAINING TECHNIQUES DO YOU USE IN AN ATTEMPT ...
    (rec.martial-arts)