[Tutor] techniques for OO design
Robin B. Lake
rbl@hal.cwru.edu
Sun, 8 Oct 2000 08:01:11 -0400 (EDT)
Although I'm a grey-beard at programming, I had my first real
clean-paper chance to specify an object oriented approach (with
Python in mind) last week. It involves a streaming-media scheduling
application, wherein both content (live video, tapes, and MPEG-encoded
"assets"), the equipment to deliver the media (machines, encoders,
networks, disk space), and the people to operate the system all have
to be scheduled.
First, I simply listed the "objects" (by class): machines, staff,
networks, media sources, etc. Then I sub-listed the specific
instances of each class of objects: Machines: encoders, video juke boxes,
viewing rooms, ...
Then, I identified the "operations" (methods?) to cover ALL objects:
"Add an object", "Repair an object", "Schedule an object", ... I use
Lake's Second Law of Software Physics --- "For every operation there
should be an equal and opposite re-operation." Schedule/Reschedule/Unschedule,
Add/Remove, ...
Then, I listed the functional requirements to implement a system using
the "objects" and "operations". No design yet, just a list. Like
"Provide a user interface", "Prepare a usage chart", "Identify schedule
conflicts", "Tally requests", ...
Then, the first bit of design. Think about a working system in your
mind's eye; consider a high-level of design and implementation, such
as "User Interface should be a Web browser", so add to the functional
requirements "Accept HTML/XML commands" and "Issue an HTML/XML Web
page".
At this stage, I get the user's sign off on the functional specs. Next
to be done is a User Manual --- yep, before coding the first line, tell
the story that's in your mind's eye. It will serve you down the line
as well as give the user some (false?) sense of security that you know
what you are doing.
THEN, I'd start with some piece of the system and write the test code.
Maybe it's just something that tests adding to and removing from a
list or dictionary. (see "extreme programming" at www.xprogramming.com)
Build and test one piece at a time, ALWAYS KEEPING A RUNNING SYSTEM.
Rather like building a house on a sound foundation. Of course things
will change as the systems gets built ... the specs and drawings and
location and interaction of things will move around as you see how
the house/system REALLY works.
Enjoy. It all goes much better if you have someone working with you.
Cheers,
Rob Lake
rbl@hal.cwru.edu
> From tutor-admin@python.org Sat Oct 7 22:06:52 2000
> Delivered-To: tutor@python.org
> X-Authentication-Warning: isis.visi.com: wilson owned process doing -bs
> To: tutor@python.org
> MIME-Version: 1.0
> Subject: [Tutor] techniques for OO design
> X-BeenThere: tutor@python.org
> X-Mailman-Version: 2.0beta6
> List-Help: <mailto:tutor-request@python.org?subject=help>
> List-Post: <mailto:tutor@python.org>
> List-Subscribe: <http://www.python.org/mailman/listinfo/tutor>,
> <mailto:tutor-request@python.org?subject=subscribe>
> List-Id: Discussion for learning programming with Python <tutor.python.org>
> List-Unsubscribe: <http://www.python.org/mailman/listinfo/tutor>,
> <mailto:tutor-request@python.org?subject=unsubscribe>
> List-Archive: <http://www.python.org/pipermail/tutor/>
>
> Hi everyone,
>
> I'm continuing to dabble with Python whenever I can. I struggle, as I
> suspect many who have worked with procedure programming languages in the
> past have, with the implementing OOP princples. I've created a few rather
> simple OO programs and I can see the beauty in it.
>
> I'm wondering if any of you can suggest a method (pun intended) for thinking
> about how to structure an OO program. I understand that many people work
> with UML, but that's more than I have time for right now. Are there some key
> questions that can be asked in the design phase? A simple graphing scheme
> perhaps?
>
> I'd love to hear what techniques others use.
>
> -Tim
>
> --
> Tim Wilson | Visit Sibley online: | Check out:
> Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/
> W. St. Paul, MN | | http://slashdot.org/
> wilson@visi.com | <dtml-var pithy_quote> | http://linux.com/
>
>
> _______________________________________________
> Tutor maillist - Tutor@python.org
> http://www.python.org/mailman/listinfo/tutor
>