small medium large xlarge

Now in Print: Dart 1 for Everyone

November 12, 2014

Dart isn't just for hipsters anymore. With version 1.0 in 2013 and an ECMA standard in 2014, Dart is ready to radically change web development for the better. And Dart 1 for Everyone has got you covered, now in print and shipping from pragprog.com/book/csdart1.

In other news, did you hear that Brian Hogan's Automate with Grunt: The Build Tool for JavaScript (pragprog.com/book/bhgrunt) was a finalist for this year's Jolt award? Jolt judge and editor-in-chief Andrew Binstock posted, "In discussing this book, one of the Jolt Award judges lamented that there were not more inexpensive, single-topic, hands-on manuals that give you all you need to know in a direct and approachable style. This observation is spot on in this era of carelessly written manuals and defective documentation. However, Automate with Grunt is one of the few manuals that amply fulfills this simple mission. If you write apps primarily with JavaScript, this is the book to get and keep within reach."

And before we go any further, here's 5 things you probably didn't know about Dart, brought to you by Chris Strom:

5 Things You Don’t Know About Dart

5) It has brilliant server and browser package management. The “Pub” package manager works the same whether you are writing server code or a web application. List your dependencies in a pubspec.yaml file, run “pub get”, and your dependencies (and their dependencies) are immediately available. Whether it is compiled to JavaScript or run natively in the browser, Dart’s libraries and packages make organizing code a breeze.

4) It’s not really statically typed. You can declare variables with or without types—it makes no difference whatsoever at runtime. If you like declaring variables with var, go right ahead. If you like documenting code with types, feel free (it’ll help with docs and code analysis tools).

3) It has beautiful unit (and acceptance) testing built into the language from the outset. To build bulletproof applications, you need a strong testing suite. And Dart has you covered. Brilliantly.

2) Dart does not compile directly to JavaScript. To support all modern browsers (even IE10+), dart2js compiles to a JavaScript compatibility layer. That JavaScript compatibility layer is quite large, so dart2js performs sophisticated tree shaking so that it can drop unused bits, keeping the compiled code and compatibility layer as small as possible. The Dart team works hard to ensure that this compatibility layer works across the modern web so you don’t have to. No more browser checking. No more weird browser-specific bugs. Your code just works. Everywhere.

1) It rivals Ruby for code beauty. In addition to its simple, classical inheritance, Dart is loaded with syntactic sugar to make a programmer’s life easier. To name just a few, Dart has:

  • Method cascades (calling multiple methods on the same object).
  • First-class support for optional parameters (no more parsing an options hash, yay!)
  • Getter and setter methods (methods that look like properties, but are backed by a normal method).
  • Assignment of instance variables in the constructor declaration instead of the body.
  • String interpolation—no more chains of plus signs!

It’s the little things really. And Dart has so many little things that add up to greatness.

0) (BONUS!) It is fast. In many cases, the compiled JavaScript is faster than the JavaScript that you can hand-code. Don’t believe me? Check out the benchmarks and try it yourself!

Dart 1 for Everyone: Fast, Flexible, Structured Code for the Modern Web

Dart has changed significantly since the first printing of this book and Dart 1 for Everyone has kept up. Every chapter has been revised and some chapters have been almost completely rewritten since the first printing. The MVC project chapters dumped the old JavaScript-like event handlers for the sleek new streams interface, and the chapter on testing reflects the extensive changes in testing now available in Dart.

Brand-new sections explore some of Dart's beautiful new features, such as:

  • Method cascades: Improve code readability dramatically.
  • Event streams: Simplified event handling, consistent with virtually every other asynchronous interaction in Dart.
  • Library parts: Yet another way Dart promotes code organization.
  • New class constructor syntax: Dart supports a nice variety of surprisingly expressive and concise ways to declare constructors.
  • Building your own packages: Quickly share your work with the world.

You'll start writing Dart code on page 1, and throughout the book, you'll refactor that code to explore Dart’s features: OOP, real libraries and packages, testing, and more. You'll learn how to write beautiful, maintainable application code that just works™ in all modern browsers. Caution: after reading you may develop an intense attachment to structured code and skinny jeans.

Now in print and shipping from pragprog.com/book/csdart1.

Upcoming Author Appearances

  • 2014-11-12 Rachel Davies, Agile Singapore
  • 2014-11-12 James Grenning, Singapore
  • 2014-11-13 Chris Adamson, CocoaConf Boston
  • 2014-11-15 Chris Adamson, CocoaConf Boston
  • 2014-11-17 Dave Thomas, Skillsmatter, London
  • 2014-11-19 Paul Butcher, Topconf Tallinn, Estonia
  • Who Are We?

    The Pragmatic Bookshelf publishing imprint is wholly owned by The Pragmatic Programmers, LLC.

    Andy Hunt and Dave Thomas founded the company with a simple goal: to improve the lives of developers. We create timely, practical books, audio books and videos on classic and cutting-edge topics to help you learn and practice your craft.

    We are not a giant, faceless, greed-soaked corporation. We're a small group of experienced professionals committed to helping make software development easier.

    Don't Get Left Out

    Are your friends jealous that you get these spiffy email newsletters and they don't? Clue them in that all they need to do is create an account on pragprog.com (email address and password is all it takes) and select the checkbox to receive newsletters.

    Are you following us on Twitter and/or Facebook? Here's where you can find us and keep up with the latest news and commentary, and occasional discounts:

    Tell your friends! Tweet this

    Follow us on Twitter: @pragprog, @pragpub, Andy @PragmaticAndy and Dave @pragdave.

    Coming Soon:

    • Pragmatic Unit Testing in Java 8
    • Your Code As a Crime Scene
    • Hello, Android, Fourth Edition

    Recently Released:

    Thanks for your continued support,

    Andy & Dave The Pragmatic Programmers

    Books • eBooks • PragPub Magazine • Audiobooks and Screencasts
    PragProg.com