[Tutor] designing POOP

bhaaluu bhaaluu at gmail.com
Tue Feb 12 14:23:40 CET 2008


On Feb 12, 2008 7:19 AM, Ricardo Aráoz <ricaraoz at gmail.com> wrote:
>
> Did we think about REUSABILITY? What if in some other application I want
> to USE the score, not just display it? What if I want to display it in a
> different form (multiplying it by 100)? Then you are back to our
> original options : either check the score directly, define a getter, or
> a .... 'stater'(?) which returns the state of the object (in this case
> it would be a tuple with only the score in it, a getter in disguise if
> you ask me). AFAIK the python way is to just check the score, if later
> the object's author changes something he has ways built in in the
> language to keep the interface unchanged (yes, I think the score would
> be part of the interface, otherwise it would be _score).
>

Everything in this discussion seems relevant to designing Python OOP.
(Python is not java, not javascript, not c++, not visual whatever etc.)
We can see from this that Python does it the Python way. The Java examples
are pretty much wasted on me. (I don't know anything about Java at all.)

The POOP tutorials rarely get into design considerations. They introduce
the mechanics of making a program, make a sample program, and keep
on trucking.  I'm trying to learn how to design a program with Python.

So far, two beginner techniques have been shown: the noun/verb/adjective
method (Alan), and the TDD (Test Driven Design) method (Kent). Of the two,
the noun/verb/adjective method seems more approachable (to me). I think
that once I have some experience doing that, then the TDD method may have
something to offer.

Baby steps first. Walk before running. 8^D
Happy Programming!
-- 
b h a a l u u at g m a i l dot c o m
"You assist an evil system most effectively by obeying its
orders and decrees. An evil system never deserves such
allegiance.  Allegiance to it means partaking of the evil.
A good person will resist an evil system with his or her
whole soul." [Mahatma Gandhi]


More information about the Tutor mailing list