Friday, December 8, 2017

DevOps in the Cloud

DevOps is an emerging trend that has the attention of many companies today. DevOps stands for Development & Operations. It’s an approach were development, operations and quality assurance is combined within one team. One team responsible for all tasks involved to maintain a solution during the whole lifetime. This is a challenging task for one team, so why are companies interested in this approach?


There are several reasons why companies are interested in DevOps. Probably the most important reason is the demand for faster software releases fueled by the prominent appearance of IT solutions in our daily lives. Non-IT companies now also become vendors of IT solutions in addition to consumers. IT solutions are delivered more and more as a service in an agile way instead of a product nowadays. Another reason is the notion that working together in developing and maintaining a system allows to release unplanned functionality and fixes more quickly and with less failures. Overall it gives more control and trust in maintaining solutions compared to a silo approach having run and change departments separated.
So, how exactly can DevOps being applied to shorten the release time while keeping quality up? There are three key factors that can help to accomplish this. The first key factor is agility. All stakeholders from business people to developers and maintenance engineers will have to change to an agile mindset. Working together in an agile approach like scrum. The second key factor is automation. Automate everything is the credo. Through automation every step in the process from building and testing to releasing and deploying can be done in a predictable and repeatable way. The third key factor is monitoring. Whenever something fails in production or anywhere in the development pipeline, all relevant stakeholders should be informed to take action immediately.
Cloud solutions were initially designed to outsource data centers, but they evolved into much more than that. Implementing these key factors can of course be done in any environment, but cloud solutions are especially good in it. This not only holds for public cloud solutions. A private or hybrid cloud solution is also possible, allowing to keep code, tools and services on premise when desired.

Let’s see how these key factors are supported in cloud platforms.
Agility
Cloud platforms offer a complete online development environment, support for work item tracking, code and component repositories, online and locally installed IDE’s, build and release pipelines, test tools and dashboards. Scrum is fully supported through Scrum and Kanban boards, issue and change management, backlog, sprint planning and burndown, etc.
Automation
All operations like creating environments, making releases, doing deployments, performing automated tests and tear down environments can be automated. The build and release pipeline can be fully customized giving the opportunity to implement continuous delivery and deployment. For example, when a new piece of code is committed by a developer, the following steps may be performed automatically:
  • the build server is triggered to build it;
  • an environment including virtual machines, databases and other services needed can be created;
  • a software release can be created, available for everyone to deploy;
  • the release can be deployed to the newly created environment;
  • automated tests can be run;
  • the environment can be tear down after usage, limiting the costs involved;
  • the software can be promoted to production if desired.


Monitoring
Cloud solutions offer many dashboards out of the box, to monitor both the development pipeline and running services. Additional instrumentation of code gives the possibility to log detailed information. Based on this information, triggers can be implemented to respond to any event in a flexible way.

Because cloud solutions matured at the same moment in time the need for DevOps appeared, features for DevOps have been taken into account for cloud platform features. This makes cloud solutions a good choice for DevOps teams.

Monday, September 17, 2012

A multiplatform Mobile Architecture for iOS, Android and Windows

The need for native mobile apps
Mobile applications are important these days for companies to strengthen the relation with their customers and employees. More and more people use smartphones and tablets instead of PCs for anything you can think of, like socializing, entertainment, shopping or looking for a new job. And people demand the best apps to do this. They prefer native apps (or at least the apps should feel that way), because this gives the best user experience on their mobile devices. This makes it very important for companies to do their mobile applications right.

The challenge from a development point of view is: how to build the best apps for the users, while still be able to address as much target mobile OS platforms as possible. One way to do this is to use one of the many multiplatform frameworks available to build mobile apps from one code base. To accomplish this, often Javascript/HTML5 or lightweight programming languages like Lua are used. Furthermore, these frameworks give access to common functionality like the camera, accelerometer, geolocation, compass, network and storage in a generic way. However, the disadvantage of this approach may be twofold. It is not always possible to gain the best user experience on every platform and also the development experience remains behind by the available native development environments.

Platform-independent architecture
As an alternative, multiple OS platforms can be targeted from one code base using a flexible platform-independent architecture for mobile clients. In this architecture all presentation and business logic is realized in portable platform-independent components, while the UI views and the platform-specific services are realized in platform-specific components (see figure 1). Dependency injection is used to dynamically bind the platform-specific components to the portable components. The idea is to implement as much application logic in a portable way as possible, and at the same time realize the best user experience with native views and services for each platform.


