Monday, 10 October 2011

Where can I Get the source

A brief summary on how to access the source code. You can also browse the repository or list the changes.
There are certain pre-requisites required for building Dart. If your machine is already setup to build Chromium, then you may skip this step. Otherwise prepare your machine according to these instructions - see PreparingYourMachine .
Committers: For all instructions below use https instead of http. Also use your Google Code Password when prompted.

Getting the source

Create a directory into which you want to checkout the Dart sources and change into that directory.

Getting everything

gclient config http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps
gclient sync
For instructions how to build and test refer to "Build everything".

Getting the standalone VM

gclient config http://dart.googlecode.com/svn/branches/bleeding_edge/deps/standalone.deps
gclient sync

HTMLConverter for DART

To make it easier to develop web applications in Dart, we propose adding a new mime type (application/dart) for HTML documents that allows embedding dart scripts. We wrote a script (htmlconverter.py) that will translate an HTML page with these new mime types into an HTML page with JavaScript code.

Using htmlconverter.py

To invoke this script, ensure that you have a checkout of the project, and that you have built the dartc compiler (see instructions in Building).
Then you can invoke the script as follows:
$ python dart/client/tools/htmlconverter.py input.html -o out/
The script will do the following:
  1. Invoke the dartc compiler on any code in the page, embedding the result on a script tag.
  2. Inline any css code
  3. Within css, embed images as a data-url using a base64 encoding.
If all images in your app are referenced from css files, the end result is a monolithic html file that can be used to deploy your application. The Dart code in your page will be executed asynchronously when the browser triggers the DOMContentLoaded event.

Work in progress

The following is still pending to be implemented in htmlconverter.py:
  • Support heavy isolates: currently the tool inlines all script tags in the html page. Heavy isolates can only be spawned from scripts that are loaded via a URL (a restriction derived from web workers).
  • Implement support for multiple isolates in the HTML page. This includes:
    • Allow multiple script tags in a page, mapping each script to an isolate.
    • Introduce an isolate discovery mechanism (e.g. a registry), so that top-level isolates don’t have to use window.postMessage to communicate.

Libraries

Dart will provide the following libraries to support web and web server development:
Core Library
Contains interfaces to support common data structures and operations.
DOM Library
Contains interfaces to the HTML5 DOM, loosely based on the proposed HTML5 standard as specified by the W3C/WHATWG. These interfaces will evolve in parallel with the HTML5 standards.
Here is an overview of the interface hierarchy for the current Core Library (subject to change):

MIME type

You will be able to embed a Dart program directly on an HTML page, or you will be able to use a #import or #source statement to pull in external files. Here is the proposed new MIME type, “application/dart”:
<html>
  <body>
    <script type="application/dart">
      main() {
        Element element = document.getElementById('message');
        element.innerHTML = 'Hello from Dart';
      }     
    </script>
    <div id="message"></div>
  </body>
</html> 

Run Dart code in several ways

You will be able to run Dart code in several ways:
  • Translate Dart code to JavaScript that can run in any modern browser:
    Chrome, Safari 5+, and Firefox 4+ (more browser support coming shortly).
  • Execute Dart code directly in a VM on the server side
  • Use Dartboard to write, modify, and execute small Dart programs within any browser window

Optional types

Dart provides, at the programmer’s option, a mixture of static and dynamic checking. When experimenting, the programmer can write untyped code for simple prototyping. As the application becomes larger and more stable, types can be added to aid debugging and impose structure where desired.
For example, here is a sample of untyped code in Dart that creates a new Point class that has parameters x and y and two methods: scale() and distance().
 
class Point {
  var x, y;
  Point(this.x, this.y);
  scale(factor) => new Point(x*factor, y*factor);
  distance() => Math.sqrt(x*x + y*y);
}

main() {
  var a = new Point(2,3).scale(10);
  print(a.distance());
}

Here is what this code looks like with types added that ensure that x, y, and factor are of type num, and that a Point contains two values of type num:

class Point {
  num x, y;
  Point(num this.x, num this.y);
  Point scale(num factor) => new Point(x*factor, y*factor);
  num distance() => Math.sqrt(x*x + y*y);
}

void main() {
  Point a = new Point(2,3).scale(10);
  print(a.distance());
}

Classes and interfaces

Dart’s interfaces and classes provide you with a set of reusable and extensible building blocks. An interface defines a basic set of methods and constants, sometimes by inheriting from other interfaces. A class can implement multiple interfaces, but it only inherits from a single superclass.
The following example defines an interface, along with a class and subclass that implement it:

