Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re^2: Problem Domains and Multiple Disciplines

by ambrus (Abbot)
on Aug 30, 2004 at 16:11 UTC ( #386949=note: print w/replies, xml ) Need Help??

in reply to Re: Problem Domains and Multiple Disciplines
in thread Problem Domains and Multiple Disciplines

That's a bad idea. You should code it as

my sum = 100 * 101 / 2;
or something like that.

I know this from practice, as I once accidentally wrote 8092 instead of 32*256 in a program and had a hard time finding out why it wouldn't work. A computer can do arithmetic better than any of us.

Replies are listed 'Best First'.
Re^3: Problem Domains and Multiple Disciplines
by BrowserUk (Pope) on Aug 30, 2004 at 16:43 UTC

    I did it with a the shape of a calculator:)

    I get your point, but unless the constants 100, 101 and 2 have some meaning in context, you've just advocated magic numbers.

    A well named constant, that made sense in context, would be preferable.

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2021-03-01 22:31 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (27 votes). Check out past polls.