SOREN GJESSE: Hello.
My name is Soren Gjesse and I work on the Dart team.
I want to show you why Dart is a great language for building
applications for the cloud.
Dart is a new platform for scalable web application
engineering.
And Dart runs in modern web browsers and on the server.
This provides a great opportunity
to build web applications using the same language
for both client and server, and to utilize the services
provided by the Google Cloud Platform.
Today, I'd like to show you how easy it
is to run your Dart code in Google's data centers,
use App Engine Managed VMs.
That is now a supported language on App Engine.
App Engine scales automatically as your application
gets more and more popular.
App Engine Managed VMs combine the power of App Engine
with the flexibility of running on a general server.
It lets you combine the total control of freedom of computing
and VMs with the auto-management capabilities of App Engine.
Because you're running in a VM, you
can install any additional software.
And there are no restrictions on how
the Dart server can use the machine.
Even accessing your favorite C library
using a native extension is possible.
App Engine Managed VM support local development.
Your development tests locally.
And when you're ready to deploy, the deployment process
make sure that the exact same code
will run in the Google data center.
To get started, you only need a few things.
You need the Google Cloud SDK, which includes a gcloud command
line tool.
And you need the latest version of the Dart SDK and the Dart
Editor.
The process is all well documented on the Dart website,
dartlang.org.
Getting started is easy.
A basic HTTP server application is just a few lines of code.
Import the Dart App Engine package,
start the server application running,
and handle HTTP requests as you already
do with the Dart I/O library.
If you already have a server application written in Dart,
moving it to App Engine only requires
changing a few lines of code.
You can run this code locally using the gcloud app run
command.
And when you're happy with your application,
deploy it by just running the gcloud app deploy command.
This site is providing an HTTP server.
The App Engine package provide APIs to Google Cloud Services.
The initial set of APIs provided are
for accessing Cloud datastore, Memcache, Users API,
and for Logging.
Let's look at the Cloud datastore.
The Google Cloud datastore is a fully managed schemaless
database for storing non-relational data.
Being a schemaless database, it lets you store and entities
having a set of named properties.
To give your app maximum flexibility,
we provide two APIs.
There's a low level API, which allows
you to work with datastore entities
directly as key value map.
On top of this, we've added a mapping layer.
This makes it possible to store concrete instances of data
updates with just a few simple annotations
to indicate how your instance properties should
map to datastore properties.
Let me show you how simple it is to store
an update into the datastore.
First, you need to model how the update is stored.
Let's look at this simple person class.
We want to store the two properties, name and age.
The class defines properties and extends model.
Then the actual description of how this object maps
to the datastore is described using
a subclass of model description.
Note, this defines the types used in the datastore.
It can also be used to define additional information,
like whether the property is mandatory
and whether it should be indexed in the datastore.
With this model description in place,
the model class is annotated with the description,
and the class definitions are all set.
Now storing objects into the data store
is as simple as creating a number of instances.
Here, we create two instances, George and Sarah.
And then we call the data store commit method
to actually store these instances into the data store.
Here we use a Dart asynchronous programming model.
The future return from commit completes
when the commit operation has finished.
If you're familiar with the App Engine Python NDB Datastore
API, this probably looks familiar to you.
This is all open source.
The code is developed on GitHub and is
available as a Dart package using the Dart package manager,
pub.dartlang.org.
Now let's take advantage of code-sharing.
When you use Dart both in the client and on the server,
your front end and backend can share code.
This is great, because this code only has to be written once.
For example, say your client and server communicating
using a JSON-based protocol.
The associated data objects and serialization
and deserialization code is needed on both sides.
Having the updates used the communication defined
in a shared library ensures that both sides share the same code.
There are many other advantages to sharing code
on client and server, like not having to rewrite validation
logic in different languages.
With that on both client and server,
this validation logic can be shared.
How about the case when an application needs to work
offline?
In this case, large part of the code
that is running on the server needs
to be available on the client.
When using the same language in both client and server,
this becomes easier.
The code only needs to be written once
and will always be in sync.
These are simple examples.
A new app, you can find even better uses of this.
Well, this is just the beginning.
We are going to evolve our Dart support for Google cloud.
On the API side, there are still a number
of popular App Engine APIs missing.
And we will be adding more of these.
Another important thing we're working on
is improving Dart access to Google Cloud Services
in general.
Most services, like Google datastore,
is available on most platforms.
It's available Google Compute Engine.
It's available on your own server,
on other cloud provider service, and even in the browser.
We would also be working on making the Google Cloud
Services available in all these platforms,
making your Dart code equally valuable across platforms.
With this information, I hope you're
dying to get started developing you're
Dart application for Google Cloud.
Visit dartlang.org to find more information on how to get
started and start building your Dart application
in the cloud today.