Submission + - Book review: Mastering Dart by Sergey Akopkokhyants (packtpub.com)
I've never been fond of "advanced" books that try to teach me a language's basics all over again and then hastily cram some advanced features in almost as an afterthought. And I'm glad Sergey didn't fall into that same trap. This book is unapologetic in its focus on advanced topics like generics, reflection, futures, isolates, asynchronous programming and many others, while still managing to present them in an accessible and easy to understand manner. I'm not a Dart developer, so I judged this book on how well it was able to explain the many Dart-specific features I'm not familiar with. I've tried to keep my review as unbiased as possible.
I have no patience for a book that presents some code, but includes bits that are only explained in much later chapters in order to do it. This book manages to avoid that almost entirely, using examples that build incrementally and follow neatly into each other.
He starts off relatively simple in chapter 1, with a good explanation of modularity, functions and closures and mixins, but then ramps things up in chapter 2, focusing on more advanced techniques like generics and reflection. There's a rather nice explanation of the difference between Errors and Exceptions. I found the section on creating my own annotations relatively easy to understand (compared to some Java books I've read) and there was a nice progression into using them in reflection.
Chapter 3 has a ton of examples of different types of constructors and how to use them. He even creates his own enum class for one of the examples (at the time of writing Dart didn't support enums).
Chapter 4 covers asynchronous programming in the form of Futures, with examples that introduce concepts a bit at a time. The chapter finishes off with quite a detailed section on Zones and Isolates.
He devotes the whole of chapter 5 to the Stream framework and builds on his earlier explanation of Futures by using them here.
Chapter 6 focuses on collections, including two clear examples of the Comparable interface and Comparator type, and how to user the latter for classes that don't implement Comparable. Iterators are here of course, and there are brief subsections explaining all the kinds of built-in collections and a nice table to help you decide when to use what.
Only after laying all this groundwork for the language itself, does he start with JavaScript interoperability in chapter 7, including the ubiquitous jQuery.
Chapter 8 covers Internationalization and Localization, including a bit on gender, which I thought was quite interesting.
Again, having laid the foundation of working with JavaScript and HTML in earlier chapters, he uses chapter 9 to deal with client-server communication. There are two detailed sections on AJAX and WebSockets.
Chapter 10 deals with various types of storage, including local storage and Oracle's IndexedDB. He also takes time briefly to mention handling WebSQL, in case anyone is still supporting this deprecated technology.
Chapter 11 introduces some HTML features like the geolocation and notification APIs, as well as two long sections on native drag and drop and HTML 5's Canvas.
Rounding things off is the chapter on security. He has a short piece on generating certificates, and a section on Captcha and JSONP (JSON with Padding).
While the web-based chapters aren't exhaustive (this could be an entire book on its own), they are detailed enough to act as a springboard for investigating further.
I found the book useful for learning these advanced features, but also as a quick reference when looking up specifics later.
I'd recommend this book to anyone who has just finished learning Dart and wants to go deeper into the language.