News for hackers. Stuff that matters.
Re:How to Correctly Sum Up Numbers by IshKebab on Sunday November 03, 2024 @04:32PM (#42036248)
There are plenty of absolutes. People just don't talk about them much because there's not much to say:

* binary is the best way to encode information and numbers * twos complement is the best general purpose way to encode negative integers * static typing and stronger typing lead to fewer bugs * length prefixes are better than using sentinel values and escaping

> In almost any other discipline there would be a "correct" way to do it

Tell me you know nothing about anything except computers without...

You think there's a "correct" way to build a bridge?

Re:How to Correctly Sum Up Numbers by GMoromisato on Sunday November 03, 2024 @08:29PM (#42037606)
I was a little sloppy. But the difference between software engineering and building bridges is that absolutes in software engineering are automated away. If there is an always correct way to do something, then the hardware/software always does it that way and we don't expose a choice to the software engineer. When a choice is exposed to the software engineer it is because there is a trade-off.

In contrast, when making concrete, there are valid and invalid ratios of water/cement/etc. You have to memorize (or lookup) the correct ratios. Building a bridge is filled with things you have to look up or just compute from basic parameters.

Of course there are engineering trade-offs in building a bridge. But there are also many "just follow the algorithm" procedures. In software engineering, it's all trade-offs! Almost by definition, if there is a choice, it's a trade-off that requires human judgement, otherwise, the choice would be made for you by the computer.

Re:How to Correctly Sum Up Numbers by poincaredisk on Monday November 04, 2024 @05:41AM (#42040311)
Well even your examples...

* two's complement is the best general purpose way (tradeoffs!)

* static typing leads to fewer bugs (but makes development slower - tradeoffs)

* length prefixes are better than sentinels - but the largest system language uses sentinels for strings (because prefixes are not actually always better, be and sentinels were deemed better by its creators)

Re:How to Correctly Sum Up Numbers by IshKebab on Monday November 04, 2024 @02:23PM (#42045125)
> general purpose way (tradeoffs!)

Not really I was more hedging against HN pedantry...

> but makes development slower - tradeoffs

No it doesn't. It makes development faster!

> because prefixes are not actually always better, be and sentinels were deemed better by its creators

Because they got it wrong.