Earlier quoted context omitted.
Yeah as best I can tell, Coffeescript was a thing because Ruby was very popular at the time, and some Ruby devs had to write JS but they wanted to write Ruby.
I think everyone except JS devs wishes they could write something other than JS for the browser. Maybe eventually with WebAssembly...
How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
321–330 of 400 posts
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#322Earlier quoted context omitted.
JS the language isn't great but it's JS the culture that is the real problem. There is a subset of JS codebases that are good, well engineered and written by people that understand the languages faults and limitations but the list is incredibly small and even smaller still now Joyent isn't really around anymore. If there was one ecosystem I wish I never needed to touch again it would be JS but unfortunately it's beco…
It's the same thing with PHP (and Ruby). You can write reasonable code in it, the problem is that the engineering culture leaves a lot to be desired. In Java, the engineering culture is strong but stagnant. Python is toxic, it's full of scientists, the engineering is bad (but a little better than PHP because the community is of a higher calibre).
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#323I think a large part of the support for Typescript comes from being able to create good tools for the language. But, I still have an aversion to front-end development itself, because it just feels too _involved_. You have to set up so much, and it has become a lot more difficult since you need to install webpack, postcss, and many other plugins just to do a hello world app. It's still bearable if you have to do all o…
I've spent the last two years writing my own framework because I hated React so damn much. It really doesn't have to be that complicated. Granted, I still use a bundler, but it's really easy to set up. I had my friend walk through it all... he seems to think it's great. I should probably release this project some day.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#324Earlier quoted context omitted.
This feels less like a case of Hungarian Notation being a bad idea and more like a case where developers are making irresponsible updates to their code. If a variable/function/class/whatever is being updated, the naming should be updated as well, if appropriate. Blaming the original author for the actions of the maintainer is not fair.
I'd still blame the individual developer for poor naming. Naming a variable something like int_list is terrible in that it's both very specific and semantically meaningless. Either choose a semantic name like grades or part_numbers, or take a hint from ML convention and use semantically void names like "xs".
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#325Earlier quoted context omitted.
You can easily write your own "type guard functions" when you think TS is missing an inference from a runtime check you would like. The syntax is simple enough, it's just a slightly different return type from boolean: function isThing(value: unknown): value is Thing { return typeof value === 'object' && typeof value.name === 'string' } The `unknown` type in general is still pretty new, but will be greatly helpful for…
User-defined typeguards are just fancy ‘as string’. They are not type safe.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#326Earlier quoted context omitted.
Senior probably means they've been doing JS for decades before TS was invented. They got along just fine without it for so many years, why rock the boat now? Or maybe it is more of a Senior person has a ton of work to do and not enough time to do it in so there isn't time left to learn a whole new way of writing JS. Or maybe many of the errors TS is meant to catch, the Senior developer has already learned over the de…
I've been programming JS for 13 years (professionally, and some more as a hobby) and I'm pretty aware of its warts. And as a firm believer of TDD, most of my code is pretty well tested. Unit tests have similar advantages to types: they catch errors early and let you refactor your code with confidence. But unit tests go even further, because they test the _correctness_ of the returned value, not just its type. And a m…
But testing with a weak type system isn't going to give you anywhere near the guarantees you'd get from a well-designed type system in addition to testing: https://kevinmahoney.co.uk/articles/tests-vs-types/
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#327Classic stockholm syndrome. It sucks but I have to use it to survive so now I love it.
>> Making impossible states impossible
Well if they're already impossible, there is no need to make them impossible.
>> exhaustive checks
There is no such thing in coding. You can never exhaustively check all possible issues.
>> Spotting bugs early
How about learning to write good tests?
>> Rich IDE support and ease of refactoring
Yes, TS makes it much easier to write and refactor spaghetti code with low cohesion and tight coupling. If you have clean code with good separation of concerns, it makes no difference to the refactoring experience at all if you're using TS or JS. Why TS developers always talk about refactorings? If you need to 'refactor' your code, it means you designed it wrong. Perhaps TypeScript encourages over-engineering which necessitates constant refactoring?
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#328I like the post, but the author's original perspectives are something I was always perplexed by. There was a period in late 2000s and early 2010s where dynamic languages were all the range (Ruby, Python, CoffeScript) and static typic was seen as archaic and slow by an entire segment of development community and I never understood it. >I always felt that adding types to the functions/variables and satisfying the TypeS…
It's common for web devs to spend a lot of time dealing with semi-documented lumps of JSON. If you don't have any guarantees about the data in the first place then static typing ends up being a lot of pain without much benefit.
Sure, the situation is far from ideal. But when you're in that situation static typing isn't solving your first problems.
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#329I have noticed a lot of people who grew up only using dynamic typing languages are discovering static typing for the first time and proclaiming it to be the "new way forward" or something. Kids...
Re: How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
#330I wonder if I'm missing a better way to do it.