Google Targets Mobile Back-End Development
With front-end mobile coding taken care of in the recent release of Android Studio 2.3, Google targeted cloud-based back-end development at its recent Google Cloud Next '17 conference.
While the show addressed cloud development in general, Google's mobile focus was exemplified by new serverless computing initiatives that provide back-end functionality for Android, iOS and Web apps.
These include an update to Google App Engine -- its nine-year-old serverless runtime environment -- and a public beta of the brand-new Google Cloud Functions, "a completely serverless environment to build and connect cloud services without having to manage infrastructure."
Here's a look at both.
Google App Engine
Launched in 2008, the promise of Google App Engine is to "build scalable Web and mobile back-ends in any language on Google's infrastructure."
It does that by providing a fully managed platform to which developers can bring their own language runtimes, frameworks and third-party libraries. Google said it completely abstracts the backing infrastructure functionality for apps -- scaling for traffic, load balancing, health-checking and more -- so developers can focus on the code.
Using the platform, developers can call APIs to provide managed services such as access to SQL and NoSQL databases; monitoring and diagnostic tools; Cloud Pub/Sub messaging and streaming data; and other dev tools.
In a blog post, Google cloud exec Brian Stevens cited openness and developer choice in announcing an expansion to App Engine focused on the product's promise to developers: "bring your code, we'll handle the rest." Now, that code can come in many more programming languages.
"App Engine now supports Node.js, Ruby, Java 8, Python 2.7 or 3.5, Go 1.8, plus PHP 7.1 and .NET Core, both in beta, all backed by App Engine's 99.95 percent SLA," Stevens said. "Our managed runtimes make it easy to start with your favorite languages and use the open source libraries and packages of your choice. Need something different than what's out of the box? Break the glass and go beyond our managed runtimes by supplying your own Docker container, which makes it simple to run any language, library or framework on App Engine."
Those Docker containers can also be used to deploy apps to any supported environment, even those not housed in the Google Cloud Platform.
App Engine SDKs are provided for Go, Java, PHP and Python. Developers can learn more about Google App Engine in the documentation and pricing sites.
Google Cloud Functions
Stevens characterized Google Cloud Functions as being "up one level from fully managed applications" handled by App Engine. The new serverless environment was launched as a public beta service.
Like App Engine, it's based on serverless computing, wherein back-end services can spin up program logic on-demand, triggered by events that can originate from various sources.
"Cloud Functions provides a connective layer of logic that lets you write code to connect and extend cloud services," its site says. "Listen and respond to events such as a file upload to Cloud Storage, an incoming message on a Cloud Pub/Sub topic, a log change in Stackdriver Logging, or a mobile-related event from Firebase. Cloud Functions augments existing cloud services and allows you to address an increasing number of use cases with event-driven code."
In response to those changes or events, the service can do light data processing or handle extract, transform and load (ETL) jobs, for example. It lets developers leverage the microservice approach of using one-function units of code below the level of entire applications, containers or virtual machines.
As Stevens implied, Google Cloud Functions are part of the company's Firebase back-end-as-a-service offering it acquired in 2014. Google says Google Cloud Functions provides "the programmatic glue for Firebase and cloud services."
The Firebase SDK provides a host of back-end services, such as analytics, remote config, crash reporting, test lab, notifications, dynamic links, invites, authentication, database, AdWords (acquisition), AdMobs (monetization) and more.
"Mobile app developers can use Cloud Functions directly from Firebase, Google Cloud's mobile platform," the service's site says. "Firebase natively emits events to which Cloud Functions can respond." Those can be any of a number of different events, such as conversions reported by the analytics component, changes to data in the Realtime Database, new user signups reported by Authentication and uploads to Storage and more.
Here's the lifecycle for a Cloud Function for Firebase:
- The developer writes code for a new Cloud Function, selecting an event provider (such as Realtime Database), and defining the conditions under which the Cloud Function should execute.
- The developer deploys the Cloud Function, and Firebase connects it to the selected event provider.
- When the event provider generates an event that matches the Cloud Function's conditions, the code is invoked.
- If the Cloud Function is busy handling many events, Google creates more instances to handle work faster. If the Cloud Function is idle, instances are cleaned up.
- When the developer updates the Cloud Function by deploying updated code, all instances for the old version are cleaned up and replaced by new instances.
- When a developer deletes the Cloud Function, all instances are cleaned up and the connection between the Cloud Function and the event provider is removed.
Developers can learn more about Cloud Functions for Firebase in the documentation and pricing pages.
David Ramel is editor in chief of Visual Studio Magazine and Application Development Trends Magazine.