What is involved here is a sense of degree. Turning to the analagy thingie again: If I am makeing a salad for my wife and I, I will shred a carrot by hand, If the salad is for five to twenty people, I will get out the food processor (more standardization and expense), if the salad is to be bagged and sold in stores, I will invest in industrial shredding equipment for large scale operations(still more standardization and more expense). Even though I now own a successful salad bagging corporation, and have a food processor in my cupboard, when my wife and I want a salad, I will still shred the carrot by hand.
Shall we compare this to programming? (even if you don't, I will). If my assigned task is to print Fred Johnson's name, my code may consist of:
print "Fred Johnson\n";
I might even skip strict and warnings (gasp).
If my assigned task is to print any name that can be entered I will use an input routine, a print routine, as well as an edit routine for the user entry (yes yes, strict and warnings at this level - sigh of releif)
If my task is to print the names of all people from an industrial mailing list, I will use the above type of code, but with more standardized options: editing options, error flagging, formatting, extended hooks into each routine and a lot of other standardized techniques.
Why the three(actually more) levels of coding?
Analysis of: requirements, likelyhood of change, and potential longevity of code use. The first example may be a one shot class assignment. This poses very little chance for reuse or modification. The second example might be to echo back the name entered as a part of a kiosk program. Potential change is small or specialized (oops we don't want naughty words to be displayed back - relatively basic addition - no let's not discuss all the potential pitfalls of this statement). The third example has good potential for the requirements to expand, there will be some changes to input or outtput format, and the code may be used in a production environment for a long period of time.
Each and every program has it's own set of constraints - budget, time, paranoia, basic user expectation and so on. All levels of programming can benefit from standardization, but how much of the cost is recoverable from the usefullness of the project.
Looking at it another way, if a game crashes under certain circumstances, I as a user will be a lot more understanding than if my life support system crashes. Why? Becuase if I lose 2 levels in a game it is irritating, if life support crashes, you are messing with my addiction to oxygen.
Still another way:
Look at the door to your house, what kind of lock do you have? (usual answer - lock in the door knob and for extra security there is a deadbolt).
Why not have a retina scanning voice print recognition system with time locks and alarm system (oh and by the way, those glass covered holes in the walls must go), This is MUCH more secure and standardized.
On an on we could go - but as in all things balance must be reached between needs, cost and ability to provide a solution.
Thank you for bringing up a fun point for discussion!
da geek
In reply to Re: Re-use: moderation please.
by johndageek
in thread Re-use: moderation please.
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |