Preface

How is this book different from other books on Dart? Other books on Dart are full of practicalities; this book is focused on principles and ideas.

The practicalities of Dart are very important, but they are different this year than they were last year, and will likely differ again the year afterwards. In contrast, the principles behind Dart should be more applicable over time. You should read this book if you are interested in the ideas that motivate the design of the language, and how they manifest in the pragmatic, demanding real-world setting that is Dart.

One of the chief ideas in Dart is optional typing. I started working on optional types decades ago; today we see a proliferation of optional type systems, which I find immensely satisfying. While neither Dart nor any of its competitors realize optional types exactly as I would like them to, the fact that the idea has hit the mainstream is what matters.

Even more important is the idea that Dart is an object-oriented language, not in the conventional sense of classes, inheritance and the other standard paraphernalia known to most programmers, but in the deep sense that only the observable behavior of an object matters. Again, this idea is realized imperfectly, but better than in most mainstream languages.

Another key idea covered in this book is reflection. The topic of reflection is not well addressed by books on programming. For that reason, I was very keen to discuss reflection in this book. However, the history of reflection in Dart has been unexpectedly tortuous.

On the one hand, many of Dart’s users have been eager to use reflection, sometimes for purposes it is not ideal for. On the other hand, certain current platforms are severely limited as compilation targets for Dart, and make reflection support relatively expensive, especially with respect to program size. This tension put Dart reflection in an awkward spot.

The sensitivity to code size and reflection’s effect on it were well understood from the beginning. The problem and its solutions were discussed in the very first design document for Dart reflection in November 2011. Nevertheless it took some four years until the solution was realized in a form that programmers could easily apply.

I hope this book conveys these ideas and others effectively, but that is for you, the reader, to judge. It is possible that one could do better using a more purist language, but on the other hand it’s not clear one would reach as large an audience. Perhaps someday I will try that experiment and see.

This book has been a long time coming. I delayed finishing the book until I could tell a reasonably cohesive story about reflection. Another reason for the delay is that the book’s topic has evolved so rapidly that it was constantly at risk of being out of date. That risk has not passed, but at some point one needs to say “enough is enough.”

Dart is an imperfect realization of the ideas that drove its design. No one is more aware of this fact than its designers. Nevertheless, it is a real language, in which millions of lines of mission-critical code have been written. It has moved the culture of programming forward in some ways, most notably in the area of optional typing. As they say in Denmark: It could have been worse.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.178.237