You are previewing Dart for Absolute Beginners.
O'Reilly logo
Dart for Absolute Beginners

Book Description

"

Dart for Absolute Beginners enables individuals with no background in programming to create their own web apps while learning the fundamentals of software development in a cutting edge language. Easily digested chapters, while comprehensive enough to explore the whole domain, are aimed at both hobbyists and professionals alike. The reader will not only gain an insight into Dart, but also the technologies behind the web. A firm foundation is laid for further programming studies.Dart is a new, innovative language developed by Google which is poised to take the web by storm. For client side web app development, Dart has many advantages over JavaScript. These include but are not limited to: improved speed, enforcement of programmatic structure, and improved facilities for software reuse. Best of all, Dart is automatically converted to JavaScript so that it works with all web browsers. Dart is a fresh start, without the baggage of the last two decades of the web. Why start learning to program with yesterday's technology?

  • Teaches you the fundamentals of programming and the technologies behind the web.
  • Utilizes the cutting edge, easy to learn, structured Dart programming language so that your first steps are pointed towards the future of web development.
  • No prior knowledge is required to begin developing your own web apps.

"

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Author
  8. About the Technical Reviewers
  9. Acknowledgments
  10. Foreword
  11. Introduction
  12. Chapter 1: Getting Set Up
    1. Getting the Tools
    2. Using Dart Editor
    3. Choosing a Suitable Work Environment
    4. How to Read This Book
    5. Utilizing the Web As You Learn
      1. Search Engines
      2. Stack Overflow
      3. Official Dart Sources
      4. Social Media
      5. Dart for Absolute Beginners Web Site
    6. Summary
  13. Chapter 2: Your First Dart Programs
    1. Hello, World!
    2. A Fancier Example
      1. Your First HTML Document
      2. Hello World Fancy in Dart
    3. Input and Output
    4. The Learning Curve
    5. Summary
  14. Chapter 3: Some Programming Fundamentals
    1. Code As Instructions
      1. Variables
      2. Operators
      3. Strings
      4. Control Structures
      5. Loops
    2. Summary
  15. Chapter 4: Five Small Programs to Showcase Fundamentals in Dart
    1. Number Guessing Game
    2. Temperature Converter
    3. The Monty Hall Problem
    4. Pi Calculator
    5. Math Test
    6. Summary
  16. Chapter 5: Functions
    1. What Is a Function?
    2. Function Parameters
      1. The Locality of Variables
      2. Multiple Parameters
    3. Function Return Values
    4. Single-Line Functions
    5. Rock-Paper-Scissors
    6. Optional Parameters
      1. Positional Optional Parameters
      2. Named Optional Parameters
    7. Functions as First-Class Citizens
    8. Functions Within Functions
    9. Recursive Functions
      1. Fibonacci Sequence
      2. Factorial
    10. Summary
  17. Chapter 6: Data Structures
    1. Lists
      1. List Syntax
      2. Birthday Paradox
      3. Simple Blackjack
    2. Maps
      1. Map Syntax
      2. Caesar Cipher
      3. Baseball Statistics Exercise
    3. Sets
      1. Revised containsDuplicates( )
      2. Great Set Use Cases
    4. Summary
  18. Chapter 7: How Does the Web Work?
    1. Retrieving a Web Site
    2. The Web’s Place on the Internet
    3. Defining a Web Site’s Look
    4. Non-HTML on the Web
    5. Web Browsers
    6. Domains, IP Addresses, and IP Routing
    7. A Little More HTTP
    8. A Full Web Transaction
    9. Summary
  19. Chapter 8: Using Dart to Interact with HTML
    1. The DOM
    2. Tagging the Tags
    3. Responding to Events from the DOM
      1. BMI Calculator
    4. Images
      1. Memory Game
    5. Drawing with an HTML Canvas
      1. HTML Canvas Basics
      2. Flying Pigs
    6. Summary
  20. Chapter 9: Hangman
    1. Word Scramble
      1. The HTML
      2. The Dart
    2. Hangman
      1. The Game Resources
      2. The HTML and CSS
      3. The Dart
    3. Halftime Review
      1. Chapter 1: “Getting Set Up”
      2. Chapter 2: “Your First Dart Programs”
      3. Chapter 3: “Some Programming Fundamentals”
      4. Chapter 4: “Five Small Programs to Showcase Fundamentals in Dart”
      5. Chapter 5: “Functions”
      6. Chapter 6: “Data Structures”
      7. Chapter 7: “How Does the Web Work?”
      8. Chapter 8: “Using Dart to Interact with HTML”
    4. Looking Forward
    5. Summary
  21. Chapter 10: Object-Oriented Programming Fundamentals
    1. What Is an Object?
      1. Object Basics
      2. References to Objects and Instances
    2. Defining Classes
      1. Instance Variables
      2. Getters and Setters
      3. Methods
      4. Constructors
      5. Pig
      6. Class Variables and Class Methods
    3. The Game of Life
    4. Summary
  22. Chapter 11: Object-Oriented Design
    1. Inheritance
    2. Abstract Classes
      1. Geometry Test
    3. Super
    4. Interfaces
      1. Interfaces Exposed
      2. Casting
    5. Mixins
    6. The Cascade Operator
    7. Alien Invaders
    8. Summary
  23. Chapter 12: Advanced Dart Concepts
    1. Operator Overloading
      1. The Point Class
      2. Overloading Operators in Your Own Classes
      3. Getting Back to the Point
    2. Generics
    3. Exceptions
      1. Working with Dart’s Built-in Exceptions
      2. Defining Your Own Exceptions
    4. Factory Constructors
    5. Assert
    6. Typedef
    7. Metadata
      1. Dart’s Built-in Annotations
      2. Defining Your Own Annotations
    8. Summary
  24. Chapter 13: Testing Your Work
    1. Including External Packages in Your Program
    2. Unit Testing
      1. Taking a unittest
      2. Grouping Unit Tests
    3. Tic-Tac-Toe
      1. Defining the Game
      2. Testing Tic-Tac-Toe
    4. Beta Testing
    5. Usability Testing
    6. Summary
  25. Chapter 14: Concurrency
    1. The Hardware Impetus for Parallelism
    2. Futures
      1. Using Futures with HttpRequest
      2. Using Futures with File
      3. Stringing Futures Together
    3. Isolates
      1. Starting Up an Isolate
      2. Communicating Between Isolates
      3. The Dining Philosopher
    4. Summary
  26. Chapter 15: Tools of the Trade
    1. Git
      1. Git in a Nutshell
      2. Setting Up a Remote Repository
      3. Committing Changes to the Repository
      4. Pulling Changes
    2. Debugging Dart with Breakpoints
    3. Incorporating Open-Source Packages
    4. API Documentation
    5. Summary
  27. Chapter 16: Putting It All Together
    1. Constraint Satisfaction Problems
      1. Australian Map Coloring Problem
      2. How Is a Constraint Satisfaction Problem Solved?
      3. The constraineD Library
      4. Solving the Australian Map Coloring Problem Using constraineD
    2. Word Search
      1. Getting Started
      2. Search Words
      3. Facing Constraints
      4. Defining a Grid
      5. The Glue
      6. You’re Not Done Yet
    3. Summary
  28. Chapter 17: Where to Go from Here
    1. Advance Your Core Dart Skills
    2. Project Ideas
    3. Learn Polymer.dart and/or Angular.dart
    4. Server-Side Dart
    5. Working with Databases
    6. Learn Computer Science
      1. What Is Computer Science?
      2. Examples of Computer Science Problems in This Book
    7. Learn Another Language
      1. Python
      2. JavaScript
      3. C
      4. Scheme
    8. Learn How to Set Up a Web Server
    9. Learn Web Design
      1. Learn a WYSIWYG Web Design Tool
      2. Learn a Graphics Package
      3. Learn a CSS Framework
    10. Get Involved with the Dart Community
    11. Get in Touch with the Author
    12. Summary
  29. Chapter 18: Interview with Dart’s Creators
    1. Interview with Lars Bak and Kasper Lund
      1. Part 1. Dart’s Formulation and Intent
      2. Part 2. Dart As a First Programming Language
  30. Appendix A: Dart Cheat Sheet
    1. The Basics
      1. Declaring and Initializing Variables (Chapter 3)
      2. Literals (Chapter 3, Chapter 6)
      3. Common Operators
      4. Control Structures (Chapter 3)
      5. Loops (Chapter 3, Chapter 6)
      6. Numbers
      7. Strings
      8. Constants and Final Variables
    2. Giving Programs Structure
      1. Functions (Chapter 5)
      2. Lists (Chapter 6)
      3. Maps (Chapter 6)
      4. Sets (Chapter 6)
      5. Defining Classes (Chapter 10, Chapter 11)
      6. Libraries (Chapter 10)
    3. Key Packages in the Standard Library
      1. dart:html (Chapter 8)
      2. dart:io (Chapter 4, Chapter 14)
      3. dart:math
      4. unittest (Chapter 13)
      5. dart:async (Chapter 8, Chapter 14)
      6. dart:isolate (Chapter 14)
    4. General Style Conventions
  31. Appendix B: History of Web Programming
    1. Client Side
      1. Java Applets
      2. JavaScript
      3. VBScript
      4. Flash
      5. Silverlight
      6. Recent Developments
    2. Server Side
      1. CGI
      2. Perl
      3. PHP
      4. ASP
      5. Java
      6. Python
      7. Ruby
      8. JavaScript
      9. Trends
    3. Where Does Dart Fit In?
    4. Evolution of the Web Browser
      1. Microsoft and Netscape Duke It Out
      2. Firefox Emerges from the Ashes of Netscape
      3. Mobile and a Revitalized Browser Ecosystem
    5. Importance Today
  32. Appendix C: Dart Timeline
  33. Appendix D: Great Resources
    1. Dart
      1. Books
      2. Web Sites
      3. Articles
    2. HTML & CSS
      1. Books
      2. Web Sites
    3. A Second Programming Language
      1. Books
    4. Other
      1. Books
  34. Index