Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Short routines matter more in OO?

by dws (Chancellor)
on Oct 13, 2003 at 06:26 UTC ( #298779=note: print w/replies, xml ) Need Help??

in reply to Short routines matter more in OO?

So why is the research that Steve McConnell found so at odds with our direct experience?

You've hit on a form of sample-related bias that research to determine "optimal" often falls prey to. The bias enters by way of an unstated assumption that the population that the sample is drawn from won't shift or change its nature.

The studies McConnell cites were done while object-oriented approaches where still taking hold. Their "sample" was procedural code written in the language of the day. At best, that was C, and I'll bet it included a lot of Fortran and COBOL. But in the following two decades, the "population" shifted. Were those studies to be done again today, I'll bet they would come up with very different answers about what "optimal" is. And if you were to do the studies again in 20 years, the answers might be different again.

Replies are listed 'Best First'.
Re: Re: Short routines matter more in OO?
by tilly (Archbishop) on Oct 13, 2003 at 14:41 UTC
    I agree.

    However I still would like to understand why the answers changed. And more importantly, what remained invariant between the art of programming then and now.

    After all at some point the question of what is effective programming practice becomes a psychological question about modes and means of human comprehension. And humans don't change that fast. Criticisms of goto in the late 60's are still on target today. Justifications of it from then are less so - because with experience we have learned how to express with exception mechanisms what then we only knew how to say with goto.

    So an understanding now of (human) invariants is knowledge that is likely to age fairly well. Which is hard to find in computing. :-)

      However I still would like to understand why the answers changed. And more importantly, what remained invariant between the art of programming then and now.
      I'd hazard a guess that what changed was access to the data.

      In non-OO code, since you've got direct access to the data its easier to roll multiple actions into a single sub. With OO code, though, the driving sub can't do that, so it calls into methods on the object to do it, and generally when people write the methods they make them single-purpose so they're reusable.

      What you get is essentially another level of indirection--rather than a sub that looks like:

      code to do A; code to do B; code to do C;
      you end up with:
      object.method_to_do_A; object.method_to_do_B; object.method_to_do_C;
      since people seem to be more inclined to make methods do less stuff than they are to make functions do less stuff.
Re: Re: Short routines matter more in OO?
by zby (Vicar) on Oct 13, 2003 at 08:36 UTC
    So perhaps it is not that in OO short procedures matter but rather than in all languages more expressive than COBOL procedures should be shorter.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://298779]
[pryrt]: LanX, I would vote "keep" if it were considered: it's not helpful, but it could be taken multiple ways, not all of which are offenseive...
[pryrt]: 1nickt: if you are checking for valid user IDs, then I wouldn't care about the difference between 1.0 and 1: I would take either as a valid representation of the integer user ID#1
[LanX]: and this Re^2: extract column data
[Lady_Aleena]: I have two sub recurse { my ($directory, $other_var) = @_; my @files = file_list($directo ry); for my $file (@files) { if (-f $file) { do "stuff"; } if (-d $file) { recurse(" $directory/$file" , $other_var); } } } This was when I hated File::Find.
[tobyink]: 1nickt: your code?
[LanX]: pryrt: yeah, that's why I didn't consider, but the last >10 anonymous posts are from the same troll-person
[jdporter]: is there a module for expanding tabs in text?
[jdporter]: A: yes.
[Lady_Aleena]: I don't know how hard it will be to get out of that mess.
[LanX]: M-x untabify

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (13)
As of 2017-05-24 20:16 GMT
Find Nodes?
    Voting Booth?