Over a million developers have joined DZone.

A Programming Guru Discusses Mobile and Cloud

DZone's Guide to

A Programming Guru Discusses Mobile and Cloud

· Cloud Zone ·
Free Resource

Learn how to migrate and modernize stateless applications and run them in a Kubernetes cluster.

Introducing John Waters
  1. I sat down with a very talented and experienced developer from Falafel Software (http://falafel.com).
  2. His name is John Waters and he has created EventBoard, a conference scheduling and management system that leverages a wide variety of technologies, including Windows Phone, Windows 8, Windows Azure (Microsoft Cloud), iOS, and Android - to name a few.
    1. You can reach him at john@falafel.com
  3. We talked about how EventBoard has evolved to meet the needs of the some of the world's largest conferences.
  4. We also talked about how EventBoard is engineered.
  5. I hope to explain his successes, his challenges, and some lessons along the way.

The bad news - no client code-reuse
  1. Code re-use among Android, iOS, and Windows Phone is non-existent.
  2. Theoretically, you could use something like Mono or Xamarin and code in C#.
  3. John stressed that using cross platform dev tools wasn't an ideal scenario because the goal is to leverage a given platforms native look and feel, not to mention its native language, frameworks, and IDEs.
  4. Falafel separately managed EventBoard's application lifecycle, storage, networking, and graphical interfaces for iOS, Android, Windows Phone and Windows 8.
    1. Luckily there is huge re-use for Windows Phone and Windows 8
  5. With that said, there is pattern re-use in terms of architecture, but that is about it.

Client and Cloud Architectures
  1. Our conversation began with a discussion of the MVVM pattern used in their client applications. The Model View ViewModel (MVVM) is an architectural pattern used in software engineering that was developed at Microsoft as a specialization of the presentation model design pattern introduced by Martin Fowler. The reasons developers use the MVVM pattern are:
    • It provides of excellent separation of concerns, allowing your code to evolve elegantly overtime and to support the automated testing of code.
    • It is used by modern UI development platforms which support Event-driven programming, such as HTML5, Windows Presentation Foundation (WPF), Silverlight, Windows Phone, and Windows 8.
  2. A quick explanation of MVVM
    • Model is where the main business data/objects live, including speakers, sessions, rooms and so on. ViewModel is where the business logic resides, handling such things as the registration process, the notification system, and the scheduling - to name a few.
    • The ViewModel also binds the business objects to the user interface (the View).
      • It is also the place where the eventing system gets implemented, taking advantage of the INotifyPropertyChanged semantics.
    • Finally, the View is the graphical interface the user enjoys while using the application.

The Cloud - Windows Azure
  1. The one common denominator, the one magic glue to keep all these technologies supplied with latest conference data is the cloud.
  2. All devices and all software can communicate with the cloud.
  3. Windows Azure is based on open standards and this makes it possible to create one back-end service, dramatically simplifying the support of multiple devices.
  4. Specifically, EventBoard takes advantage of cloud-hosted REST endpoints supported by OData.
  5. I've talked about this extensively here:
  6. EventBoard also leverages a SQL Database (formerly SQL Azure), Content Delivery Networks, and Blob storage.
  7. Windows Azure is a thorough and extensive platform.

Odata - What is it?
  1. The purpose of the Open Data protocol (hereafter referred to as OData) is to provide a REST-based protocol for CRUD-style operations (Create, Read, Update and Delete) against resources exposed as data services.
  2. OData is the web-based equivalent of ODBC, OLEDB, ADO.NET and JDBC. It provides a generic way to perform CRUD operations using http and abstracts away everything that is language or platform specific.
  3. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores.
  4. OData is published by Microsoft under the Open Specification Promise so that anyone that wants to can build servers, clients or tools without royalties or restrictions. You can read more here: http://www.odata.org/.
  5. A data service with respect to EventBoard is an endpoint where there is data exposed from one or more collections each with zero or more entries, which consist of typed named-value pairs.
    1. This allows EventBoard to perform any type of data operation from any type of client, cleanly and easily.

Notification Services - There's more than one
  1. EventBoard can get data in two ways. The first way is that it can simply ask for data by making a web request. This is often referred to as a pull approach. The second way EventBoard can get data is to use push notifications.
  2. We have already addressed the pull approach by describing the RESTful queries based on OData.
  3. Push notifications are initiated by the cloud. Before the EventBoard applications can receive push notifications, they must register themselves with various push notification services.
  4. Oftentimes push notifications result in a pull request from an EventBoard application. This means that once the EventBoard application gets a push notification, it knows it needs to then request data from the cloud using a Pull approach. It's the cloud saying, "Ask for more data by issuing a web request."
  5. Unfortunately, there is no widely accepted standard for push notifications
  6. Notification Services is a core technology to understand for today's modern developer. It allows your mobile device to receive data without specifically requesting it. In the Windows Phone and Windows 8 application scenarios, it can be used to provide live updates to tiles. Notifications enable you to manage the flow of information between users, applications, online sites, and services.
  7. EventBoard uses this functionality to warn attendees of last minute schedule or speaker changes for existing or new sessions.

There are numerous notification services that are needed to support all these device types.
  1. This table should help you understand how these notification services map to device types.
  2. When a notification needs to be sent to a mobile device, the worker role in Windows Azure checks the SQL Database. A worker role is a background process running in the cloud.
  3. When a conference attendee registers with system, the device type used by the attendee is stored in the cloud (SQL Database).
  4. For example, an iPhone might be device type 2 and Android might be defined as device type 3.
  5. Along with the device type, EventBoard keeps track of the platform specific 'handle' needed to reach that device, it could be an opaque byte array (Apple), or a URI (Microsoft and Google).
  6. The device stores this device handle in the cloud by calling a REST service when it first registers itself.
  7. Later, when Worker role (background process running in the cloud) needs to send messages, it can retrieve this information and then call the correct Notification Service for each subscriber.
  8. The notification services follow similar patterns, but differ in many ways.
    • For instance, Apple's APN is a binary, sockets protocol, whereas the others are HTTP based.
    • Microsoft's Push Notification Service is simple, whereas Windows Notification Service adds some additional layers of security, requiring a little more configuration, and an OAuth handshake.

The Portable Library
  1. The portable library greatly simplifies the process of supporting a single binary code base (an assembly or dll) for use by multiple client libraries, including Silverlight, Windows Phone and Xbox 360.
    • At this time, however, Windows 8 does not support this library, so John had to create a separate assembly for Windows 8 clients.
  2. It essentially allows helps you avoid custom build scripts or #defines.
  3. Portable libraries enable you to easily share code between apps that target different platforms.

Threading has historically been a programmer's nightmare.
  1. Race conditions, deadlocks, and resource contention represent problems that developers spend inordinate and vast amounts of time. Up until recently developers had to worry about mutexes, semaphores, monitors and events to write concurrent code.
  2. When I was a field engineer at MS, the most difficult and expensive problems to solve related to concurrent programming problems.
  3. The latest versions of the .NET framework allow the developer to conceptualize an application as a collection of parallel tasks. Deep inside the framework and hidden from the developer is all that nasty, error prone code, elegantly managed by the .NET runtime and the compiler.
  4. The .NET framework 4.5 is the next step in the evolution of concurrent programming on the MS stack. John Waters is delighted about these efficiencies with the newer frameworks. With Visual Studio 2012 and the .NET Framework 4.5, developers can decorate function calls and method signatures using such keywords as async and await.
  5. Async is used to decorate method signatures and indicates to the framework that the method is part of an asynchronous call chain.
  6. One of the challenges is that all the methods in the call chain need the async keyword. This can be a problem if the first caller in the chain is a property. Properties cannot be decorated with the async keyword. This means the following code is currently not legal:
    1. public async int MyProperty { get; set; }
    2. The async keyword is not allowed.
  7. So John had to perform some refactoring to overcome the current limitation in the framework. With that said, leveraging Task-based threading approaches has been an incredibly powerful technique to concurrent programming.
  8. Be sure to try the same technologies as John. Just click below.

Free 90-day trial for Windows Azure


Visual Studio 2012 RC For Windows 8



Call to action
  1. Hope you've enjoyed this post. If so, let me know by writing some comments.
  2. If you've developed some interesting code on the Microsoft stack, let me know.
  3. I'll interview you.
  4. It's a chance to spread your wisdom and increase your visibility.
  5. Contact me at bterkaly@microsoft.com

Join us in exploring application and infrastructure changes required for running scalable, observable, and portable apps on Kubernetes.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}