25 ms·
If a surgeon needed the help of a computer to make sure that he/she didn't confuse your heart for your kidney, would you trust that surgeon to do an operation o
by cryptica 6y ago
If a surgeon needed the help of a computer to make sure that he/she didn't confuse your heart for your kidney, would you trust that surgeon to do an operation on you?
- augustk 6y agoWhy do you think protective equipment is required in some professions? Is it because workers don't know their job? Anyway, explicit static typing 1. detects errors at compile time 2. provides documentation 3. makes programs run faster.
- cryptica 6y agoProtective equipment is typically used to protect people, not products. 1. Tests detect errors at runtime. Typing is completely redundant when you have even half-decent tests. 2. Comments, good variable and function names provides documentation too. 3. Not really. TypeScript is not faster than JavaScript for example. Even in certain cases where they are faster (e.g. comparing C/C++ with JavaScript), the max speedup is typically less than 40% in the absolute best use cases.. For the average case (typical program) the speedup is typically insignificant (like 5%, 10%...). Also, static types don't stop people from writing inefficient algorithms. On the other hand, statically typed languages with a build step slow down the develop/test iteration speed. In the case of TypeScript, transpilers add complexity to the project in many ways including compatibility issues (since now you have to worry about not just Node.js or Browser version but also TypeScript version and the different permutations)... Source mapping doesn't work right in certain environments. The output often looks mangled and is hard to debug in a constrained remote environment. Takes more time to setup. Adds many unnecessary dependencies to your project. Makes your software harder to integrate by third-parties since your schema is more rigid and might not correspond with their own type system. They encourage developers to define complex function signatures with complex interfaces and encourage passing instance references instead of simple copy-by-value primitives.. The drawbacks are significant and I could keep listing them all day.
- deleted 6y ago[deleted]
- madeofpalk 6y agoI mean we're not surgeons, we just make over-complicated wordpress themes. I like static typing because sometimes those systems are complicated (for better or worse), and you want to understand the wake of a certain change. Or, it's just another form of documentation. How is it disagreeable that these are good things, or only relevent for the less experienced?
- nullifidian 6y agoAnd yet medical mistakes occur pretty frequently. "We removed the wrong kidney" and the like.
- augustk 6y agoOf course, removing the wrong heart would be even worse.
- oalae5niMiel7qu 6y agoOff-by-one errors occur frequently in programming, and static typing does nothing to prevent them, since n and n+1 are always of the same type.
- theon144 6y agoThat's correct, but seems irrelevant?
- cryptica 6y agoIt's very relevant. In fact I would argue that type systems only address the simplest possible errors and do absolutely nothing about the most complex, time-consuming errors such as those related to unpredictable state mutations caused by multiple events being processed in parallel or having different parts of the code operate on the same instances. In fact, I would argue that static typing encourages developers to define more complex function interfaces which creates stronger coupling between components in the code and this leads to instances being passed around/shared between more different files and this is more likely to lead to unpredictable mutations of those instances' state. It makes it easier for developers to neglect good separation of concerns. Dynamic languages make it more difficult to keep track of complex instances between different functions and files so they encourage developers to pass more primitive 'pass by value' arguments; this results in looser coupling between the components. Dynamic languages encourage more modular, more interchangeable code. This is why the most popular package managers of all time are based on dynamic languages like JavaScript (npm) or Ruby (RubyGems) and not on statically typed languages; it's not a coincidence.
- joks 6y agoHow does this metaphor make literally any sense? In what way is type checking similar to making sure you do not kill a person because you can't tell the difference between two organs that look completely different and are in completely different parts of the body? Here's a metaphor that makes exactly as much sense: "Construction workers should wear hard hats." "If surgeons needed to wear bulletproof vests to perform surgery, that would be silly!"
- dw-im-here 6y agoI wouldn't ever trust you to make an analogy