Author Topic: The next millennium bug  (Read 1506 times)

Re: The next millennium bug
« Reply #25 on: 21 April, 2021, 03:30:38 pm »
The operating system it ran on had a built in date function which could be called from programs (& it was a standard thing to do that) which handled leap years correctly & could handle any date from 1st January 1901 to 31st December 9999. It would have taken less typing to call that than write his little bit of code. Or he could have done nothing at all . . .

Sometimes, it isn't even laziness.

Understanding other people’s code or APIs is hard work and it might have bugs you don’t know about it.

Writing your own code is easy and you know it works and it definitely won’t have bugs you don’t know about.

Re: The next millennium bug
« Reply #26 on: 21 April, 2021, 04:43:39 pm »
So - I should never call another program but always write my own. I should never use any operating system command, but write my own.

That's pretty much what you're saying in this case. That date function was about as reliable as code gets. The chance of it having a bug was essentially zero. Systems all over the UK & quite a few other countries would have been constantly failing if it was buggy.

And you've missed the really, really, important bit: the code he wrote was wrong. It did have a bug he didn't know about.
"A woman on a bicycle has all the world before her where to choose; she can go where she will, no man hindering." The Type-Writer Girl, 1897

Re: The next millennium bug
« Reply #27 on: 21 April, 2021, 05:22:35 pm »
And you've missed the really, really, important bit: the code he wrote was wrong. It did have a bug he didn't know about.

I think you might have missed something too.   :)

Feanor

  • It's mostly downhill from here.
Re: The next millennium bug
« Reply #28 on: 21 April, 2021, 10:06:23 pm »
If a function you need is available from the OS / Framework you are targeting, I can think of no possible reason to re-invent the wheel and implement the function yourself.
I can't see that passing code review here.

I mean, seriously:
Are you going to ignore and re-write the .net framework, where that function is exposed, and target the win API directly Petzold-style yourself?



Re: The next millennium bug
« Reply #29 on: 21 April, 2021, 11:24:08 pm »
I think you might have missed something too.   :)

I was of course adding evidence to Poe's Law.

If a function you need is available from the OS / Framework you are targeting, I can think of no possible reason to re-invent the wheel and implement the function yourself.

Plenty of reasons (in the general case, not necessarily for date functions):
- Your app works on multiple platforms and you already have an implementation and consistent behaviour is desirable.
- The function is known to be buggy or have unpredictable results.
- The function is not performant enough for your use case.
- The function requires and/or returns data in a different format to that you are using in your program, and converting the data back and forth is more work than just reimplementing the function.
- The function is only available as part of a larger framework that you don't want to create a dependency on.
- The function has some other undesirable side effects, like triggering a network call or disk access unnecessarily
- The spec requires the function to produce certain results. The results of the OS call look like they'll produce the right result, but can you be sure?
etc

9 times out of 10 a programmer reimplementing something is wrong, but not always.

ian

  • not a woman, not an american, not a vampire
Re: The next millennium bug
« Reply #30 on: 22 April, 2021, 09:30:00 am »
I, for a while now, have insisted my developers write their code longhand. They get bonus points for illustrating the letters at the start of a routine and using a quill.
Support the Great Surrey Bear Census 2020 (postponed due to COVID)

Kim

  • Timelord
Re: The next millennium bug
« Reply #31 on: 22 April, 2021, 12:29:33 pm »
I, for a while now, have insisted my developers write their code longhand. They get bonus points for illustrating the letters at the start of a routine and using a quill.

This came up at university, where this sort of thing[1] was expected to happen in exams.

After much debate on the course newsgroup, the nerdiest socks-and-sandaliest of CS lecturers chipped in with the legendary advice: "Pointy end down."


[1] Not the quill part.  Though there was a sufficiency of noisily rutting shitehawks on the sports hall roof that would have been first in line for donation of the required feathers.
Careful, Kim. Your sarcasm's showing...