I am a systems analyst by training, but just before they started teaching object oriented analysis and design, so I missed out on that part. One thing I did learn was though that it's good if an application you make can cope with change.
So now over to the question at hand: High-level methods to low-level: Do I put them together?
Uno managed to dig up a URL to some web pages that describes the patterns in the "Gamma" book, which seems to be a kind of bible about patterns in OOD.
One pattern is called factory, and it seems to be constructor that can decide what kind of object to construct at run-time. I think this is similar to what you call the main object constructor. I suppose that instead of a parameter it could check a configuration file (or object) in order to decide what kind of object to return, e.g. "MySQL is true". It could also just try (e.g. with eval) to create objects of different classes according to an ordered list. I suppose this is the way the AnyDBM module at CPAN works.
The adapter pattern is a way to connect an object to another object, where certain method and attribute names are expected in the communication. The adapter object then goes in between to translate. So it's an interface translator, though perl doesn't have explicit interfaces as does java. It could be used to cajole in a class from CPAN in a place it didn't expect :-)
I didn't find any info on helper objects and polymorphic objects, but I guess that you would create these and store them by reference in a slot in e.g. the Category object?
Going back to the practical case of my log analyser, it seems unnecessary to factor out the match_line or store_event methods etcetera, that would just create a lot of small classes. There is a data structure called "Tree" that could be made into some kind of general tree-storage class, but will probably not be worth the effort.
/jeorgen
In reply to RE: (chromatic) RE: High-level methods to low-level: Do I put them together?
by jeorgen
in thread High-level methods to low-level: Do I put them together?
by jeorgen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |