今日読んだ本、Dart: Up and Running (A New, Tool-Friendly Language for Structured Web Apps) の感想。
Get up to speed on Dart, the web development language that not only matches the dynamic nature of JavaScript, but addresses its problems as well. This practical book gets you up to speed on the language, libraries, and tools for developing structured, fast, and maintainable web apps that run in most browsers.
Google designed the Dart platform to scale from simple scripts to complex apps, running on both the client and the server. With this book, you’ll learn how Dart can help you architect and develop HTML5 apps for the modern Web.
- Build web apps with the class-based, object-oriented Dart language, and compile your code to JavaScript
- Learn how to use Dart features, from variables to operators to classes and libraries
- Create, launch, and debug web and command-line apps with the Dart Editor
- Get a tour of Dart libraries, including dart:core, dart:html, dart:isolate, dart:io, and dart:json
- Become familiar with tools such as Dartium, the Chromium-based browser that includes the Dart virtual machine
- Get a walkthrough of Dart Chat, a client-server app in which both the client and the server are implemented in Dart
目次
- Chapter 1 Quick Start
- Why Google Created Dart
- A Quick Look at the Dart Language
- What’s Cool About Dart
- Up and Running
- Chapter 2 A Tour of the Dart Language
- A Basic Dart Program
- Important Concepts
- Variables
- Built-in Types
- Functions
- Operators
- Control Flow Statements
- Exceptions
- Classes
- Generics
- Libraries and Visibility
- Isolates
- Typedefs
- Metadata
- Comments
- Summary
- Chapter 3 A Tour of the Dart Libraries
- dart:core - Numbers, Collections, Strings, and More
- dart:async - Asynchronous Programming
- dart:math - Math and Random
- dart:html - Browser-Based Apps
- dart:isolate - Concurrency with Isolates
- dart:io - I/O for Command-Line Apps
- dart:json - Encoding and Decoding Objects
- dart:uri - Manipulating URIs
- dart:utf - Strings and Unicode
- dart:crypto - Hash Codes and More
- Summary
- Chapter 4 Tools
- pub: The Dart Package Manager
- Dart Editor
- Dartium: Chromium with the Dart VM
- dart2js: The Dart-to-JavaScript Compiler
- dart: The Standalone VM
- dart_analyzer: The Static Analyzer
- dartdoc: The API Documentation Generator
- Summary
- Chapter 5 Walkthrough: Dart Chat
- How to Run Dart Chat
- How Dart Chat Works
- The Client’s HTML Code
- The Client’s Dart Code
- The Server’s Code
- What Next?
入門の前に (Dart 入門零) - What is Dart? [Kindle版] Kathy Walrath (著), Seth Ladd (著)に書いた通り、Dartに入門するために本書を読んでみた。
内容的には、Dartの基礎についてはもちろんのこと、前書より一歩進んで、各標準ライブラリーについても基礎的なこと(さらにそのライブラリーの詳細については各ライブラリーについて説明されているサイトが紹介してあった)が解説されているので、じっくり読めば、簡単なWebアプリの作成や、ファイル操作のためのコマンドラインアプリケーションなら作成できるようになりそう。また、最後には、WebSocketによる簡単なチャットアプリの作成の手順についても解説されているので、とりあえずDartを使って「Hello, world!」の出力以上のことをして遊んで楽しむことも出来そう。
Dartという言語そのものの印象としては、最初はJavaScriptをよリよくした言語、JavaScriptにJava(C#)のいい所を取り入れた言語なのかなぁと思っていたけど、上記の前書や本書のコード例を読んでいるうちに、そうではないのかなぁと感じ始めた。JavaScriptでのオブジェクトの特徴、いいところといえば、クラスがいらない、継承はprototypeで実現する、またクラスがいらないおかげでコードが短かくできるということがあるけど、Dartではprototypeがばっさりなくなって、継承とか機能の追加はクラスによる継承やインタフェースの追加でするようになってるっぽい。ということで、DartがJavaScriptをよりよくなってる点で、特に分かりやすい部分は、optional typingという、型を明示的に指定することも出来るということと、関数の定義にfunctionという長いキーワードを入力しなくていい所。ということから、DartはJavaScriptをより良くした言語と考えるよりは、Java(C#)にJavaScriptのいい所を取り入れたと考えた方が違和感なくDartを使えるようになりそう。(といっても、分かりやすい部分である型をを明示的に指定することが出来る、C#側からみたら型を明示的にしなくてもいいというのは、すでに型推論してくれるvarキーワードがC#にあるけど。Javaは知らないのでその辺がどうなのか分からない><)逆に、JavaScriptのオブジェクト、prototypeを利用した継承に慣れていると、プロトタイプが無いことに戸惑ったり、クラスを定義するのが手間だったりして使いにくく感じるかも。
ということで、本書を読んでDartについてより興味をもったので、とりあえずは本書に出てくるチャットアプリを自分の手でコードを書いて作成してみたりして、Dartをちょっとずつ使っていき、Dartのいいところ、そうではないところも含めてDartのことをもっと知り、それで見つけたいい所を使いこなしながら、Dartで楽しく遊べるようになれればいいなぁと思った今日この頃。
0 コメント:
コメントを投稿