in reply to Re: Programming using data structures
in thread Programming using data structures
Yes, you don't want to use switch statements. (Excessively.)
I know what OO is - a little, at least. Sometimes you want to make an object based on a data structure. It isn't necessarily true that by doing this you forgo the advantages of OO. Often, it is a transitional phase. Having done something quick and dirty, you then add the OO layer. You then hollow out the quick and dirty stuff and replace it with nice OO stuff - all without breaking your code, which has been insulated by the OO layer.
Syntax isn't just about discipline. It is also about making life easy for yourself. I have been programming for a couple years - but I still regularly forget the semicolon at the end of a statement. Perl's syntax is complex. Using a simple subset can sometimes be good.
As for the final point... yes, of course you should change just one object at a time. And you should write unit tests for _all_ your code. Hands up everyone who does that all the time. I mentioned this was a "quick and dirty" project.
dave hj~
|
|---|