Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: src/site/docs/technical-overview/index.html

Issue 11366023: Updated tech overview (Closed) Base URL: git@github.com:dart-lang/dartlang.org.git@master
Patch Set: incorporating review comments Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/site/docs/technical-overview/images/source-flow.png ('k') | src/site/support/index.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 --- 1 ---
2 layout: default 2 layout: default
3 title: "Technical Overview" 3 title: "Technical Overview"
4 --- 4 ---
5 <h1>Technical Overview </h1> 5 <h1>Technical Overview </h1>
6 6
7 <section> 7 <section>
8 <p> 8 <p>
9 Dart is a new class-based programming language 9 Dart helps developers productively build
10 for creating structured web applications. 10 high-performance apps for the modern web.
11 Developed with the goals of simplicity, efficiency, and scalability, 11 Targeting modern desktop and mobile browsers,
12 the Dart language combines powerful new language features 12 Dart apps can run natively in a Dart virtual machine (VM)
13 or be compiled to JavaScript.
14 </p>
15
16 <p>
17 Developed with the goals of <b>simplicity</b>,
18 <b>efficiency</b>, and <b>scalability</b>,
19 the Dart language combines powerful new features
13 with familiar language constructs into a clear, readable syntax. 20 with familiar language constructs into a clear, readable syntax.
21 But Dart's not just a language.
22 The Dart open-source project also includes <b>libraries</b>,
23 a <b>package manager</b>,
24 and <b>tools</b> such as a full-featured <b>editor</b>.
14 </p> 25 </p>
15 26
27 <p>
28 Additional open-source projects and the Pub package manager
sethladd 2012/12/16 22:23:03 this confused me briefly. What about "Additional /
Kathy Walrath 2012/12/18 00:21:56 Done.
29 help developers be even more productive.
30 For example, developers can use Pub to get packages for
31 <b>JavaScript interoperability</b>,
32 a <b>web UI</b> framework,
33 a <b>unit testing</b> library,
34 libraries for <b>game development</b>,
35 and much more.
36 </p>
37
16 <aside> 38 <aside>
17 <div class="alert alert-info"> 39 <div class="alert alert-info">
18 <strong>Note:</strong> 40 <strong>Note:</strong>
19 This document is part of an early preview of 41 Although the Dart language will continue to change,
sethladd 2012/12/16 22:23:03 You say this, but then in the next paragraph, you
Kathy Walrath 2012/12/18 00:21:56 Done.
20 the Dart language and programming environment. 42 we expect the changes to be backward compatible.
21 Some elements are missing from the current release, 43 The Dart libraries, on the other hand,
22 and the details are subject to change based on the feedback we receive. 44 are not yet stable.
23 </div> 45 </div>
24 </aside> 46 </aside>
25 47
48 <p>
49 Now that the language has stabilized,
50 the Dart team is working on <b>performance</b>.
51 The Dart VM is already much faster than Chrome’s JavaScript engine, V8,
52 on two important benchmarks.
53 See the <a href="/performance/">performance page</a>
54 for the latest measurements of Dart and JavaScript code.
55 </p>
56
57 </section>
58
59
26 <h4> Contents </h4> 60 <h4> Contents </h4>
27 61
28 <ol class="toc"> 62 <ol class="toc">
29 <li> <a href="#key">Key features</a> </li>
30 <li> <a href="#goals">Design goals</a> </li> 63 <li> <a href="#goals">Design goals</a> </li>
31 <li> <a href="#code">Show me the code </a> 64 <li> <a href="#key">Language features</a>
32 <ol> 65 <ol>
33 <li> <a href="#classes">Classes and interfaces </a> </li> 66 <li> <a href="#lang-classes">Classes </a></li>
34 <li> <a href="#optional-types">Optional types </a> </li> 67 <li> <a href="#lang-optional-types">Optional types</a> </li>
68 <li> <a href="#lang-lexical-scope">Lexical scoping</a> </li>
69 <li> <a href="#lang-libraries">Libraries</a> </li>
70 <li> <a href="#lang-isolates">Isolates</a> </li>
71 <li> <a href="#lang-tooling">Toolability</a> </li>
72 </ol> </li>
73 <li> <a href="#code">Examples of Dart code</a>
74 <ol>
75 <li> <a href="#classes">Using classes </a></li>
76 <li> <a href="#optional-types">Adding types</a> </li>
77 <li> <a href="#browser">Writing web apps</a> </li>
35 </ol> 78 </ol>
36 </li> 79 </li>
37 <li> <a href="#howtouse">How can I use Dart? </a> 80 <li> <a href="#tools">Tools</a>
38 <ol> 81 <ol>
82 <li> <a href="#running">Dart code execution</a> </li>
39 <li> <a href="#editor">Dart Editor</a> </li> 83 <li> <a href="#editor">Dart Editor</a> </li>
40 <li> <a href="#mimetype">New MIME type </a> </li> 84 <li> <a href="#pub">The Pub package manager</a> </li>
41 </ol> 85 </ol></li>
42 </li> 86 <li> <a href="#libraries">Libraries</a> </li>
43 <li> <a href="#tools">Tools </a> </li> 87 <li> <a href="#get-started">Get started with Dart</a> </li>
44 <li> <a href="#libraries">Libraries </a> </li> 88 <li> <a href="#involved">More information</a> </li>
45 <li> <a href="#involved">Get involved </a> </li>
46 </ol> 89 </ol>
47 </section> 90 </section>
48 91
49
50 <section id="key">
51 <h2> Key features </h2>
52
53 <p>
54 Key features of the Dart language include:
55 </p>
56
57
58 <h3>Classes</h3>
59 <p>
60 Classes and interfaces provide a well understood mechanism
61 for efficiently defining APIs.
62 These constructs enable encapsulation and reuse of methods and data.
63 </p>
64
65 <h3>Optional types</h3>
66 <p>
67 Dart programmers can optionally add static types to their code.
68 Depending on programmer preference and stage of application development,
69 the code can migrate from a simple, untyped experimental prototype
70 to a complex, modular application with typing.
71 Because types state programmer intent,
72 less documentation is required to explain what is happening in the code,
73 and type-checking tools can be used for debugging.
74 </p>
75
76 <h3>Libraries</h3>
77 <p>
78 Developers can create and use libraries
79 that are guaranteed not to change during runtime.
80 Independently developed pieces of code can therefore
81 rely on shared libraries.
82 </p>
83
84 <h3>Tooling</h3>
85 <p>
86 Dart will include a rich set of
87 execution environments, libraries, and development tools
88 built to support the language.
89 These tools will enable productive and dynamic development,
90 including edit-and-continue debugging and beyond&mdash;up
91 to a style where you program an application outline, run it,
92 and fill in the blanks as you run.
93 </p>
94 </section>
95
96
97 <section id="goals"> 92 <section id="goals">
98 <h2> Design goals </h2> 93 <h2> Design goals </h2>
99 94
100 <p> 95 <p>
101 The Dart programming language is presented here in its early stages. 96 The following design goals guide
102 The following design goals will guide 97 the continued evolution and refinement of this project:
103 the continued evolution and refinement of this open source project:
104 </p> 98 </p>
105 99
106 <ul> 100 <ul>
107 <li>Create a <b>structured yet flexible</b> 101 <li>Create a <b>structured yet flexible</b>
108 programming language for the web.</li> 102 programming language for the web.</li>
109 <li>Make Dart feel <b>familiar and natural</b> to programmers 103 <li>Make Dart feel <b>familiar and natural</b> to programmers
110 and thus easy to learn.</li> 104 and thus easy to learn.</li>
111 <li>Ensure that all Dart language constructs allow 105 <li>Ensure that all Dart language constructs allow
112 <b>high performance</b> and 106 <b>high performance</b> and
113 <b>fast application startup</b>.</li> 107 <b>fast application startup</b>.</li>
114 <li>Make Dart appropriate for the 108 <li>Make Dart appropriate for the
115 <b>full range of devices on the web</b>&mdash;including 109 <b>full range of devices on the web</b>&mdash;including
116 phones, tablets, laptops, and servers.</li> 110 phones, tablets, laptops, and servers.</li>
117 <li>Provide tools that make Dart run fast 111 <li>Provide tools that make Dart run fast across
118 <b>across all major modern browsers</b>. </li> 112 <b>all major modern browsers</b>. </li>
119 </ul> 113 </ul>
120 114
121 <p> 115 <p>
122 These design goals address the following problems 116 These design goals address the following problems
123 currently facing web developers: 117 currently facing web developers:
124 </p> 118 </p>
125 119
126 <ul> 120 <ul>
127 <li>Small scripts often evolve into 121 <li>Small scripts often evolve into
128 large web applications with no apparent structure&mdash;they&rsquo;re 122 large web applications with no apparent structure&mdash;they&rsquo;re
129 hard to debug and difficult to maintain. 123 hard to debug and difficult to maintain.
130 In addition, these monolithic apps can&rsquo;t be split up 124 In addition, these monolithic apps can&rsquo;t be split up
131 so that different teams can work on them independently. 125 so that different teams can work on them independently.
132 It&rsquo;s difficult to be productive 126 It&rsquo;s difficult to be productive
133 when a web application gets large.</li> 127 when a web application gets large.</li>
134 <li>Scripting languages are popular 128 <li>
135 because their lightweight nature makes it easy to write code quickly. 129 In scripting languages, the contracts with other parts of an application
136 Generally, the contracts with other parts of an application 130 are usually conveyed in comments rather than in the language structure its elf.
137 are conveyed in comments rather than in the language structure itself. 131 As a result, it can be difficult for someone other than the author
138 As a result, it&rsquo;s difficult for someone other than the author
139 to read and maintain a particular piece of code.</li> 132 to read and maintain a particular piece of code.</li>
140 <li>With existing languages, 133 <li>Before Dart,
141 the developer is forced to make a choice between 134 the developer was forced to make a choice between
142 static and dynamic languages. 135 static and dynamic languages.
143 Traditional static languages require heavyweight toolchains 136 Traditional static languages require heavyweight toolchains
144 and a coding style that can feel inflexible and overly constrained.</li> 137 and a coding style that can feel inflexible and overly constrained.</li>
145 <li>Developers have not been able to create homogeneous systems 138 <li>Developers have not been able to create homogeneous systems
146 that encompass both client and server, 139 that encompass both client and server,
147 except for a few cases such as Node.js and Google Web Toolkit (GWT). 140 except for a few cases such as Node.js and Google Web Toolkit (GWT).
148 </li> 141 </li>
149 <li>Different languages and formats entail context switches 142 <li>Different languages and formats entail context switches
150 that are cumbersome and add complexity to the coding process.</li> 143 that are cumbersome and add complexity to the coding process.</li>
151 </ul> 144 </ul>
145
146 </section>
147
148
149
150 <section id="key">
151 <h2> Language features </h2>
152
153 <p>
154 Key features of the Dart language include
155 classes, optional types, lexical scoping, libraries, isolates, and toolability .
156 </p>
157
158 <p>
159 Although Dart is designed to be familiar,
160 we took the opportunity to fix
161 some problematic features of common languages.
162 We also introduced a few good features from lesser known languages.
163 Some Dart features you might not expect include
164 top-level functions,
165 optional parameters,
166 string interpolation,
167 multi-line strings,
168 dynamic method handling (<code>noSuchMethod</code>),
169 a cascade operator (<code>..</code>), and
170 a function shorthand syntax (<code>=></code>).
171 Details are in the
172 <a href="/docs/dart-up-and-running/ch02.html">language tour</a>.
173 </p>
174
175
176 <h3 id="lang-classes">Classes</h3>
177 <p>
178 Classes provide a well understood mechanism
179 for efficiently defining APIs.
180 Each class implicitly defines an interface.
181 Together, classes and interfaces
182 enable encapsulation and reuse of methods and data.
183 </p>
184
185 <h3 id="lang-optional-types">Optional types</h3>
186 <p>
187 Optional types can help a Dart program scale from a quick prototype
188 into a complex, modular application.
189 While a small program or prototype might not have type annotations,
190 you always have the option of adding them.
191 Types make the code's intent clearer,
192 which helps developers to understand the code.
193 Types also enable more powerful tools
194 for writing and debugging code.
195 </p>
196
197 <h3 id="lang-lexical-scope">Lexical scoping</h3>
198 <p>
199 Scoping rules in Dart make sense.
200 Each identifier is scoped to the block it's declared in,
201 which means that you can tell a variable's scope
202 by looking at the braces in your code <code>{...}</code>.
203 Even in a closure within a loop,
204 the value of a variable is what you intuitively expect.
205 </p>
206
207
208 <h3 id="lang-libraries">Libraries</h3>
209 <p>
210 Developers can create and use libraries
211 that are guaranteed not to change during runtime.
212 Independently developed pieces of code can therefore
213 rely on shared libraries.
214 </p>
215
216 <h3 id="lang-isolates">Isolates</h3>
217 <p>
218 Modern web browsers, even on mobile platforms,
219 run on multi-core CPUs.
220 To take advantage of all those cores,
221 developers traditionally use shared-memory threads running concurrently.
222 However, shared-state concurrency is error prone
223 and can lead to complicated code.
224 Instead of threads, all Dart code runs inside of isolates.
225 Each isolate has its own memory heap,
226 ensuring that no isolate’s state is accessible from any other isolate.
227 </p>
228
229 <h3 id="lang-tooling">Toolability</h3>
230 <p>
231 Dart is designed to work well with tools.
232 A rich set of execution environments, libraries, and development tools
233 have already been built to support the language.
234 Dart's toolability enables productive and dynamic development,
235 including edit-and-continue debugging and beyond&mdash;up
236 to a style where you program an application outline, run it,
237 and fill in the blanks as you run.
238 </p>
152 </section> 239 </section>
153 240
154 241
155 <section id="code"> 242 <section id="code">
156 <h2>Show me the code</h2> 243 <h2>Examples of Dart code</h2>
157 244
158 <p> 245 <p>
159 Here are several code snippets 246 Here are some code snippets
160 to give you a feel for what Dart code looks like. 247 to give you a feel for what Dart code looks like.
161 </p> 248 </p>
162 249
163 <section id="classes"> 250 <section id="classes">
164 <h3>Classes and interfaces</h3> 251 <h3>Using classes</h3>
165 252
166 <p> 253 <p>
167 Dart&rsquo;s interfaces and classes provide you with 254 Dart&rsquo;s classes provide
168 a set of reusable and extensible building blocks. 255 a set of reusable and extensible building blocks.
169 An <em>interface</em> defines a basic set of methods and constants, 256 A <em>class</em> defines methods and data
170 sometimes by inheriting from other interfaces. 257 and can provide method implementations.
171 A <em>class</em> can implement multiple interfaces, 258 Every <em>object</em> is an instance of a class.
172 but it only inherits from a single superclass.
173 </p> 259 </p>
174 260
175 <p> 261 <p>
176 The following example defines an interface, 262 Each class implicitly defines an <em>interface</em>.
177 along with a class and subclass that implement it: 263 A class can implement multiple interfaces,
264 but it only <em>extends</em>—inherits implementation from—a
265 single superclass.
266 </p>
267
268 <p>
269 The following example shows the code for three classes.
270 The first class, Shape, is an <em>abstract class</em>&mdash;a
271 class that can't be instantiated.
272 The second class, Rectangle,
273 implements the interface defined by Shape.
274 The third class, Square, is a subclass of Rectangle.
178 </p> 275 </p>
179 276
180 {% highlight dart %} 277 {% highlight dart %}
181 interface Shape { 278 abstract class Shape {
182 num perimeter(); 279 num perimeter();
183 } 280 }
184 281
185 class Rectangle implements Shape { 282 class Rectangle implements Shape {
186 final num height, width; 283 final num height, width;
187 Rectangle(num this.height, num this.width); // Compact constructor syntax. 284 Rectangle(this.height, this.width); // Compact constructor syntax.
188 num perimeter() => 2*height + 2*width; // Short function syntax. 285 num perimeter() => 2*height + 2*width; // Function shorthand syntax.
189 } 286 }
190 287
191 class Square extends Rectangle { 288 class Square extends Rectangle {
192 Square(num size) : super(size, size); 289 Square(num size) : super(size, size);
193 } 290 }
194 {% endhighlight %} 291 {% endhighlight %}
195 292
196 </section> <!-- classes --> 293 </section> <!-- classes -->
197 294
198 295
199 <section id="optional-types"> 296 <section id="optional-types">
200 <h3>Optional types</h3> 297 <h3>Adding types</h3>
201 298
202 <p> 299 <p>
203 Dart provides, at the programmer&rsquo;s option, 300 Dart provides, at the programmer&rsquo;s option,
204 a mixture of static and dynamic checking. 301 a mixture of static and dynamic checking.
205 When experimenting, 302 When experimenting,
206 the programmer can write untyped code for simple prototyping. 303 the programmer can write untyped code for simple prototyping.
207 As the application becomes larger and more stable, 304 As the application becomes larger and more stable,
208 types can be added to aid debugging and impose structure where desired. 305 types can be added to aid debugging and impose structure.
209 </p> 306 </p>
210 307
211 <p> 308 <p>
212 For example, here is a sample of untyped code in Dart 309 For example, here is a sample of untyped code in Dart
sethladd 2012/12/16 22:23:03 Thoughts on a more compelling, or simple, example
Kathy Walrath 2012/12/18 00:21:56 You wouldn't really have 'function' here, would yo
sethladd 2012/12/18 00:31:45 Right, sorry, the first is JavaScript.
213 that creates a new Point class that has parameters 310 that creates a new Point class that has two instance variables
214 <code>x</code> and <code>y</code> 311 (<code>x</code> and <code>y</code>)
215 and two methods: 312 and two methods
216 <code>scale()</code> and <code>distance()</code>. 313 (<code>scale()</code> and <code>distance()</code>).
217 </p> 314 </p>
218 315
219 {% highlight dart %} 316 {% highlight dart %}
220 import 'dart:math'; 317 import 'dart:math';
221 318
222 class Point { 319 class Point {
223 var x, y; 320 var x, y;
224 Point(this.x, this.y); 321 Point(this.x, this.y);
225 scale(factor) => new Point(x*factor, y*factor); 322 scale(factor) => new Point(x*factor, y*factor);
226 distance() => sqrt(x*x + y*y); 323 distance() => sqrt(x*x + y*y);
227 } 324 }
228 325
229 main() { 326 main() {
230 var a = new Point(2,3).scale(10); 327 var a = new Point(2,3).scale(10);
231 print(a.distance()); 328 print(a.distance());
232 } 329 }
233 {% endhighlight %} 330 {% endhighlight %}
234 331
235 <p> 332 <p>
236 Here is what this code looks like with types added 333 Here is what this code looks like with a few types added
237 that ensure that 334 to make the API of Point clearer.
238 <code>x</code>, <code>y</code>, and <code>factor</code> 335 For example, this code specifies that
239 are of type <code>num</code>, 336 <code>x</code> and <code>y</code>
240 and that a <code>Point</code> contains two values 337 are of type <code>num</code>.
241 of type <code>num</code>:
242 </p> 338 </p>
243 339
244 {% highlight dart %} 340 {% highlight dart %}
245 import 'dart:math'; 341 import 'dart:math';
246 342
247 class Point { 343 class Point {
248 num x, y; 344 num x, y;
249 Point(num this.x, num this.y); 345 Point(this.x, this.y);
250 Point scale(num factor) => new Point(x*factor, y*factor); 346 Point scale(num factor) => new Point(x*factor, y*factor);
251 num distance() => sqrt(x*x + y*y); 347 num distance() => sqrt(x*x + y*y);
252 } 348 }
253 349
254 void main() { 350 main() {
255 Point a = new Point(2,3).scale(10); 351 var a = new Point(2,3).scale(10);
256 print(a.distance()); 352 print(a.distance());
257 } 353 }
258 {% endhighlight %} 354 {% endhighlight %}
259 355
260 </section> <!-- optional types --> 356 </section> <!-- optional types -->
261 </section> <!-- code -->
262 357
263 <section id="howtouse"> 358 <section id="browser">
264 <h2>How can I use Dart?</h2> 359 <h3>Writing web apps</h3>
265 360
266 <p> 361 <p>
267 You can run Dart code in several ways: 362 Dart code can be compiled to JavaScript
268 </p> 363 that runs in any modern browser.
269 364 Dart code can also run directly in browsers that have a Dart VM,
270 <ul> 365 including Dartium and eventually Chrome.
271 <li> 366 Here's an example of an HTML file that loads Dart code:
272 <p>
273 Compile Dart code to JavaScript that can run in any modern browser:<br />
274 Chrome, Safari 5+, and Firefox 4+ (more browser support coming shortly)
275 </p>
276 </li>
277 <li>
278 <p>
279 Execute Dart code directly in a VM on your computer
280 </p>
281 </li>
282 <li>
283 <p>
284 With a <a href="#mimetype">new MIME type</a>,
285 use Dart in a browser
286 without first compiling to JavaScript
287 </p>
288 </li>
289 </ul>
290
291 <section id="editor">
292 <h3>Dart Editor</h3>
293
294 <p>
295 Dart Editor is a tool for
296 creating, modifying, and launching Dart web apps.
297 With one click, you can compile a Dart web app to JavaScript
298 and launch the app in a browser.
299 Taking advantage of Dart&rsquo;s structured nature,
300 Dart Editor supports method name completion and refactoring.
301 </p>
302
303 <p>
304 For information about downloading and using Dart Editor, see the
305 <a href="/docs/editor/getting-started/">Dart Editor tutorial</a>.
306 </p>
307 </section>
308
309 <section id="mimetype">
310 <h3>New MIME type</h3>
311
312 <p>
313 You will be able to link to a Dart program directly from an HTML page.
314 Here is the proposed new MIME type,
315 &ldquo;application/dart&rdquo;:
316 </p> 367 </p>
317 368
318 {% highlight html %} 369 {% highlight html %}
319 <!DOCTYPE html> 370 <!DOCTYPE html>
371 <html>
372 <head> <title>Simple Dart Web App</title> </head>
373 <body>
374 <h1>Simple Dart Web App</h1>
375 <button id="button-text"></button>
376 <output id="msg"></output>
320 377
321 <html> 378 <script type="application/dart" src="app.dart"></script>
322 <head> 379 <script src="https://dart.googlecode.com/svn/branches/bleeding_edge/dart/cli ent/dart.js"></script>
323 <title>Simple Dart Web App</title> 380
324 </head>
325 <body>
326 <h1>Simple Dart Web App</h1>
327 <h2 id="status">dart is starting up...</h2>
328 <script type="application/dart" src="SimpleDartWebApp.dart"></script>
329 <script src="http://dart.googlecode.com/svn/branches/bleeding_edge/dart/clie nt/dart.js"></script>
330 </body> 381 </body>
331 </html> 382 </html>
332 {% endhighlight %} 383 {% endhighlight %}
333 384
334 <p> 385 <p>
335 The dart.js file above will swap out the <code>application/dart</code> 386 The first &lt;script> tag in this example
336 tag with a <code>text/javascript</code> tag if the browser does not 387 loads the code from app.dart.
337 have an embedded Dart virtual machine. 388 If the browser has an embedded Dart VM,
389 then the browser loads Dart code,
390 which has the MIME type <code>application/dart</code>.
391 Otherwise, the browser loads the code's JavaScript equivalent,
392 thanks to the <code>dart.js</code> script
393 in the second &lt;script> tag.
338 </p> 394 </p>
339 395
340 <p> 396 <p>
341 The following is the Dart code for the page above: 397 Here is the code in app.dart:
342 </p> 398 </p>
343 399
344 {% highlight dart %} 400 {% highlight dart %}
345 import 'dart:html'; 401 import 'dart:html';
346 402
347 class SimpleDartWebApp { 403 main() {
348 void run() { 404 query('#button-text')
349 write("Hello World!"); 405 ..text = "Click me!"
350 } 406 ..on.click.add(respond);
351
352 void write(String message) {
353 // the HTML library defines a global "document" variable
354 document.query('#status').innerHTML = message;
355 }
356 } 407 }
357 408
358 void main() { 409 respond(event) {
359 new SimpleDartWebApp().run(); 410 query("#msg").text = "You clicked the button!";
360 } 411 }
361 {% endhighlight %} 412 {% endhighlight %}
362 </section> <!-- howtouse --> 413
363 </section> <!-- mimetype --> 414 <p>
415 The main() function's call to query()
416 returns the HTML element that has the ID "button-text".
417 The code then uses the cascade operator (<code>..</code>)
418 to perform multiple operations on that element.
419 The first operation initializes
420 the element's <code>text</code> property,
421 and the second adds an event handler to the element.
422 </p>
423
424 <p>
425 Libraries and frameworks will
426 ease the task of developing sophisticated web apps.
427 For example, the libraries and tools in the
428 <a href="http://www.dartlang.org/articles/dart-web-components/">Web UI</a>
429 package provide web components, templates, data binding,
430 and encapsulation.
431 Just to give you a taste of the Web UI package,
432 here's an example of one-way data binding in an HTML file:
433 </p>
434
435 {% highlight html %}
sethladd 2012/12/16 22:23:03 for reference, there is a way to wrap this in {{ r
Kathy Walrath 2012/12/18 00:21:56 Done.
436 <!-- HTML code... -->
437 <div>
438 The current time is: {{'{{'}}currentTime}}
sethladd 2012/12/16 22:23:03 This would be more compelling if you rewrote the a
Kathy Walrath 2012/12/18 00:21:56 I couldn't see a way of using Web UI at this point
439 </div>
440 <!-- more HTML code... -->
441 {% endhighlight %}
442
443 <p>
444 In the rendered page,
445 <code>{{'{{'}}currentTime}}</code> is replaced by
446 the value of the top-level <code>currentTime</code> variable
447 from the following Dart code:
448 </p>
449
450 {% highlight dart %}
451 String currentTime;
452
453 void main() {
454 Date today = new Date.now();
455 currentTime = formatTime(today.hour, today.minute, today.second);
456 }
457
458 // ...The formatTime() function and any other code goes here...
459 {% endhighlight %}
460
461 </section> <!-- browser -->
462
463 </section> <!-- code -->
364 464
365 465
366 <section id="tools"> 466 <section id="tools">
367 <h2>Tools</h2> 467 <h2>Tools</h2>
368 468
369 <p> 469 <p>
370 The Dart language is accompanied by a set of tools 470 The Dart language is accompanied by a set of tools
371 to aid rapid prototyping, coding, and debugging 471 to aid rapid prototyping, coding, and debugging
372 for the entire development cycle. 472 for the entire development cycle.
373 Offerings include: 473 Offerings include:
374 </p> 474 </p>
375 475
376 <ul> 476 <ul>
377 <li>The Dart Editor</li> 477 <li><b>Dart Editor:</b> A Dart-savvy editor that supports creating, modifying, running, and debugging Dart apps</li>
378 <li>The dart2js compiler</li> 478 <li><b>Pub:</b> A package manager that features libraries published on <a href ="http://pub.dartlang.org/">pub.dartlang.org</a></li>
379 <li>The Dart VM</li> 479 <li><b>dart2js:</b> The Dart-to-JavaScript compiler</li>
380 <li>Dartium: Chromium with an embedded Dart VM</li> 480 <li><b>dart:</b> The Dart VM</li>
481 <li><b>Dartium:</b> Chromium with an embedded Dart VM</li>
381 </ul> 482 </ul>
382 483
484 <section id="running">
485 <h3>Dart code execution</h3>
486
383 <p> 487 <p>
384 On the client side, you can deploy Dart apps in two ways. 488 On the client side, you can deploy Dart apps in two ways.
385 For browsers without an embedded Dart VM, 489 For browsers without an embedded Dart VM,
386 you can compile the Dart code to JavaScript, 490 you can compile the Dart code to JavaScript,
387 using the dart2js compiler. This compiler generates ECMAScript5-compatible 491 using the <b>dart2js</b> compiler.
388 JavaScript from the Dart code. Dart code can run 492 This compiler generates ECMAScript5-compatible
389 directly in browsers that have a Dart VM, 493 JavaScript from the Dart code.
390 including Dartium (a special build of Chromium) 494 This JavaScript code works in the latest versions of
391 and eventually Chrome. 495 Chrome, Safari, and Firefox,
496 plus IE9+, mobile Safari, and Chrome for Android.
497 Dart code can run directly in browsers
498 that have a Dart VM,
499 including Dartium and eventually Chrome.
392 </p> 500 </p>
393 501
394 <p> 502 <p>
395 On the server side, the Dart code runs directly on the command line, 503 On the server side, the Dart code runs directly on the command line,
504 using the <b>dart</b> tool,
396 for fast iteration and for cloud-based tasks. 505 for fast iteration and for cloud-based tasks.
397 </p> 506 </p>
398 507
508 <p>
399 <img src="images/source-flow.png" 509 <img src="images/source-flow.png"
400 alt="Dart source -> Dart Editor; Dart Editor -> either [Dart VM] or [JavaSc ript source -> Browser (JavaScript Engine)]" 510 alt="Dart source -> either [Dart VM] or [dart2js -> JavaScript source -> Br owser (JavaScript Engine)]">
401 width="266" height="417" > 511 </p>
512
513 </section>
514
515 <section id="editor">
516 <h3>Dart Editor</h3>
517
518 <p>
519 Dart Editor is based on Eclipse components,
520 but it has a simplified user interface.
521 </p>
522
523 <aside>
524 <div class="alert alert-info">
525 <strong>Note:</strong>
526 You aren't limited to using Dart Editor.
527 If you prefer Eclipse, IntelliJ, or WebStorm,
528 you can download Dart plugins for those IDEs.
529 Dart configurations also exist for popular text editors
530 such as Vim, Emacs, TextMate, and Sublime.
531 </div>
532 </aside>
533
534 <p>
535 Features of Dart Editor include:
536 </p>
537
538 <ul>
539 <li> Easy launching of both web apps and command-line apps </li>
540 <li> Interactive debugging of both web apps (with Dartium)
541 and command-line apps </li>
542 <li> Static analysis to catch errors and potential problems </li>
543 <li> Code completion </li>
544 <li> Code navigation </li>
545 <li> Refactoring </li>
546 <li> Auto-update of the editor, SDK, and Dartium </li>
547 <li> Code update help for breaking changes
548 to the language and core libraries </li>
549 </ul>
550
551 <p>
552 The following screenshot shows
553 Dart Editor being used to debug a web app.
554 </p>
555
556 <p>
557 <img src="images/DartEditor-debugger.png"
558 alt="screenshot of Dart Editor debugging a web app">
559 </p>
560
561 <p>
562 To get the tools and find more information, go to the
563 <a href="/downloads.html">downloads page</a>.</p>
564
565 </section>
566
567 <section id="pub">
568 <h3>The Pub package manager</h3>
569
570 <p>
571 Pub is a package mananger for Dart.
572 It helps developers reuse existing Dart code
573 and bundle Dart apps and libraries
574 for reuse and sharing with other people.
575 Pub handles versioning and dependency management.
576 </p>
577
578 <p>
579 You can use Pub either at the command line
580 or through Dart Editor.
581 Because Pub is part of the SDK,
582 it's updated whenever Dart Editor or the SDK is updated.
583 </p>
584
585 <p>
586 For more information, go to
587 <a href="http://pub.dartlang.org/">pub.dartlang.org</a>.
588 </p>
589
590 </section>
402 </section> 591 </section>
403 592
404 593
405 <section id="libraries"> 594 <section id="libraries">
406 <h2>Libraries</h2> 595 <h2>Libraries</h2>
407 596
408 <p> 597 <p>
409 Dart provides the following libraries 598 Dart provides several libraries
410 to support web and web server development: 599 to support web and web server development.
600 The
601 <a href="/docs/dart-up-and-running/ch03.html">library tour</a>
602 and the
603 <a href="http://api.dartlang.org">API reference</a>
604 have details on all the bundled Dart libraries.
605 Bundled libraries include the following (and more):
411 </p> 606 </p>
412 607
413 <dl> 608 <dl>
414 <dt> <a href="http://api.dartlang.org/dart_core.html">Core Library</a> </dt> 609 <dt> <a href="http://api.dartlang.org/dart_core.html">Core library</a> </dt>
415 <dd> Contains interfaces to support 610 <dd> Common data structures and operations.
416 common data structures and operations.
417 </dd> 611 </dd>
418 <dt> <a href="http://api.dartlang.org/html.html">HTML Library</a> </dt> 612 <dt> <a href="http://api.dartlang.org/dart_html.html">HTML library</a> </dt>
419 <dd> Contains interfaces to the HTML5 DOM, 613 <dd> The interface to the HTML5 DOM,
420 loosely based on the proposed HTML5 standard 614 loosely based on the proposed HTML5 standard
421 as specified by the W3C/WHATWG. 615 as specified by the W3C/WHATWG.
422 These interfaces will evolve in parallel with 616 This library is evolving in parallel with
423 the HTML5 standards.</dd> 617 the HTML5 standards.</dd>
424 618
425 <dt> <a href="http://api.dartlang.org/io.html">I/O Library</a> </dt> 619 <dt> <a href="http://api.dartlang.org/dart_io.html">I/O library</a> </dt>
426 <dd> Contains interfaces to read and write files, open directories, 620 <dd> Server-side support for I/O:
427 open network sockets, and run HTTP servers. This library is for 621 read and write files, open directories,
428 command-line Dart programs. 622 open network sockets, and run HTTP servers.
429 </dd> 623 </dd>
430 624
431 <dt> <a href="http://api.dartlang.org/dart_isolate.html">Isolate Library</a> < /dt> 625 <dt> <a href="http://api.dartlang.org/dart_isolate.html">Isolate library</a> < /dt>
432 <dd> 626 <dd>
433 Contains interfaces for spawning and communicating with isolates, 627 Support for spawning and communicating with isolates,
434 the mechanism for concurrency and security in a Dart program. 628 the mechanism for concurrency and security in a Dart program.
435 </dd> 629 </dd>
436 630
437 <dt> <a href="http://api.dartlang.org/crypto.html">Crypto Library</a> </dt> 631 <dt> <a href="http://api.dartlang.org/dart_json.html">JSON library</a> </dt>
438 <dd> 632 <dd>
439 Contains interfaces for creating one-way hashes (SHA1, MD5, SHA256) 633 Support for parsing and producing JSON-encoded text.
440 and HMAC support.
441 </dd> 634 </dd>
442 635
443 <dt> <a href="http://api.dartlang.org/json.html">JSON Library</a> </dt> 636 <dt> <a href="http://api.dartlang.org/dart_math.html">Math library</a> </dt>
444 <dd> 637 <dd>
445 Contains the ability to parse and produce JSON-encoded text. 638 Common functionality such as sine and cosine,
446 </dd> 639 maximum and minimum,
447 640 and constants such as <em>pi</em> and <em>e</em>.
448 <dt> <a href="http://api.dartlang.org/unittest.html">Unit Test Library</a> </d t>
449 <dd>
450 Contains functions and classes for writing unit tests in Dart.
451 </dd> 641 </dd>
452 </dl> 642 </dl>
453 643
454 <p> 644 <p>
455 See the 645 The <a href="http://pub.dartlang.org">pub.dartlang.org</a> site
456 <a href="/docs/dart-up-and-running/ch03.html">library tour</a> 646 has many additional libraries and tools.
457 and the 647 Here are just a few:
458 <a href="http://api.dartlang.org">API reference</a> docs for
459 details on all the bundled
460 Dart libraries.
461 </p> 648 </p>
462 649
650 <dl>
651 <dt> <a href="http://pub.dartlang.org/packages/js">JavaScript Interop</a>
652 </dt>
653 <dd> Use JavaScript from Dart code. </dd>
654
655 <dt> <a href="http://pub.dartlang.org/packages/unittest">Unit test</a> </dt>
656 <dd> Write unit tests for Dart code. </dd>
657
658 <dt> <a href="http://pub.dartlang.org/packages/web_ui">Web UI</a> </dt>
659 <dd> Build web apps using an API based on Web Components,
660 with additional features inspired by model-driven views. </dd>
661
662 <dt> <a href="http://pub.dartlang.org/packages/meta">Meta</a> </dt>
663 <dd> Use annotations to give tools
664 additional semantic information about your program. </dd>
665 </dl>
666
463 </section> <!-- libraries --> 667 </section> <!-- libraries -->
464 668
465 669
466 <section id="involved"> 670 <section id="get-started">
467 <h2>Get involved</h2> 671 <h2>Get started with Dart</h2>
468 672
469 <p> 673 <p>
470 This project is open source 674 You can get started with Dart in two easy steps:
471 and will evolve with feedback and participation from the community. 675 </p>
472 We have released the draft language specification at an early stage 676
473 to gather responses from the developers 677 <ol>
474 who will be using this new language and infrastructure for web programming. 678 <li> <a href="/docs/editor/">Download Dart Editor</a> </li>
475 Here are some additional links for learning more about Dart 679 <li> <a href="/docs/tutorials/">Follow the tutorials</a> </li>
476 and providing your feedback: 680 </ol>
681
682 <p>
683 Then join the community,
684 so you can get help, meet other Dart developers,
685 and find out the latest news:
477 </p> 686 </p>
478 687
479 <ul> 688 <ul>
480 <li> 689 <li>
481 Other pages in the Dart website, 690 <a href="https://plus.google.com/+dartlang">Dart page on Google+</a>
482 such as the <a href="/docs/dart-up-and-running/ch02.html">language tour</a>, 691 </li>
692 <li>
693 <a href="https://plus.sandbox.google.com/communities/114566943291919232850"> Dartisans community on Google+</a> </li>
694 <li>
695 <a href="http://stackoverflow.com/questions/tagged/dart">Dart on Stack Overf low</a> </li>
696 </ul>
697
698 </section> <!-- get-started -->
699
700
701 <section id="involved">
702 <h2>More info</h2>
703
704 <p>
705 Here are some additional resources for learning about Dart
706 and providing feedback:
707 </p>
708
709 <ul>
710 <li>
711 This website,
712 especially the
713 <a href="/docs/dart-up-and-running/ch02.html">language tour</a>,
483 <a href="/docs/dart-up-and-running/ch03.html">library tour</a>, 714 <a href="/docs/dart-up-and-running/ch03.html">library tour</a>,
484 tutorials, and <a href="/docs/spec/">language specification</a>. 715 <a href="/articles/">articles</a>,
716 and <a href="/docs/dart-up-and-running/ch05.html">Dart Chat walkthrough</a>
485 </li> 717 </li>
486 <li> 718 <li>
487 <a href="https://code.google.com/p/dart/">Dart project</a> 719 The <a href="https://groups.google.com/a/dartlang.org/group/misc/">Dart
488 with issue tracker and source code </li> 720 discussion group</a> (misc at dartlang.org)
721 </li>
489 <li> 722 <li>
490 <a href="https://groups.google.com/a/dartlang.org/group/misc/">Dart 723 The Dart open-source project at
491 discussion group</a> (misc at dartlang.org) </li> 724 <a href="https://code.google.com/p/dart">code.google.com/p/dart</a>
725 </li>
492 <li> 726 <li>
493 <a href="https://plus.google.com/109866369054280216564/">+Dart</a> on Google + </li> 727 Additional open-source projects from the Dart team at
728 <a href="https://github.com/dart-lang">github.com/dart-lang</a>
729 </li>
494 </ul> 730 </ul>
495 731
496 </section> <!-- involved --> 732 </section> <!-- involved -->
497 733
498
OLDNEW
« no previous file with comments | « src/site/docs/technical-overview/images/source-flow.png ('k') | src/site/support/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698