Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Basic Coding Tips: Parsimonious Parameterization

by stvn (Monsignor)
on Jan 28, 2005 at 21:58 UTC ( #426134=note: print w/ replies, xml ) Need Help??


in reply to Basic Coding Tips: Parsimonious Parameterization

Very nice.

Superfluous 'Status Flags

I cannot tell you how many times I have encountered this issue. And not only does it complicate things from the user side (as you described), I have found it many times makes code totally unreadable. You example shows only one flag, but I have dealt with code and database tables which had 5 or more flags. The justification is usually that it "speeds things up", but this is a classic case of premature optimization.

-stvn


Comment on Re: Basic Coding Tips: Parsimonious Parameterization
Re^2: Basic Coding Tips: Parsimonious Parameterization
by Anonymous Monk on Feb 09, 2005 at 03:13 UTC
    I'm not sure anybody will read this, since I'm a bit late. However, the term 'superfluous' status flags is a little bit indescriptive. For instance, I find the status flags in Apache::Session to not be superfluous, but then again I'm sure they could be replaced... how do you define superfluous in this case? Are they status flags that lead to mistakes in code logic? Aren't all mistakes in code logic a problem? What 'superfluous status' flags simply aren't mistakes in code logic rather than "Parsimonious Parameterization."

      Superfluous status flags are those which can readily be inferred from the rest of an object's state. They denormalize the data structure (in relational database terms) and the additional code required to update them in sync with the actual data violates the Once And Only Once principle.

      Makeshifts last the longest.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://426134]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2014-09-03 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls