2nd Generation Maintainability
Abstract
Maintainability is the highest cost component of computer software. This article will be of interest to those IT professionals responsible for software development budgets.
An enterprise can deploy a 2nd Generation Maintainable architecture into their app development projects to avoid the need to set up a separate app development team, significantly reducing the lifetime costs of their app(s) and reducing demands to engage specialist app development resources.
What is 1st Generation Maintainability?
‘Maintainability’ is the probability that a software system can be fixed or changed in a set period of time with a variable resource pool. It is this last component, “variable resource pool”, that is the focus of this article, because it is this component that has the most impact on the cost of a system, not the development cost.
As software professionals, traditionally software maintenance meant writing code that was readable, well designed, logical, compartmentalised, used encapsulation, polymorphism and inheritance and was generally self-documenting. This is 1st Generation Maintainable and essential in any IT system.
2nd Generation Maintainability is not new but with the current onset of enterprise app development it has become more and more pertinent to define the term and use the technology. Native cross-platform app development (mainly iOS and Android) is now a reality and enterprise productive benefits are now becoming common place through apps, driving the demand for app development resources.
Increasingly enterprises are introducing app development teams and even departments, but is it necessary? As an enterprise, are the functions of your apps that different to your desktop equivalent? If you have a team of C# .Net resources and you can build your apps in C# .Net, do you really want to employ new resources? Ok, so you may want to augment your existing capability short term to build your mobile capability quickly, but do you want to employ a separate team to maintain and enhance the system long term?
To address these issues it is important to architect your app(s) for resource segregation so that you can utilise existing resources to enhance and maintain your system rather than rely on specialist resources. This is called 2nd Generation Maintainability.
What 2nd Generation is not
Your organisation will have done its investigation into the tools and techniques for developing apps, coming up with recommendations of what is going to work within the culture and skills of your organisation.
As a minimum you will choose the MVVM design pattern for your user interface layer[1] and most probably you will be using Visual Studio as your development platform, but apart from that everything else will be organisational specific. There are components that are common choices like using a REST interface [2], a local SQLite database [3], Newtonsoft Json [4], Forms for cross platform user interface [5], Unity for your IoC container [6], and a third party MVVM framework [7], and building to a Portable Class Library [8].
These are site specific and are independent of being 2nd generation maintainable.
Secondly, you don’t want to over-engineer your app. It needs to be kept simple so that it is easy to understand, easy to change and hence easy to maintain. Note that many of the concepts that are used regularly within your server systems may not be appropriate for an app.
2nd Generation Maintainability
A detailed technical explanation is outside the scope of this article, but the concepts are pretty straight forward.
Firstly, 2nd generation maintainability means architecting your system taking into account the resources that will be maintaining it:
- Front end resources, including frontend developers, graphics designers and user experience resources.
- Application developers. Your business analysts and application developers that understand and design your systems from a business perspective.
- Technical developers. Your technical staff that have a particular bent for designing the architecture and managing the technically complex aspects of your systems.
Secondly, the architecture will be based on the following three well understood concepts:
- Three tier architecture,
- Object Oriented Analysis and Design (OOAD) (not to be confused with Object Oriented Programming), and
- The Mobile-View-ViewModel (MVVM) design pattern.
Three Tier Architecture was developed by Professor John Donovan in 1993 and is used extensively in most modern software architectures [9]. The original concept was to build three tiers (user interface, business logic and the persistence layer) on separate physical infrastructure so that as one technology changes it can be swapped out without affecting the other two tiers. Although this may still be appropriate in app development (you may want to swap out an SQLite implementation for a NonSQL implementation), the main benefit is that by coupling with Object Oriented Analysis and Design you ensure that much of the technical complexity is
Object Oriented Analysis and Design (OOAD) is a concept developed by Grady Booch, Ivar Rumbaugh and James Jacobson around 1995 [10]. Whereas we use Object Oriented Programming to build our systems, we most often do so without OOAD. The distinction is subtle but critical.
By analysing your application in terms of the real world object (invoice, quotes, credit cards) as distinct from using inheritance, polymorphism and encapsulation to manage the technical complexities within our applications, the technical app specific issues naturally get pushed lower in your architecture.
For example, an Invoice “knows” about itself, so not only does it know about its properties (it knows that its total amount is the sum of its invoice line amounts) and about its business behaviour (it knows how to create itself from a quote), it also knows how to persist itself, and a part of persistence is whether it is in sync with the server.
A simple example and a simple concept, but when coupled with three-tier and MVVM you will find that it frees your application developers from having to understand many of the core technical issues that any app should deal with, significantly simplifying maintenance.
Model-View-ViewModel (MVVM) is a more recent concept developed by Microsoft in 2005 as part of their WPF and Silverlight projects [11]. The key benefit of the MVVM for mobile app development is solving the problem of decoupling the user interface for the plethora of physical devices and their varying screen sizes and resolutions, from the business logic that they will be populated from.
It is not just the ‘binding’ technology that comes with MVVM that is important, it is also important to separate out as much as possible which business logic is important for front end resources, and which business logic is important for your application developers.
Resource Separation
Front-end resources
It is easy to see that front-end developers and graphic designers can build and enhance the look and feel of an app with relative ease by focussing on the “View” of the MVVM pattern. But this is a simple case. Your user experience resources will need to be able to easily modify the page structure independent of the overall functional capability of your system.
It is critical that as much business logic as possible is removed from the ViewModel within the MVVM pattern so that your front-end resources can more easily modify their speciality area. This is the objective of introducing OOAD.
Application developers
Say after the app’s launch you want to introduce a new feature into both your backend system and your app – for example, upon your sales person adding an invoice you want them to be able to make a credit card payment on your customer’s behalf. This is the first enhancement since deployment and the initial development team is no longer available.
There will be some new screens to capture credit card details and indicate which parts of the invoice are to be paid, plus some new business logic on how to process the payment and update the invoice.
The frontend developers will only be concerned with the business logic related to the user interface. The application developer will work with the frontend developers to ensure the right data is captured in the right sequence and that the process for updating the invoice is correct. Neither will have changed or have any concern with how the data is transferred to the server, and hence they should not need to see the technical code or understand it.
This is just one example of why ensuring app specific technical complexities are removed from the business layer is important.
Technical developers
From time to time new device specific technology becomes available. Some may be new features such as a 3D camera or new industry specific image recognition software, and some may be changes to existing technologies like replacing our incredibly slow http technology or the introduction of a new NonSQL database replacing SQLite.
Implementing new technologies is a specialist skill. You may have these skills within your organisation, but equally you may choose not to and contract them in when required. If your architecture has an appropriate level of technical separation then it will be easier to introduce otherwise drastic technical changes at a much lower risk.
Conclusion
The lifecycle of your enterprise’s app(s) is very much longer than the development time. The foundation architecture of your app will dictate the level of resourcing required through the whole lifecycle.
Building in 2nd Generation Maintainability will significantly impact your overall app IT costs, decrease the need to employ app specific developers and potentially increase staff retention by extending in-house career options.
References
1 | Model-View-ViewMode (MVVM) is a User Interface design pattern. https://developer.xamarin.com/guides/xamarin-forms/enterprise-application-patterns/mvvm/ |
2 | Representational State Transfer(REST) or RESTful web services is a way of providing interoperability between computer systems on the Internet. https://en.wikipedia.org/wiki/Representational_state_transfer |
3 | SQLite is a free, public domain, serverless SQL database engine well suited for mobile devices and commonly used with Xamarin applications. https://www.sqlite.org/ |
4 | Newtonsoft is a popular JSON framework for .NET: https://www.newtonsoft.com/. JavaScript Object Notation (JSON) is an XML based format used for data-interchange. http://www.json.org/ |
5 | Xamarin Forms is a library that enables you to build native user interfaces for iOS, Android and UWP from a single, shared C# codebase. https://www.xamarin.com/forms |
6 | Inversion of Control (IoC) is a programming technique in which object coupling is bound at run time. Dependency Injection (DI) is a design pattern that uses this technique. Microsoft Unity is an IoC container which is configured to manage Dependency Injection. https://gridwizard.wordpress.com/2014/05/28/dependency-injection-vs-service-locator/ & https://github.com/unitycontainer/unity |
7 | MVVM Frameworks help you implement the MVVM design pattern. Different frameworks help in different ways, including bindings between the View and ViewModel, navigation and Dependency Injection. Examples include MVVMLight, Prism, FreshMVVM, MVVMCross, ReactiveUI. |
8 | There are a number of ways to share code across different platforms, Portable Class Library is one of these. https://developer.xamarin.com/guides/cross-platform/application_fundamentals/code-sharing/ |
9 | Three Tier Architecture https://en.wikipedia.org/wiki/Multitier_architecture |
10 | Object Analysis and Design: https://en.wikipedia.org/wiki/object-oriented_analysis_and_design |
11 | Origins of MVVM: https://en.wikipedia.org/wiki/Model-view-viewmodel |