The first way is to find an appropriate whizz-danger of a data type and write a diddly little dongle that does the job. So smooth...
But for 95% of the computation using that data type is rather overkill as far as efficiency is concerned.
The second way is is choose an even more appropriate data type, use that for the 95% of the calculation, and then with a flick of my wrist do the last 5% of the job with the necessary whizz-danger data type.
Now what to do? YAGNI tell's me to do the first option, I just have to print a few numbers on a screen and I'm done.
Now my dark past tells me to have pride in producing an efficient result, look at the quality, feel the width.
Which to choose?
Another point: to get one of the numbers computed, I can used some simple Noddy Programmer Maths, OR... being brilliant, as well as modest, I can perform a wonderful magical mathematical trick. But a Noddy Programmer might not get it without some tedious explanation which would probably baffle him anyway. Ok it's not my fault he didn't do his sums well at school and that sort of thing, and I would definitely like to show I'm A1 at maths, if not at coding this stuff.
BTW I guess you can read Newbie for Noddy, but there is a distinction.
Any more subtle hints?
Are you really, really sure about this? In the topsy turvy world of self-optimizing compilers, stochastic processes and hand-tuned libraries, such "common sense" can not always be relied on.
It's almost a "zen" thing:- clearing your mind of all thoughts of efficiency leaves you free to design a truly simple solution, and can often actually lead to more efficient code
Originally posted by Barry Gaunt:
Another point: to get one of the numbers computed, I can used some simple Noddy Programmer Maths, OR... being brilliant, as well as modest, I can perform a wonderful magical mathematical trick. But a Noddy Programmer might not get it without some tedious explanation which would probably baffle him anyway.
Well, I'm a liberal arts graduate, and I was able to figure out wonderful magical mathematical trick #1 on this assignment on my own.
And when I saw wonderful magical mathematical trick #2 on this assignment, I exclaimed "So, that's what that's for!"
So any more subtle hints?
Google is failing me so I'll quote from memory now, and edit later when I can look this up from hardcopy at home.
"The value of fortunetelling is that is shows how perfectly useless it is to have the correct answer to the wrong question." -- Ursula LeGuin, The Left Hand of Darkness, loosely, from memory
In jest, Michael
? I sassed you as a hoopy frood who knew where his towel was.
Where's my towel
Is this the one where you show that signed whatsit is missing, then write it again so it works?
The 95%-5% approach didn't work here either !
Then it becomes an incredible shrinking program - And it's optimised; there's nowt left !
Minimalism, don'tcha love it ?
Sure every once and a while you have to write some code for the Hubble telescope, that has to run on a space hardened 386, in 768 bytes of memory...
But usually, you want to write code that's easy to debug, easy to enhance, and that the next guy / gal will enjoy reading. 'Write your code as if the next person who has to work with it is a homocidal maniac, with a short temper, who knows your home address.'