4 ms·
> 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
by myth_buster 8y ago
> 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.
- deleted 8y ago[deleted]
- azhenley 8y agoEven more interesting is that he previously came out with a Ruby edition: https://martinfowler.com/books/refactoringRubyEd.html https://martinfowler.com/books/refactoringRubyEd.html
- bdcravens 8y agoHow 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
- genieyclo 8y agoyeah the Ruby edition is full of errors so be careful.
- bdcravens 8y agoEarly on in my Ruby career, I picked it up, but really couldn't get much traction with it. Hartl's book was far better.
- genieyclo 8y agoHartl has a book on refactoring? We're going through http://refactoring.guru http://refactoring.guru at work right now, it's a nice modern version of Fowler's classic imo.
- chrisseaton 8y ago> I believe most of JS community has migrated to typescript You think the majority of JS developers have switched over to TypeScript?
- ChristianGeek 8y agoThat (quoted) is a bubble statement if I’ve ever seen one.
- myth_buster 8y ago_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/ https://2018.stateofjs.com/javascript-flavors/overview/
- BurningFrog 8y agoIn my (part of the) JS world Angular is dying and React has long since won.
- twblalock 8y agoI 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.
- Geee 8y agoAngular is not the most popular [0]. [0] https://2018.stateofjs.com/front-end-frameworks/conclusion/ https://2018.stateofjs.com/front-end-frameworks/conclusion/
- jammygit 8y agoIf 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.
- ummonk 8y agoWell, 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.
- jammygit 8y ago"Typescript is much more understandable than JS to someone unfamiliar with both." From that point of view, I see what you're saying.
- sveme 8y agoSaw him in a talk just last week - he actually mentioned that typescript would have been an alternative, but considered it less well known yet.
- nullandvoid 8y agoWhilst 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.
- regularfry 8y agoI'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.
- LolNoGenerics 8y ago> 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. Can you elaborate on this manipulative nonsense?
- dang 8y agoPlease keep programming language flamewars well away from HN.
- LolNoGenerics 8y agoNaive fainboyism as well