[Tutor] Help - Where and when to use OOP

Alan Gauld alan.gauld at blueyonder.co.uk
Tue Jan 20 18:42:18 EST 2004


> > I have a little exposure to OOP. I 'd like to know
> > for what kind of programs that I should use OOP

> processes'. In general, you should use OOP when you
> need more abstraction, reusability, and encapsulation.
> Large projects, whether immediately aparent or not,
> tend to need this. With small projects, you can go
> either way.
> 
> Daniel Ehrenberg

I agree with all Daniel says here. I'd also add that 
programs where you have to process large amounts of 
identical data in the same way are often easier written 
in a procedural way - a sequence of transforming functions 
- than trying to model the problem as objects.

Another slant is to look for problems where you manipulate 
a variety of different types of data in similar ways. That 
is you perform the same basic operations to many different 
types of thing. This is often a good indicator that the 
things can be modelled as objects and polymorphic methods 
used for the operations.

And anything that mimics the way a real-world situation 
works can usually be modelled in objects.

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list