Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> When I choose a language for examples in my writing, I think primarily of the reader. I picked Java because I felt the most people would be able to understand the code examples if they were written in Java. That was the case in 1997, but how about in 2017? [...] Such a language needed to be widely popular, among the top half a dozen in language popularity surveys. It really helps to have a C-based syntax, since most programmers would recognize the basic code structure. Given that, two stood out. One was Java, still widely used and easy to understand. But I went for the alternative: __JavaScript__. [...] But the compelling reason for choosing it over Java is that isn't wholly centered on classes. There are top-level functions, and use of first-class functions is common. This makes it much easier to show refactoring out of the context of classes.

This is very interesting choice of language. I wonder whether typescript could have been a candidate as well. Although not as popular as JS, I believe most of JS community has migrated to typescript (due to obvious benefits) and it is more closer to a C-based language.



Whilst a fan of typescript myself I think the last statement is incorrect, I'd be surprised if >20%-30% of projects started in JS this year are typescript.


I'd be shocked if it was higher than 10%, and that's not even the bulk of JS work: the vast majority is brownfield, existing projects, where changing the toolchain is decidedly nontrivial. TS is nice, but it's a long way from ubiquity.


> I believe most of JS community has migrated to typescript

You think the majority of JS developers have switched over to TypeScript?


That (quoted) is a bubble statement if I’ve ever seen one.


_has_ may be incorrect but I do feel the switch is happening [0]. Angular which is the most popular client side JS framework is using Typescript. React is also moving in the same direction with typescript-react-starter and tsx support.

[0] https://2018.stateofjs.com/javascript-flavors/overview/


In my (part of the) JS world Angular is dying and React has long since won.


I agree, I don't know any front end devs who would choose Angular for a new project. The current choice seems to be between React and Vue.


Angular is not the most popular [0].

[0] https://2018.stateofjs.com/front-end-frameworks/conclusion/


If you know typescript, you're familiar enough with javascript to use the book, but if you don't know typescript then its a bit tricky for those readers. It just means fewer people have to dust off their language skills to benefit from the book.


Well, I'm very fluent in Typescript, and often find JS code extremely difficult to understand. The types are a great aid to understanding code. It also seems to be the case that a lot of JS code does not use ES6 polyfills, unlike Typescript code, so it tends to be less clean.

Edit: Upon rereading I see you are talking about the book, not actual projects, so my reply is not all that applicable. Though I'd actually say that Typescript is much more understandable than JS to someone unfamiliar with both.


"Typescript is much more understandable than JS to someone unfamiliar with both."

From that point of view, I see what you're saying.


Even more interesting is that he previously came out with a Ruby edition: https://martinfowler.com/books/refactoringRubyEd.html


How much of it did he write?

I suspect it was much like "Agile Web Development with Rails", which up until the most recent edition, listed DHH as an author


yeah the Ruby edition is full of errors so be careful.


Early on in my Ruby career, I picked it up, but really couldn't get much traction with it. Hartl's book was far better.


Hartl has a book on refactoring?

We're going through http://refactoring.guru at work right now, it's a nice modern version of Fowler's classic imo.


Saw him in a talk just last week - he actually mentioned that typescript would have been an alternative, but considered it less well known yet.


[flagged]


Please keep programming language flamewars well away from HN.


Naive fainboyism as well




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: