Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Learning Dart - Second Edition
Learning Dart - Second Edition
Learning Dart - Second Edition
Ebook721 pages5 hours

Learning Dart - Second Edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

If you want to become a developer for the modern Web, or wish to add Dart to your tool belt, then this book is for you. The book assumes you have basic HTML experience and know how web applications work. Some previous programming experience, preferably in a modern language such as C#, Java, Python, Ruby, or JavaScript, will give you a head start. You can work with Dart on your preferred platform, be it Linux, Mac OS X, or Windows.
LanguageEnglish
Release dateSep 25, 2015
ISBN9781785288531
Learning Dart - Second Edition
Author

Ivo Balbaert

Ivo Balbaert is a programming teacher and Crystal enthusiast. He has a Ph.D. in Applied Physics and has worked for 25 years in the software industry as a developer and project manager in several companies. Now he combines teaching and consultancy with technical writing. He is particularly interested in elegant emerging languages for concurrency and distributed processing.

Read more from Ivo Balbaert

Related to Learning Dart - Second Edition

Related ebooks

Internet & Web For You

View More

Related articles

Reviews for Learning Dart - Second Edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Learning Dart - Second Edition - Ivo Balbaert

    Table of Contents

    Learning Dart Second Edition

    Credits

    About the Authors

    About the Reviewers

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    Why subscribe?

    Free access for Packt account holders

    Preface

    The spiral approach

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code

    Errata

    Piracy

    Questions

    1. Dart – A Modern Web Programming Language

    What is Dart?

    Dart is a perfect fit for HTML5

    A very short history of web programming

    Dart empowers the web client

    JavaScript is not the way to go

    Google, GWT, and Dart

    Advantages of Dart

    Getting started with Dart

    Installing the Dart Editor

    Other options for working with Dart code

    Your first Dart program

    Getting a view on the Dart tool chain

    The Dart execution model

    A bird's eye view on Dart

    Example 1 – raising rabbits

    Extracting a function

    A web version

    Example 2: banking

    Making a to-do list with Dart

    Summary

    2. Getting to Work with Dart

    Variables – to type or not to type

    Built-in types and their methods

    Conversions

    Operators

    Some useful String methods

    Dates and times

    List

    Maps

    Documenting your programs

    Changing the execution flow of a program

    Using functions in Dart

    Return types

    Parameters

    First class functions

    Using enums

    Recognizing and catching errors and exceptions

    A debugging exercise

    Summary

    3. Structuring Code with Classes and Libraries

    A touch of class – how to use classes and objects

    Visibility – getters and setters

    Types of constructors

    Named constructors

    Factory constructors

    The const constructors

    Inheritance

    Abstract classes and methods

    The interface of a class – implementing interfaces

    Polymorphism and the dynamic nature of Dart

    Collection types and generics

    Typing collections and generics

    The collection hierarchy and its functional nature

    Structuring your code using libraries

    Using a library in an app

    Resolving name conflicts

    Visibility of objects outside a library

    Managing library dependencies with pub

    Unit testing in Dart

    Asynchronous programming with async and await

    Project – word frequency

    The Observatory tool

    Summary

    4. Modeling Web Applications with Model Concepts and Dartlero

    A short introduction to Git and GitHub

    Creating a repository on GitHub and a local version

    Collaborating on a GitHub project

    What is a model and why we need it in programming

    Model Concepts – a graphical design tool for our models

    Working with model concepts

    Explaining the model

    Drawing the model

    Exporting the model

    What is JSON?

    Dartlero – a simple domain model framework

    An example of using Dartlero

    The categories and links application

    Summary

    5. Handling DOM in a New Way

    Finding elements and changing their attributes

    Finding elements

    Changing the attributes of elements

    Creating and removing elements

    Handling events

    Manipulating the style of page elements

    Animating a game

    Ping Pong using style(s)

    How to draw on a canvas – Ping Pong revisited

    Spiral 1 – drawing a circle and a rectangle

    Spiral 2 – colored circles and rectangles

    Spiral 3 – moving a ball

    Spiral 4 – reorganizing the code

    Spiral 5 – a bouncing ball

    Spiral 6 – displaying the racket

    Spiral 7 – moving the racket using keys

    Spiral 8 – moving the racket using the mouse

    Spiral 9 – a real game

    Spiral 10 – title and replay

    Spiral 11 and the master version

    Summary

    6. Combining HTML5 Forms with Dart

    Spiral 1 – the power of HTML5 forms

    Spiral 2 – how to validate data with Dart

    Validation in the model

    Spiral 3 – how to store data in a local storage

    Spiral 4 – reading and showing data

    Spiral 5 – changing and updating data

    Spiral 6 – working with a list of bank accounts

    Summary

    7. Building Games with HTML5 and Dart

    The model for the memory game

    Spiral 1 – drawing the board

    Spiral 2 – drawing cells

    Spiral 3 – coloring the cells

    Spiral 4 – implementing the rules

    Spiral 5 – game logic (bringing in the time element)

    Spiral 6 – some finishing touches

    Spiral 7 – using images

    Adding audio to a web page

    The Collision Clones game

    Adding video to a web page

    Summary

    8. Developing Business Applications with Polymer Web Components

    How web components change web development

    Web components with Polymer.dart

    Declaring and instantiating a web component

    Two-way data binding in Polymer.dart

    Creating the web_links project

    Spiral s01

    Spiral s02

    Spiral s04

    Spiral s05

    Spiral s06

    Using Polymer for the category links project

    Adding local storage

    Applying web components to the project tasks app

    The Add and Remove task propagations

    Summary

    9. Modeling More Complex Applications with dartling

    The dartling domain modeling framework

    Design of the Travel Impressions model in spirals

    Generating the Travel Impressions code from the model

    Initializing the Travel Impressions model with data

    Testing the Travel Impressions model

    Defining and using the MVC pattern

    The TodoMVC app

    Spiral 0 – generating a class model

    Spiral 1 – adding todo tasks

    Spiral 2 – showing how many todo tasks are left

    Spiral 3 – removing a single task and completed tasks

    Spiral 4 – saving in the local storage

    Spiral 5 – displaying completed todos

    Spiral 6 – editing a task and testing the model

    Summary

    10. Local Data and Client-Server Communication

    The options for browser storage

    Asynchronous calls and Future objects

    Using IndexedDB with Dart

    Spiral s00

    Spiral s01

    Spiral s02

    Spiral s03

    Spiral s04

    Spiral s05

    Using Lawndart

    A Dart web server

    Using JSON web services

    Spiral s07

    Summary

    11. Data-Driven Web Applications with MySQL and MongoDB

    Database drivers for Dart

    Storing todo data in MySQL

    Dartlero tasks – a many-to-many model in MySQL

    The JSON storage

    MySQL storage

    MongoDB – a NoSQL database

    Using the mongo_dart driver to store the todo data in MongoDB

    Running a Dart server on an App Engine Managed VM

    Summary

    Index

    Learning Dart Second Edition


    Learning Dart Second Edition

    Copyright © 2015 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: January 2014

    Second edition: September 2015

    Production reference: 1220915

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham B3 2PB, UK.

    ISBN 978-1-78528-762-6

    www.packtpub.com

    Credits

    Authors

    Ivo Balbaert

    Dzenan Ridjanovic

    Reviewers

    Rokesh Jankie

    Hans Van den Keybus

    Marko Vuksanovic

    Commissioning Editor

    Nadeem N. Bagban

    Acquisition Editor

    Sonali Vernekar

    Content Development Editor

    Divij Kotian

    Technical Editor

    Chinmay S. Puranik

    Copy Editor

    Akshata Lobo

    Project Coordinator

    Nikhil Nair

    Proofreader

    Safis Editing

    Indexer

    Mariammal Chettiyar

    Graphics

    Jason Monteiro

    Production Coordinator

    Arvindkumar Gupta

    Cover Work

    Arvindkumar Gupta

    About the Authors

    Ivo Balbaert is currently a web programming and databases lecturer at CVO Antwerpen (www.cvoantwerpen.be), a community college in Belgium. He received a PhD in applied physics in 1986 from the University of Antwerp. He worked for 20 years in the software industry as a developer and consultant in several companies, and, for 10 years, as a project manager at the University Hospital of Antwerp. In 2000, he switched over to partly teach and partly develop software (KHM Mechelen, CVO Antwerp).

    He also wrote Programmeren met Ruby en Rails, an introductory book in Dutch about developing in Ruby and Rails, by Van Duuren Media.

    In 2012, he authored The Way To Go, a book on the Go programming language by IUniverse.

    In 2014, he wrote Learning Dart (in collaboration with Dzenan Ridzanovic) and Dart Cookbook, both by Packt Publishing.

    Finally, in 2015, he wrote Getting started with Julia and Rust Essentials, both by Packt Publishing.

    I would like to thank Dzenan Ridzanovic for his efforts in updating the book's projects.

    Dzenan Ridjanovic is a university professor who is planning his early retirement to focus on the development of web applications with Dart, HTML5, web components, and NoSQL databases. For more than 10 years, he was a director of research and development in the Silverrun team (http://www.silverrun.com/), which created several commercial tools to analyze, design, and develop data-driven applications. He was the principal developer of Modelibra (http://www.modelibra.org/) tools and frameworks for model-driven development in Java. Currently, he is developing the dartling framework for the design and code generation of Dart models. His projects are on GitHub (https://github.com/dzenanr), where he is considered a Dart expert (http://osrc.dfm.io/dzenanr). He writes about his projects on the On Dart blog (http://dzenanr.github.io/). His courses are available on On Dart Education (http://ondart.me/). He markets his Dart efforts on the On Dart G+ page (https://plus.google.com/+OndartMe). Dzenan Ridjanovic wrote a book in 2009, under the Creative Commons License, entitled Spiral Development of Dynamic Web Applications: Using Modelibra and Wicket (http://www.modelibra.org/).

    About the Reviewers

    Rokesh Jankie graduated in 1998 with a master's degree in computer science at Leiden University, The Netherlands. He specialized in algorithms and NP-complete problems. Scheduling problems that can be NP-complete was his area of focus. He started working for the University of Leiden, ORTEC consultants, and Ponte Vecchio, and later worked for Qualogy. At Qualogy, he used what he had experienced till that point to set up a product. Qualogy works in the field of Oracle and Java technology. With the current set of technologies, interesting products can be delivered and that is QAFE (see www.qafe.com for more information).

    QAFE Inc. has a very dynamic team, which works in an agile way (going to production weekly, quickly adjusting to market needs, and so on). There is no distinction between senior developers and junior developers and very good software engineers are recruited. This gives a new dynamic to the team and makes it a great experience on a daily basis.

    He has also reviewed Dart in Action by Manning, HTML5 and CSS3 Responsive Web Design Cookbook, and HTML5 Canvas Cookbook by Packt Publishing.

    I'm very grateful to my parents and wife for supporting my enthusiasm for computer science. My two-year-old son inspires me to be the best dad and he makes sure that I work hard to create a better future for him through the applications of computer science in daily life and the sharing of knowledge on this subject. Reviewing this book is a part of that journey.

    Hans Van den Keybus started off hacking MySpace layouts when he was still in high school.

    Having a degree in arts, his initial projects were in games and animation development for several major designing companies. Soon he developed an interest in structuring the code behind these projects.

    He built an expertise in OOP, design patterns, and microarchitectures. Currently, he's working on an enterprise portal—developed in Google Dart—for his customers MSC and Maersk, while he's also running his own company, 'dotdotcommadot.'

    Whenever Hans is not programming, he's probably doing a gig in some underground venue with his equally underground grindcore band, or cruising on his motorcycle.

    He also reviewed Dart Essentials, Packt Publishing authored by Martin Sikora.

    Marko Vuksanovic is a consultant specializing in software development and delivery. He received his master's degree in electrical engineering and computing from the University of Zagreb, Croatia, in 2009. At the moment, Marko is employed by ThoughtWorks Australia, where he helps deliver outstanding products to the clients. He spent the last 10 years working with web applications, and, during this period, he was involved in numerous open source as well as closed source projects. He is very active within the Dart community; he used to contribute to the Angular.dart project. His other interests lie in protocols, information security and machine learning space.

    When not providing services to his clients, Marko spends time acquiring new skills, breaking things, reverse engineering, writing articles, or enjoying some time off at one of Australia's beaches or a nearby tennis court.

    www.PacktPub.com

    Support files, eBooks, discount offers, and more

    For support files and downloads related to your book, please visit www.PacktPub.com.

    Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.

    At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

    https://www2.packtpub.com/books/subscription/packtlib

    Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

    Why subscribe?

    Fully searchable across every book published by Packt

    Copy and paste, print, and bookmark content

    On demand and accessible via a web browser

    Free access for Packt account holders

    If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

    Preface

    Developing a web application (or software in general) is still a challenging task. There is a client- or browser-side and a server-side with databases. There are many different technologies to master in order to feel comfortable with a full client-server stack. There are different frameworks with different objectives. There are different programming languages as well that a developer must learn, each one more suitable either for the server-side or for the client-side.

    Learning Dart will make a developer become more productive by using Dart both for clients and servers. Using the same language, a developer will lose neither performance nor flexibility. Dart can be used within its virtual machine or its code may be compiled to JavaScript. In both the cases, the performance benchmarks show promising scores (https://www.dartlang.org/performance/). Dart is both an object-oriented and a functional language. A mix of both the approaches is possible with Dart, providing great professional freedom and programming background flexibility. In addition, Dart provides many libraries and tools (http://pub.dartlang.org/) to allow a developer focus on the tasks at hand and not be concerned with all the aspects of software development.

    With Polymer.dart (https://www.dartlang.org/polymer-dart/), a new approach of developing web applications with web components will allow a developer to divide a web page in sections and reuse an already developed and tested web component for each section. In the near future, different catalogs of web components will appear, enabling, after waiting for many years, an engineering approach to software development. A web component may be derived from other web components. It may pass data to its components. A web component may inherit its behavior from another web component. It may access an already instantiated web component.

    The spiral approach

    The spiral approach to software learning and development, which preserves a project history as a series of code snapshots or spirals, is used in this book.

    The following three points are important in the spiral approach:

    The history of development is preserved.

    Simple solutions are provided first. Later on, these solutions may be replaced by more advanced solutions.

    Only the concepts used in a spiral are explained.

    All three points are important to teach and learn these technologies.

    Learning new software concepts and technologies is a challenging task. Learning in spirals, from simple to more advanced concepts but with concrete software applications, helps readers get a reasonable confidence level early on, and motivates them to learn by providing more useful applications. With each new spiral, the project grows and new concepts are introduced. A new spiral is explained with respect to the previous one. The difference between the two consecutive spirals is that the next spiral introduces the new code and modifies or deletes the old. This is called learning by anchoring to what we already understand. With a new spiral, we can go back to what we did previously and improve it. In this way, learning in spirals can touch the same topic several times, but each time, with more details in a better version.

    What this book covers

    Learning Dart, Second Edition, has 11 chapters. It begins with the basic elements of Dart and ends with a client/server application that uses MongoDB (http://www.mongodb.org/) for data persistence on the server-side.

    Chapter 1, Dart – A Modern Web Programming Language, will help you understand what Dart is all about. Dart is presented as a major step forward in the web programming arena.

    Chapter 2, Getting to Work with Dart, will help you get a firm grasp on how to program in Dart. The code and data structures in Dart and its functional principles are explained by exploring practical examples.

    Chapter 3, Structuring Code with Classes and Libraries, will make you understand how to use Dart classes to organize code. Dart libraries will be introduced to show how complex software may be packaged.

    Chapter 4, Modeling Web Applications with Model Concepts and Dartlero, will let you design graphically a small model in the Model Concepts tool, which is developed in Dart. A model is then represented in Dart as several classes that inherit some data and operations from the classes of the Dartlero model framework; this is also done in Dart.

    Chapter 5, Handling DOM in a New Way, covers how to access HTML elements in Dart. Some elements will be even created in Dart and placed properly in the Document Object Model (DOM) of a web page. Dart will also handle user events, such as a click on a button. Finally, you will be able to create a simple game in Dart.

    Chapter 6, Combining HTML5 Forms with Dart, will let you enter some data in a form. The data will be validated by HTML5 and Dart. Then, the valid data will be saved in the local storage of a browser.

    Chapter 7, Building Games with HTML5 and Dart, will let you create a well-known memory game step by step, based on what you have learned already. Each step will be a new spiral represented as a complete project in Dart Editor. The first spiral will draw only a rectangle, while the last spiral will be a game that you may show to your friends.

    Chapter 8, Developing Business Applications with Polymer Web Components, will help you create several web components using Polymer.dart. These web components will be used in the different sections of a single-page application. Three different projects with web components will be presented in this chapter.

    Chapter 9, Modeling More Complex Applications with dartling, will let you discover how a graphical model can be transformed into a JSON document and then used to generate a complete model in Dart by using the dartling domain model framework together with its tools. The dartling follows the Model View Controller (MVC) pattern to separate a model from its views.

    Chapter 10, Local Data and Client-Server Communication, will let you store application data in a local database called IndexedDB. The data will then be sent as a JSON document to a Dart server. Asynchronous programming with futures will be covered in this chapter.

    Chapter 11, Data-Driven Web Applications with MySQL and MongoDB, will help you learn how to use database drivers to save (and load) data to (and from) a relational database and a NoSQL database. Data sent from a browser as a JSON document will be easily saved in MongoDB in the same JSON form. Two clients will exchange data with the server so that both of them will be up-to-date.

    For this second edition, all the code and projects were updated to Dart version 1.11. Moreover, sections on the following topics were added:

    enums

    Async and await

    The Observatory tool

    Running a Dart server on an App Engine Managed VM

    What you need for this book

    In order to profit from this book, you need to have some basic experience in programming. It is also useful to have some understanding of HTML and CSS. What you really need to bring is your enthusiasm to learn how to become a web developer of the future. All the software used in the book is freely available on the Web:

    https://www.dartlang.org/

    https://github.com/Ivo-Balbaert/learning_dart

    https://github.com/dzenanr

    http://www.mysql.com/

    http://www.mongodb.org/

    One of the authors has already taught three times an introductory course to programming with some material from this book. Other educational resources for Dart can be found at http://ondart.me/.

    Who this book is for

    The book is intended for (web) application programmers, game developers, and other software engineers. Because of its dual focus (Dart and HTML5), the book can appeal to web developers who want to learn a modern way of developing web applications and to developers who seek how to use HTML5. The audience includes mainstream programmers with an object-oriented background (Java, .NET, C++) as well as web programmers who use JavaScript to seek a more structured and tooled way of developing. Both groups will leverage their existing knowledge and expertise: the book will offer the first way of developing modern web applications using techniques they already know; it will give the second a more productive and engineered way of developing (business) web applications. The following article describes well what Dart has to offer for web developers of the future:

    http://news.cnet.com/8301-1023_3-57613760-93/mixbook-sees-perfect-storm-for-googles-dart-language-q-a/

    Conventions

    In this book, you will find a number of styles of text that distinguishe between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

    Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: The last clause in the try statement should be on Exception catch(e) or, even better, a simple catch(e) to stop any type of error or exception.

    A block of code is set as follows:

    import 'dart:math';                                      (1)

     

    void main() {

      var n = 0; // number of rabbits                        (2)

     

      print(The number of rabbits increases as:\n);        (3)

      for (int years = 0; years <= 10; years++) {            (4)

        n = (2 * pow(E, log(15) * years)).round().toInt();  (5)

        print(After $years years:\t $n animals);          (6)

      }

    }

    When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

    try

    {

      int inp = int.parse(input);

    }

    on FormatException

    {

      print ('ERROR: You must input an integer!');

    }

    Any command-line input or output is written as follows:

    Observatory listening on http://127.0.0.1:49621

    New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: Navigate to Tools | Preferences | Run and Debug, and change Break on Exceptions to None.

    Note

    Warnings or important notes appear in a box like this.

    Tip

    Tips and tricks appear like this.

    Reader feedback

    Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

    To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title via the subject of your message.If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

    Customer support

    Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

    Downloading the example code

    You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

    Errata

    Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

    Piracy

    Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

    Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

    We appreciate your help in protecting our authors, and our ability to bring you valuable content.

    Questions

    You can contact us at <questions@packtpub.com> if you are having a problem with any aspect of the book, and we will do our best to address it.

    Chapter 1. Dart – A Modern Web Programming Language

    In this chapter, we will investigate:

    What Dart is all about

    Why it is a major step forward in the web programming language arena

    Getting started with Dart programming

    We will get started with the Dart platform and have a look at its tools. Before this, we will be programming and taking a dive into a simple functional to-do list program so that you realize how familiar it all is.

    What is Dart?

    Dart is a new general and open source programming language with a vibrant community developed by Google Inc. and its official website is http://www.dartlang.org. It was first announced as a public preview on October 10, 2011; it has now reached version 1.10. World class language designers and developers are involved in this project, namely, Lars Bak and Kasper Lund (known for their V8 JavaScript engine embedded in the Chrome browser, which revolutionized performance in the JavaScript world), and Gilad Bracha (a language theorist known for the development of the Strongtalk and Newspeak languages and for the Java specification). Judging by the huge amount of resources and the number of teams working on it, it is clear that Google is very serious about making Dart a success.

    Tip

    Take your time to familiarize yourself with the https://www.dartlang.org/ site. It contains a wealth of information, code examples, presentations, and so on to supplement this book, and we will often reference it.

    Dart looks instantly familiar to the majority of today's programmers coming from a Java, C#, or JavaScript (JS) (ActionScript) background; you will feel at ease with Dart. However, this does not mean that it is only a copy of what already exists; it takes the best features of the statically typed Java-C# world and combines these with features more commonly found in dynamic languages such as JS, Python, and Ruby. On the nimble, dynamic side Dart allows rapid prototyping, evolving into a more structured development familiar to business app developers when application requirements become more complex.

    Its main emphasis lies on building complex (if necessary), high performance, and scalable-rich client apps for the modern web. By modern web, we mean that it can execute in any browser on any kind of (client) device, including tablets and smartphones, taking advantage of all the features of HTML5, and it is ported to the ARM-architecture and the Android platform. Dart is designed with performance in mind by the people who developed V8. Because the Dart team at Google believes web components will be the foundation for the next evolution of web development, there is strong Dart support for the Polymer framework (web components are pieces of the web code containing HTML and Dart or JavaScript that you can reuse in different pages and projects. In other words, it is a reliable infrastructure of widgets). However, Dart can also run independently on servers. Because Dart clients and servers can communicate through web sockets (a persistent connection that allows both parties to start sending data at any time), it is, in fact, an end-to-end solution. It is perfect on the frontend to develop web components with all the necessary application logic, nicely integrated with HTML5 and the browser document model (DOM). On the backend server side, it can be used to develop web services, for example, to access databases, or cloud solutions in Google App

    Enjoying the preview?
    Page 1 of 1