Modern JavaScript for the Impatient |
Written by Mike James | |||
Author: Cay S. Horstmann First off I'm not at all sure that impatient makes the best programmer, but let's not get into that at the moment. What I do identify with is the need to get the core information on a topic without all the fluff and dragging out just to fill the space. It is the main reason I hate tutorial videos - long lead ins, usually rambling starts, a quick and tiny burst of info and then the end credits. Information density too low! So a book aimed at the impatient programmer might be what I'm looking for. Note that this is not a book for the complete beginner and doesn't claim to teach you programming. It is more a transition guide for programmers used to other languages. So how do you download information quickly? There are a few possible ways - you can discuss the higher-level ideas that make the language different or you can focus down onto the important detail. In the main this book focuses on the important detail first and looks at the bigger picture later. It is clear that the author is on the side of JavaScript and understands that it is different from other languages. It is a bit of a shame that the book doesn't start out explaining the big differences - it starts with declaring variables and other pitfalls that the beginner will suffer. Only later does it get into the "good stuff". The point is that this isn't a book written by a Java expert who wants to present JavaScript as a sort of "broken" version of Java, although this said Cay S Horstmann is a Java expert! Sections are labeled with icons that indicate the type of content:
I didn't find this helpful but many readers will - especially those into Alice in Wonderland. Be warned, however, they do tend to peter out. The book starts off with a look at data types and variable declarations - a generally boring but difficult-to avoid-starting place. By the end of the chapter we have more interesting topics, such as destructuring, but is the place to tackle something this sophisticated? From here we move on to flow of control, again a predictable second topic, but there are some surprises if you don't know JavaScript - "Boolishness", to use Horstmann's preferred jargon or "truthy and falsey" which is perhaps more familiar. However, in the main this is where JavaScript looks like just about any C-influenced language. It is only really in Chapter 3 does the JavaScript difference start to show. Higher order functions, closure, varadic arguments, and so on. In my opinion this doesn't go far enough. The key idea is that JavaScript functions are objects and this is mostly overlooked. Chapter 4 deals with objects and here we have a fairly standard account of JavaScript as a prototypical language. In fact this isn't really important. JavaScript is really an object factory-based language and the prototype mechanism is just about saving storage space by sharing code. From here the book continues to follow a fairly well-trodden path - Strings and regular expressions, Arrays and collections, asynchronous programming, modules, metaprogramming and iterators. The final chapter reveals that the book isn't so much in tune with the JavaScript ethos as it first seems - it's on TypeScript. It is natural enough for any programmer taught that strong typing is good to want to replace JavaScript with at least an optionally-, or gradually-typed superset of the language, i.e. TypeScript. I would argue, however, that JavaScript, which is what the book is about, is an untyped language and to deliver solutions to problems that don't really exist if you are a true JavaScript believer goes beyond the remit of the book. I don't mind TypeScript, but finishing the book on it throws the previous chapters out of the window. It says don't learn JavaScript. learn this instead. This is a shame. Even though I enjoyed reading this book, I have lots of reservations about it, but this is because I think JavaScript is a language, that if treated right, doesn't need any fixing. Modern JavaScript is a remarkable language and a refreshing change from the run-of-the-mill, C-derived, strongly-typed languages that are so common. If you are not of this opinion buy a book on TypeScript. This is a good book and many will get a lot from it - but it doesn't do JavaScript the justice it deserves.
To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.
|
|||
Last Updated ( Tuesday, 26 January 2021 ) |