Figure 1: layered architecture

To realize the portable components in this layered architecture, .NET is a suitable technology that offers platform-independent development and runtime environments. C# and the CLI is an open standard (see http://msdn.microsoft.com/en-us/netframework/aa569283) that is available for iOS (MonoTouch), Android (Mono for Android) and Windows.The platform-specific components bridge the gap to native functionality using the invocation of native Objective-C libraries on iOS and Dalvik runtime libraries on Android.

The Model-View-Presenter pattern
A suitable multiplatform design pattern that can be used for all mobile platforms is the Model-View-Presenter pattern. This pattern is heavily used for mobile apps on multiple platforms. It offers good separation of concerns for user interface, application orchestration, presentation and business logic, and platform services. Figure 2 shows how the Model-View-Presenter pattern can be applied in a multiplatform mobile architecture. The blue classes are the platform-specific classes, while the yellow classes are platform-independent and can be used on multiple platforms unchanged.

 Figure 2: Model-View-Presenter pattern

A description and the responsibilities of the classes shown in figure 2:

ApplicationContainer
Platform-specific class that is responsible for hosting the application for a specific platform. It instantiates the Application class and arranges the bindings for the platform-specific views and services needed. See the next paragraph for more information about dependency injection binding.

Application
Platform-independent class that implements the application. This class is responsible for the application functionality at a workflow level and for the orchestration between views. This class aggregates the Model from the Model-View-Presenter pattern, which is represented by the BusinessEntity class.

Presenter
Platform-independent class that implements the presentation logic for a view that is accessed via a specific IView interface. The model used by the presentation logic, represented by the BusinessEntity class is directly accessed via an association. User interaction that results in orchestration between views is reported to the Application class via a callback or an event.

ServiceFactory<IView>
Platform-independent association class to dynamically bind the IView interface with the platform-specific View implementation.

IView
Platform-independent interface which is specifically designed per view to interact between a platform-specific View class and a platform-independent Presenter class. The View class  interacts with the Model directly for simple data-binding and updates. (This is the Supervising Controller variant of the Model-View-Presenter pattern as opposite to the Passive View variant, wherein all interaction with the Model is done only by the presenter.) This offers more freedom to vary the UI implementation across multiple platforms.

View
Platform-specific class that is responsible to realize a screen, multiple screens or part of a screen. User interaction that results in presentation logic is reported to the Presenter class via a callback or an event.

BusinessEntity
Platform-independent class that actually represents the Model in the Model-View-Presenter pattern. The model consists of multiple business entity classes that contain the business logic of the mobile application. Implementing the business logic in separate business entity classes gives an additional advantage. It offers the flexibility to move the business logic to a mobile web client or business service implementation on the server side when desired. Platform-specific services, devices and data are accessed via specific IService interfaces.

ServiceFactory<IService>
Platform-independent association class to dynamically bind the IService interface with the platform-specific Service implementation.

IService
Platform-independent interface which is specifically designed to interact with a specific platform-specific Service that is needed in the mobile application. It is not necessary to expose complete platform services, but only implement the APIs actually needed for the mobile application in an agile way.

Service
Platform-specific service that realizes the integration with specific platform or MEAP (Mobile Enterprise Application Platform) services, web services, data access and storage, devices and more. These service realizations will be kept small, because only the APIs are exposed which are actually needed for the mobile application involved. Note that a lot of platform services are exposed in an uniform way for multiple platforms, which makes it possible to also share service components across those platforms.

Dependency Injection binding
Dependency Injection is a design pattern that offers the possibility to dynamically bind the consumer of an interface or component to the implementation. Many frameworks are available for dependency injection that can be used in this architecture. However, because not much is needed to implement the ServiceFactory<> template class for this mobile architecture, a simple .NET example implementation is listed here.

using System;
using System.Collections.Generic;