interface Shape {
  num perimeter();
}

class Rectangle implements Shape {
  final num height, width; 
  Rectangle(num this.height, num this.width);  // Compact constructor syntax.
  num perimeter() => 2*height + 2*width;       // Short function syntax.
}

class Square extends Rectangle {
  Square(num size) : super(size, size);
}

Design goals

The Dart programming language is presented here in its early stages. The following design goals will guide the continued evolution and refinement of this open source project:
  • Create a structured yet flexible programming language for the web.
  • Make Dart feel familiar and natural to programmers and thus easy to learn.
  • Ensure that all Dart language constructs allow high performance and fast application startup.
  • Make Dart appropriate for the full range of devices on the web—including phones, tablets, laptops, and servers.
  • Provide tools that make Dart run fast across all major modern browsers.
These design goals address the following problems currently facing web developers:
  • Small scripts often evolve into large web applications with no apparent structure—they’re hard to debug and difficult to maintain. In addition, these monolithic apps can’t be split up so that different teams can work on them independently. It’s difficult to be productive when a web application gets large.
  • Scripting languages are popular because their lightweight nature makes it easy to write code quickly. Generally, the contracts with other parts of an application are conveyed in comments rather than in the language structure itself. As a result, it’s difficult for someone other than the author to read and maintain a particular piece of code.
  • With existing languages, the developer is forced to make a choice between static and dynamic languages. Traditional static languages require heavyweight toolchains and a coding style that can feel inflexible and overly constrained.
  • Developers have not been able to create homogeneous systems that encompass both client and server, except for a few cases such as Node.js and Google Web Toolkit (GWT).
  • Different languages and formats entail context switches that are cumbersome and add complexity to the coding process.

Technical Overview - Key features

Dart is a new class-based programming language for creating structured web applications. Developed with the goals of simplicity, efficiency, and scalability, the Dart language combines powerful new language features with familiar language constructs into a clear, readable syntax.

Key features

Key features of the Dart language include:
Classes
Classes and interfaces provide a well understood mechanism for efficiently defining APIs. These constructs enable encapsulation and reuse of methods and data.
Optional types
Dart programmers can optionally add static types to their code. Depending on programmer preference and stage of application development, the code can migrate from a simple, untyped experimental prototype to a complex, modular application with typing. Because types state programmer intent, less documentation is required to explain what is happening in the code, and type-checking tools can be used for debugging.
Libraries
Developers can create and use libraries that are guaranteed not to change during runtime. Independently developed pieces of code can therefore rely on shared libraries.
Tooling
Dart will include a rich set of execution environments, libraries, and development tools built to support the language. These tools will enable productive and dynamic development, including edit-and-continue debugging and beyond—up to a style where you program an application outline, run it, and fill in the blanks as you run.

First information on DART Programming language

Programmer and project leader Lars Bak detailed the project in a talk today at the Goto conference conference today in Denmark and in a blog post. Dart is geared for everything from small, unstructured projects to large, complicated efforts--Gmail and Google Docs, for example.

"If we want to focus on making the Web better over time, we have to innovate," including with new programming languages, Bak said in an interview today.

Google also unveiled a Dart language site including open-source tools for writing Dart programs, code samples and tutorials, supporting libraries of supporting software, the Dart language specification, and forums for discussion.

A month ago, details about Dart raised some hackles about Google's Web technology tactics when an 2010 internal memo about it, then called Dash, surfaced on a mailing list. One tidbit from that memo is that Dart's goal is "to replace JavaScript as the lingua franca of Web development."

Google is a big company, though, and others within the company remain strong JavaScript adherents. And Bak, while not denying Google has big ambitions, was quick to proclaim JavaScript alive and well.

"It's not going to replace JavaScript," Bak said. "JavaScript is is a cornerstone of the Web today, and it will continue to be for a long, long time."

Bak bristled at some of complaints about Google's approach to creating Dart in-house and not through a more collaborative approach.

"I don't buy the argument that before writing any line of code or designing any features, you put it in a standards committee, because that would just be a lot of screaming," Bak said. "You have to have coherent design before you start adopting Dart as a standard."

Making a standard is a goal, though. "It will be fairly lonely to create a standards committee when here's only us in it. We first have to get the backing of other partners before we can make a standard that's useful," he said.

Google is releasing Dart now for the next step in its maturation: outside feedback and participation. "We hope the other browser vendors will be excited," Bak said, adding that today is the first that Google has shared details about Dart with them or others.

Google is evaluating the best way to integrate Dart directly into its Chrome browser, something Bak is keen on. One reason: it will enable a "snapshotting" technology that dramatically improves a Web app's start-up time. Snapshotting involves taking an application and "serializing" it into a single block of data.

    Dart's design goals are:

    Create a structured yet flexible language for Web programming.

    Make Dart feel familiar and natural to programmers and thus easy to learn.
   
        Ensure that Dart delivers high performance on all modern Web browsers and environments ranging from small handheld devices to server-side execution.

    Dart targets a wide range of development scenarios: from a one-person project without much structure to a large-scale project needing formal types in the code to state programmer intent. To support this wide range of projects, Dart has optional types; this means you can start coding without types and add them later as needed. We believe Dart will be great for writing large web applications.
   
    Dart programs will be able to run within a Dart virtual machine--essentially a layer of software that acts as a computer to execute programs. They'll also be able to run using a compiler that translates Dart code into JavaScript code for browsers that don't support Dart, Bak said.
       
        Google's Chrome browser has served as a vehicle to get the company's technology such as WebM and SPDY useful for at least a portion of Web users. Though the 2010 Dart/Dash memo said Google planned build Dart support into Chrome, Bak was cautious about making any definite statements beyond saying browser integration brings benefits. It's notable, though, that Bak led development of Chrome's V8 JavaScript engine, so he's hardly a stranger to the Chrome team or to the challenges of improving Web-app speed.
       
        Building Dart into Chrome could let Google build Dart versions of its advanced Web apps that--if the language lives up to its billing--could be better than those Web apps today.
       
        "Google has a lot fairly big Web applications. That includes Gmail and Docs. I hope many of these apps will be converted into Dart," Bak said--but cautioned that was his personal option, not an explicit plan.
       
        Introducing new programming languages is tough. Though many hope that computing can improve by reforming or replacing languages, the incumbent power of existing languages is strong. Educating thousands or millions of programmers, building developer tools, and creating supporting libraries of code all can take years. As newer languages such as Java, JavaScript, and C# attest, though, it is possible.
       
        Google also is trying to gain a foothold for Go, a programming language geared more for native software that today would most likely be written with C or C++.
       
Dart is designed to address several shortcomings Google sees with Web programming today, according to the Dart technical overview:

Small scripts often evolve into large web applications with no apparent structure--they're hard to debug and difficult to maintain. In addition, these monolithic apps can't be split up so that different teams can work on them independently. It's difficult to be productive when a Web application gets large.

 Scripting languages are popular because their lightweight nature makes it easy to write code quickly. Generally, the contracts with other parts of an application are conveyed in comments rather than in the language structure itself. As a result, it's difficult for someone other than the author to read and maintain a particular piece of code.

 With existing languages, the developer is forced to make a choice between static and dynamic languages. Traditional static languages require heavyweight toolchains and a coding style that can feel inflexible and overly constrained.

 Developers have not been able to create homogeneous systems that encompass both client and server, except for a few cases such as Node.js and Google Web Toolkit (GWT).

 Different languages and formats entail context switches that are cumbersome and add complexity to the coding process.

Wednesday, 5 October 2011

Brain behind Google's Dart Programming Language

Lars Bak : Lars Bak is a Danish computer programmer who currently works for Google where he has contributed to the Chrome browser by developing the V8 JavaScript engine. He now lives near Aarhus in Denmark with his wife and two children.

Bak studied at Aarhus University in Denmark, receiving an MS degree in computer science in 1988 after which he became active in designing and implementing object-oriented virtual machines.
After participating in the design and implementation of the Beta MjĂžlner System, in 1991 he joined the Self group at Sun Microsystems Laboratories in Cupertino, California. During his time there, he developed a programming environment for Self and added several enhancements to the virtual machine.

In 1994, he joined Longview Technologies LLC, where he designed and implemented high performance virtual machines for both Smalltalk and Java. After Sun Microsystems acquired Longview in 1997, Bak became engineering manager and technical lead in the HotSpot team at Sun's Java Software Division where he developed a high-performance Java ME virtual machine for mobile devices.

In 2002, after returning to Aarhus, Denmark, Bak founded OOVM, a company which developed software for mobile phones. In 2004, he sold it to a Swiss company, Esmertec.

In 2004, Bak joined Google to work on the Chrome browser. He did not return to the United States, preferring to work in Denmark where his daughters were also receiving their education. With a team of 12 engineers, Bak has been coordinating the development of the V8 JavaScript interpreter for Chrome, named after the powerful automobile engine.

Bak holds 18 U.S. software patents in the field of virtual machines programming. In 2010, after Oracle bought Sun and with Lars Bak now working for Google, Oracle sued Google for infringing on several software patents and amongst them was the "Interpreting functions utilizing a hybrid of virtual and native machine" patent filed by Lars Bak .Bak has also co-developed the DART programming language to be presented by at the 2011 goto conference in Aarhus, Denmark. 

Gilad Bracha : Gilad Bracha is a software engineer, a co-author of the second and third editions of the Java Language Specification, a major contributor to the second edition of the Java Virtual Machine Specification,  and the creator of the Newspeak programming language.

From 1997 to 2006, he worked at Sun Microsystems as Computational Theologist and, as of 2005,
Distinguished Engineer, on various aspects of the specification and implementation of Java. Following that, he was Distinguished Engineer at Cadence Design Systems from 2006 to 2009, where he led a team of developers designing and implementing Newspeak.  Between 1994 and 1997, he worked on the Smalltalk system developed by Animorphic Systems,  a company that was bought by Sun in 1997.Bracha received his Ph.D. in Computer Science from the University of Utah.

Kasper Verdich Lund :    Software engineer at Google Inc. in the Danish office in Aarhus where I work on V8: Google's high-performance JavaScript engine. V8 is used in Google Chrome and is freely available as open source software under a permissive BSD license.

Software engineer at Esmertec AG where I worked on the OSVM™ platform. OSVM is a secure, object-oriented, serviceable, real-time software platform for embedded devices. The platform enables developers to debug, profile, and update code running on embedded devices in the field, vastly improving reliability and development productivity. It was launched as a product in March, 2005.

Co-founder of OOVM A/S. OOVM A/S (Object-Oriented Virtual Machines) was a privately held venture financed company dedicated to creating a much simpler and more reliable software platform for the embedded software market. See our research paper, which was accepted and selected for the conference journal at the ESUG 2004 conference. OOVM A/S was acquired by Esmertec AG in July, 2004

Software engineer at Sun Microsystems, Inc. where I worked on the CLDC Hotspot™ Implementation. CLDC HI is an open source, optimized Java™ virtual machine that complies with the CLDC specification. It includes dynamic compilation, generational garbage collection, fast synchronization, and unified resource management. See the white paper from Sun for more technical details or browse the source code.

Student programmer at the CPN group at the University of Aarhus where I worked on CPN Tools, an integrated tool for editing, simulating, and analysing Coloured Petri Nets. The user interface is based on advanced interaction techniques, such as toolglasses, marking menus, and bi-manual interaction. See our article published in Petri Nets 2000, 21st International Conference on Application and Theory of Petri Nets.

Mark S. Miller : Mark S. MillerMark S. Miller is an American computer scientist. He is known for his work as one of the participants in the 1979 hypertext project known as Project Xanadu; for inventing Miller Columns; as the co-creator of the Agoric Paradigm of market-based distributed secure computing; and the open-source coordinator of the E programming language. He also designed the Caja programming language.
Miller earned a BS in computer science from Yale in 1980 and published his Johns Hopkins PhD thesis in 2006. Previously Chief Architect with the Virus-Safe Computing Initiative at HP Labs, he is now a research scientist at Google and a member of the EcmaScript (JavaScript) committee.

Monday, 3 October 2011

Future of Dart programming language


Dart vs Java script


Advantage of Dart programmign language


Key words of Dart programming language


How to compile and execute/run Dart programming language

Please follow the instructions in the PreparingYourMachine page.

Building everything

Follow the steps in GettingTheSource to retrieve everything (use all.deps). You will end up with a tree that looks like this:
   dart/
     client/
     compiler/
     corelib/
     language/
     runtime/
     tools/
     ...
then, from the dart directory use the build.py script under tools/:
$ cd dart
$ ./tools/build.py --arch=ia32
We recommend that you use a local file system at least for the output of the builds. If your code is in some nfs partition, you can link the out directory to a local directory:
$ cd dart/
$ mkdir -p /usr/local/dart-out/
$ ln -s -f /usr/local/dart-out/ out

Testing

All tests are executed using the test.py script under tools/. You can run all tests as follows:
$ ./tools/test.py --arch=ia32,dartc,chromium
You can run a specific test by specifying it's full name or a prefix. For instance, the following runs only tests from the core libraries:
$ ./tools/test.py --arch=ia32,dartc,chromium corelib
the following runs a single test:
$ ./tools/test.py --arch=ia32,dartc,chromium corelib/ListTest

Troubleshooting and tips for browser tests

  1. If a test fails, run it again individually, passing also -v --keep_temporary_files
  2. To probe the test failure with a debugger, grab the URL printed by the test, load it in Chrome, and go at it with Dev Tools.
    • Note: the generated html test is deleted unless you specify --keep_temporary_files when running test.py.
    • Tip: in the Scripts tab's lower left is a "stop sign" icon you can use to break on any exceptions in your test.
Some common problems you might get when running tests for the first time:
  • some fonts are missing. chromium tests use DumpRenderTree, which needs some sets of fonts. See LayoutTestsLinux for instructions in how to fix it.
  • no display is set (e.g. running tests from an ssh terminal). DumpRenderTree is a nearly headless browser. Even thought it doesn't open any GUI, it still requires to have an X session available. There are several ways to work around this:
    • use xvfb:
    • xvfb-run ./tools/test.py --arch=chromium ...
    • other options include, using ssh X tunneling (ssh -Y), NX, vnc, setting up xhost and export the DISPLAY environment variable, or simply run tests locally

Building the standalone VM

Follow the steps in GettingTheSource to retrieve the standalone VM (use standalone.deps). You will end up with a tree that looks like this:
   dart/
     corelib/
     language/
     runtime/
     standalone.deps/
     tests/
     third_party/
     tools/
then, from the runtime directory use the build.py script under tools/:
$ cd dart/runtime
$ ../tools/build.py --arch=ia32
We recommend that you use a local file system at least for the output of the builds.

Testing

All tests are executed using the test.py script under tools/. You can run all tests as follows from the runtime directory:
$ ../tools/test.py --arch=ia32
By default the build and test scripts will select the debug binaries. You can build and test the release version of the VM by specifying --mode=release or both debug and release by specifying --mode=all on the respective build.py and test.py command lines.

How to install Dart Programming language

How to  install Dart Programming language.
Dart is built using much of the same tools as Chromium, so the steps here are similar to what you'll find for setting that up. If your machine is already setup to build Chromium you should be good to go and can skip the steps below.
If you want to use git, install that, along with git-svn (which should be included with your git install).

Linux Machines

  1. Install the Linux build prerequisites. In particular you might need to install the 32-bit libraries on a 64-bit Linux system by following the Automated Setup instructions:
  2.   $ wget http://src.chromium.org/svn/trunk/src/build/install-build-deps.sh
      $ source install-build-deps.sh
  3. Install depot tools, adding it to your PATH environment variable:
  4.   $ cd <directory where you want the depot_tools to live>
      $ svn co http://src.chromium.org/svn/trunk/tools/depot_tools
      $ export PATH=$PATH:`pwd`//depot_tools
Other notes:
  1. If the include directory /usr/include/openssl/ is missing, you need to install the libssl-dev package (sudo apt-get install libssl-dev).
  2. More details can be found in chromium's build instructions for linux.

Mac Machines

  1. Install Xcode (we highly recommend Xcode 3.2)
  2. Install depot_tools by following the Chrome Mac Build Instructions.

Windows Machines

Development on Windows is currently only just getting started. You can try by setting up your machine according to the Chromium Windows build instructions. All you really need from there is a version of Visual Studio and the depot_tools.

Dart programming language from Google

After the release of GO Lang from Google on 2009, we didnt hear any thing from our search giant.May be the last one that I head is appengine supports the Go lang , mean while the cost of appengine increased like anything. Every one was busy with Android and the Motorola's acquisition by Google.  So what is DART ? No idea. They are not ready to reveal any thing till October . On October they may release the brief on GOTO developers conference . May be that conference may be for this new programming languages release. But we may expect this may change the web programming or no one cares.
Thinking +ve , the key people involved are Lars Bak , who worked for Sun many years , who owns dozens of patents and Gilad Bracha , a veteran of SAP Labs . The only thing that we can think is the new language, is purely for web and will need Chrome / Android . Bracha blogs mentioned that “However, Javascript remains a seriously limited language for platform implementation. Here are some of the problems.Concurrency primitives. There aren’t any.”  So are they targeting Oracle’s Java? One thing by reading Bracha’s blog , I felt that , this Dart is a language that has the capability of communicating to the machine directly like C and in the same time it can play around with Web.