3 ms·
Programming is easy. Read the documentation for all functions you call. Make no assumptions. Read the RETURN VALUE section of man pages. Read about the behavior
by vortico 7y ago
Programming is easy. Read the documentation for all functions you call. Make no assumptions. Read the RETURN VALUE section of man pages. Read about the behavior of NULL arguments. Don't do anything outside of the function "contract". This applies to anything from C to Rust to Javascript.
If you break these rules, programming is hard. Working with programmers who make unproven assumptions is also hard. Either don't hire them, or train that behavior.
- noelwelsh 7y agoThis is just arrogant nonsense. If your attitude was followed in aviation safety passenger jets would still be crashing at a regular rate. Computers are good at following rules every time; humans are not. The systems should be designed so that the complementary strengths of each are used. This is one of the ideas behind types in programming languages: they provide checks that the computer (which is good at this task) performs every time you compile code. Put more simply, get rid of null from your programming language and you get rid of a whole class of errors.
- Out_of_Characte 7y agoYou're following up on his comment proposing strict adherence to rules by proposing a strict type system that isn't allowed to be violated. Which one is it? Are all errors supposed to be caught by the programmer? are all incorrect type conversions supposed to be caught? or are you saying that's nonsense and you shouldn't always adhere to these rules? Finally, NULL values are perfectly reasonable in programming. shifting them to another arbitrary number doesn't solve anything.
- noelwelsh 7y agoYou misunderstood the point. Computers are good at following rules and humans are not, so get the computers to do the rule following. That's what a type system is: a bunch of rules that the computer checks every time you compile your code. (As for null values, modern type systems have no need for them. I guess you aren't familiar with them, because the alternative is not "shifting them to another arbitrary number". Checking out Rust / Haskell / Scala / Reason / Elm etc. might help.)
- vortico 7y agoType systems are 0.1% what I'm talking about. There's WAY more to a function contract that its type. For example, consider the function `round(x)`. Does it round toward infinity, toward negative infinity, toward zero, bank rounding, etc? There's one easy way to find out: Read the documentation of the function. Programmers who don't do this will find programming "hard" because everything they do will eventually break and crumble. Working with programmers who make assumptions without finding proof in documentation will give your project so much technical debt, you might as well redo their work yourself.