|
|
|
|
|
by jazzdog
5002 days ago
|
|
I would disagree with item 3. I am a professional developer. Not remotely professional, but flat-out professional. And I make mistakes. I know other developers, wait, greater than remotely professional developers, that also make mistakes. Even though I'm a professional developer and I've got a careful map of the code in my head, and I'm careful not to make mistakes, I still make mistakes. I've seen other developers do the same thing - make mistakes. I'm always stunned, but it keeps happening. I have found that type hints, code completion, intellisense, helps me discover mistakes sooner, often before I make them. I have found that mistakes found sooner are cheaper to fix. Type hints have huge value for productivity. Often, BTW, you are using a class (or JS function, whatever) that you didn't write, so you don't necessarily have this careful map in your head, your trying to figure out what this beast is that you're using, and hints are extremely helpful there.
I think Typescript is great, from what I see so far. And it's not like Anders is trying to hijack JS. I see it as a development tool. If the next guy doesn't want to use TypeScript, fine, have at the JS, it's nice code that it produces. |
|
There's a really interesting documentary about Edsger Dijkstra in which they looked back at his old notebooks. He wrote by hand, and when a correction was needed he'd tape a segment on top of it, and sometimes youd see stacks of these corrections. When all of the fragments were removed, the top version almost always was same as the original.
The point of the anecdote is that most professional developers I've met are incredibly disciplined and take time to understand the intricacies of what they are working with before starting. The types of mistakes that Typescript can catch stem either from carelessness (like mistyping) or memory loss (forgetting a function signature), but those can be obviated.
"I have found that type hints, code completion, intellisense, helps me discover mistakes sooner, often before I make them"
Code completion shields you from spelling mistakes. Intellisense saves you the need to remember the signature of various functions (most of which you should know anyway). Type hints help with nondescript names, but hopefully your variable names have the types implicitly embedded (e.g. 'count' or 'cnt' are almost always integer types)
I'm not saying most people don't suffer from these problems from time to time, but most professional developers I know are very careful and write good code the first time.
"Often, BTW, you are using a class (or JS function, whatever) that you didn't write"
Again, most APIs use sufficiently descriptive names that there should be little confusion. If there is ever a point where something is not clear from the outside, oftentimes there are issues on the inside that should be addressed (minimization notwithstanding).
I think Typescript misses the point. A high quality linter for javascript could pick up on most of the issues that TS picks up on. Furthermore, there are some quirks that break compatibility, which does to an extent suggest hijacking.