There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You start with a story and some paper index cards ( Class Responsibility Collaboration(crc) cards ) because there is (no isa in crc) marinersk has the right idea, you should always start by asking questions, too many tutorials jump straight into writing code ... how can you write code before you know what its supposed to do? Similar to what marinersk is trying to convey but the important difference is you don't design around attributes -- otherwise you end up with a bag of attributes -- you're designing about responsibility, then the actions(methods) needed for such responsibility So this is what you currently have
So you can see that some some reorganization is in order , and you need to step back and tell a story (and write it down), then create some class/responsibility/relationship cards and see how they fit together One class has too much responsibility and needs to be split up into two maybe three classes The other class is confused a little bit about its purpose And a third class is missing ... the classic pattern is MVC, you have Model (or the makings of a model), you have the beginning of a View, but there is no Controller
For another comparison jeffa also starts with inheritance based on attributes, but its too early in design phase to think about attributes, esp inheritance based on attributes , inheritance isa crock best avoided Its like almost every tutorial on MVC... just takes for granted the questions what is the responsibility / what should it do, and jumps straight into bag of attributes, but you're supposed to hide the data behind an interface So here is the best next step you can take, tell a story, make some index cards, see how they fit together to help tell the story, and then share your thoughts with us, this is the beginning :) In reply to Re: How do I go from procedural to object oriented programming? ( ooad ood modeling crc)
by Anonymous Monk
|
|