ENTRIES TAGGED "dart"

Build Reusable Widgets for the Web with Polymer and Dart

Don't wait for browsers to implement Web Components, try them today

Web Components, the family of new web specifications for reusable and encapsulated widgets, are coming to a browser near you. Thanks to Polymer, a new type of library for the web built on top of Web Components, and Dart, a new structured language and libraries for modern web development, you can build custom HTML elements that encapsulate style, structure, and behavior.

fig_1

I’m personally a fan of Polymer.dart, a Dart port of Polymer. If you want to use JavaScript, you can use the original Polymer library, though some of the details are different. Both Polymer and Polymer.dart are under heavy development, and the engineers behind the projects are looking for feedback.

In this article, I’ll show you how to build a simple auto-complete widget as a custom element. As a user types into a field, a list is searched by prefix. The user can keep typing for a more exact match, use up and down to select, or use their mouse.

fig_2
Read more…

Comments: 2 |

8 Dart Features Those Fat Cats Don’t Want You to Know

Productive code without ceremony

In this article, I’ll show you eight more features that help Dart stand on its own as a productive, ceremony-free language. Remember, Dart compiles to JavaScript, so everything you see here works across the modern Web.

Dart makes fluent APIs easy

Libraries like jQuery have popularized a fluent design that encourages chaining calls for easier-to-read code. Dart takes a cue from Smalltalk and adds method cascades to the language, so that any API can be used in a fluent style.

Without cascades, the variable button is repeated for every method call.

Use cascades to help reduce repetition.

Read more…

Comments: 5 |

In-Memory Databases, Burning Silos, Reintroducing Dart, and Google Glass Gatherings

Weekly Highlights and Insights: May 19-25

In-memory Databases: A discussion of near real-time manipulation of massive datasets

Burning the Silos: Minimize boundaries to reduce product cycle times.

Dart Is Not the Language You Think It Is: Seth Ladd’s enthusiastic reintroduction of Dart prompts a voluminous discussion on Slashdot.

Is that the Google Glass?: The anthropology of an always-on society

Tracing the Disappeared: An interactive visualization of CIA rendition flights

Comment |

Dart Is Not the Language You Think It Is

A terse language without ceremony

When Dart was originally launched, many developers mistook it for some sort of Java clone. In truth, Dart is inspired by a range of languages such as Smalltalk, Strongtalk, Erlang, C#, and JavaScript. Get past the semicolons and curly braces, and you’ll see a terse language without ceremony. Dart has evolved into its own, and here are some of my favorite language features.

Dart is a source code VM

The Dart VM reads and executes source code, which means there is no compile step between edit and run. As with other popular scripting languages, it’s very quick to iterate with Dart. The Dart VM runs on the command line and servers, and can be embedded into browsers. Just point the VM at Dart source code and you’re up and running!

Dart is optionally typed

Dart understands that sometimes you just don’t feel like appeasing a ceremonial type checker. Dart’s inclusion of an optional type system means you can use type annotations when you want, or use dynamic when that’s easier.

For example, you can explore a new idea without having to first think about type hierarchies. Just experiment and use var for your types. Once the idea is tested and you’re comfortable with the design, you can add type annotations.

Here is a comparison between code that uses type annotations, and code that uses var for dynamic. Both of these code snippets have the same runtime semantics:

With type annotations:

Or, without type annotations:

Type annotations are great for the “surface area” of the code (such as method and function signatures), and the tools are getting good enough for you to consider using var inside methods and functions.

Read more…

Comments: 53 |

What Kind of JavaScript Developer Are You?

Fault lines make conversation difficult

“JavaScript developer” is a description that hides tremendous diversity. While every language has a range of user skill levels, JavaScript has a remarkably fragmented community. People come to JavaScript for different reasons from different places, and this can make communication difficult. Sometimes it’s worse than that—not everyone likes everyone else.

“JavaScript developer” used to mean “web developer,” specifically a developer who spends a lot of time working in the browser. Even as JavaScript became a specialty of its own, most JavaScript developers came through a broader web practice first, learning HTML and CSS before tackling the DOM. This was my path, and is still a common one. It was reasonably easy to absorb JavaScript by example, using it as an object manipulation language before pushing into the harder corners.

Many programmers, however, started on the server-side, building code that filled templates. Server-side JavaScript existed, in the Netscape Enterprise Server, for example, but was a tiny fraction in a world dominated by Perl, Java, Python, Ruby, and ASP’s languages. Developers who spent most of their time writing code that ran on the server worked with a different set of tools and expectations, and had to shift gears as JavaScript became a more critical part of web applications. (Some of these developers generate a lot of JavaScript—JSON is, after all, JavaScript—but would prefer to think of JavaScript’s role in that as an accident.)

Another group of developers came from desktop applications, and expected more direct control over the interface. Many of these developers now understand JavaScript because the browser forces them, not because they want to.

Involuntary JavaScript creates a tremendous amount of tension around the language. Normally, the people who dislike a programming language can just work with something else. JavaScript’s browser dominance makes that hard.

Other developers, though, are much much happier and much deeper into JavaScript. The JavaScript revival that became visible with the rise of Ajax in 2005 gave the language greater credibility. Douglas Crockford’s work “Unearthing the Excellence in JavaScript,” JavaScript: The Good Parts demonstrated a powerful language lurking in a toolset many had considered trivial.

Over the past decade, JavaScript’s power and reach have grown thanks largely to a core group of developers whose focus on the language has created best practices and frameworks, while driving browser vendors to improve their implementations. Node.js emerged from this work, giving JavaScript a unique server-side framework that deeply reflects the language.

Read more…

Comment |
JavaScript and Dart: Can we do better?

JavaScript and Dart: Can we do better?

The good parts of JavaScript and beyond

O'Reilly editor Simon St. Laurent talked with Google's Seth Ladd about the challenges of improving the web.  How can we build on JavaScript's ubiquity while addressing performance, team, and scale issues?

Comment |
What is Dart?

What is Dart?

Inside a new language for building structured web apps.

Dart is a new structured web programming platform designed to enable complex, high-performance apps for the modern web. Kathy Walrath and Seth Ladd, members of Google's developer relations team, explain Dart's purpose and its applications.

Comment |
Developer Year in Review: 2011 Edition

Developer Year in Review: 2011 Edition

It was a good year for mobile, HTML5, Drupal and Hadoop.

It's time for our annual look back at the year that was, when mobile ruled the world, HTML5 PWNED Flash, Drupal and Hadoop were the hot buzzwords for your resume, and a new batch of languages tried to become stars.

Comment |
Developer Week in Review: Windows 8 Developer Preview goes public

Developer Week in Review: Windows 8 Developer Preview goes public

Win8 for free, Google throws a Dart, and Congress whiffs on patent reform.

Microsoft changes tack on a Windows 8 alpha, Google is darting away from JavaScript, and the great Patent Reform of 2011 reforms little.

Comments: 2 |