namespace Mobile.Common.Framework
{
    public sealed class ServiceFactory<TServiceInterface>
        where TServiceInterface : class
    {
        // Nested types.
       
        /// <summary>
        /// This interface enables the access of the binding independent
        /// of type.
        /// </summary>
        private interface IBindingInterface
        {
            /// <summary>
            /// Create a new instance of the type bound to the interface.
            /// </summary>
            /// <returns>The interface for this service.</returns>
            TServiceInterface Create();
        }

        /// <summary>
        /// The template used to handle the current binding.
        /// </summary>
        private class Binding<TBindingType> : IBindingInterface
            where TBindingType : class, TServiceInterface, new()
        {
            /// <summary>
            /// Create a new instance of the type bound to the interface.
            /// </summary>
            /// <returns>The interface for this service.</returns>
            public TServiceInterface Create()
            {
                return new TBindingType();
            }
        }

        // Private members.
        static private IBindingInterface _binding = null;
        static private TServiceInterface _instance = null;

        private ServiceFactory(){}
       
        /// <summary>
        /// Bind type to this interface.
        /// </summary>
        /// <typeparam name="TBindingType">Type to be bound.</typeparam>
        static public void Bind<TBindingType>()
            where TBindingType : class, TServiceInterface, new()
        {
            _binding = new Binding<TBindingType>();
        }

        /// <summary>
        /// Bind instance to this interface.
        /// </summary>
        /// <param name="instance">Instance to be bound.</param>
        static public void Bind(TServiceInterface instance)
        {
            _instance = instance;
        }

        /// <summary>
        /// Retrieve one and only instance.
        /// </summary>
        /// <returns>The instance.</returns>
        static public TServiceInterface GetInstance()
        {
          if (_instance == null)
          {
              if (_binding != null)
              {
                  // Create bound type.
                  _instance = _binding.Create();
              }
          }

          return _instance;
        }
    }
}
Code listing 1: The ServiceFactory<> template class

    ServiceFactory<IMyInterface>.Bind<MyImplementation>();

Code listing 2: Binding the interface in platform-specific code

    IMyInterface myService = ServiceFactory<IMyInterface>.GetInstance();

Code listing 3: Using the interface in platform-independent code

Sunday, June 19, 2011

Mobile Architecture for Enterprise Applications

It is widely expected that revenue from mobile solutions will grow rapidly in the comming years. People are getting used to have access to their apps and data anywhere and anytime. Not only as a consumer, but also when doing business. Enterprises are under pressure to make their applications and data available on all kinds of mobile devices. To do this they have to make some key decisions about the solution architecture, like native client vs. thin client, developing for target mobile operating systems or using a multiplatform framework, supporting multiple clients or a dedicated device, how to manage access and devices. 

The following picture gives a high-level Mobile Architecture for Enterprise Applications that can be used as a reference during solution crafting of a more detailed Mobile Architecture. 

Mobile Architecture for Enterprise Applications

The following list contains the elements of this architecture and gives areas of concern for mobile design.

Mobile Enterprise Application Platform (MEAP)
A Mobile Enterprise Application Platform offers middleware with standard solutions for common functionality across server and clients on multipe devices. When supporting more than one application or targeting more than one device type a MEAP is a efficient solution to make enterprise applications and data available in a uniform way.

Mobile Clients

Native Application
Specialized application for target device.
Business logic locally installed.
May be created with multiplatform development framework.
Hybrid Application
Specialized host for online content featuring native look-and-feel.
Multiplatform.
Web Application
Browser based multiplatform.
HTML5 is the technology for the near future.

Device Security
Access Control.
Data encryption.

Device Specific Hardware
Handling variations in screen size and orientation.
Limited CPU, memory, storage: processing power devoted to user experience, heavy processing moved away from the device.
Accelerometers, GPS, haptic feedback (touch, force, vibration), compass, camera, fingerprint readers.

Local Data Storage
Limited resources.
Tradeoff between local data storage and connectivity limitations.

Communication

Optimized for mobile application to save mobile bandwidth and reduce processing power needed on the mobile device. 

File Transfer
Data Synchronization
Secure Communication
Connectivity Limitations
Occasionally connected.
Limited-bandwidth.

Mobile Access Infrastructure
Mobile Access can be integrated in Enterprise Application Servers or as separate Mobile Access Servers.
Reasons for separate Specific Mobile Access Servers may be security reasons, to manage mobile devices or to access legacy systems.

Mobile Portal Server
Offers content for mobile hybrid applications.
Mobile Web Application Server
Web Application Server for applications specialized for mobile devices.

Device Management
Configuration management.
Stolen/list devices (swipe data).
License management.
Remote control.

Access Control
Authentication.
Authorization.

Database
Optimized for data synchronization over limited bandwidth.