Application Architecture – Getting started

Posted by: Damir Arh , on 10/7/2020, in Category Patterns & Practices
Views: 5214
Abstract: This article is an introduction to understand application architecture for the Microsoft technology stack.

What is Application Architecture?

It’s difficult to find an exact definition for application architecture.

One could argue that it’s a subset of software architecture that primarily focuses on individual applications in contrast to, for example, enterprise architecture, which encompasses all the software inside a company including the interactions between different applications.

Application architecture is responsible for the high-level structure of an application which serves as a guideline or a blueprint for all the development work on that application.

Often people compare it to building architecture. However, there is a very important difference between the two.

Unlike buildings, software changes a lot and is never really ‘done’. This reflects in its architecture which also needs to constantly adapt to changing requirements and further development.

An application architecture should always be based on the requirements as specified by the stakeholders (business owners, users, etc.).

It’s important that this doesn’t include only functional requirements (i.e. what the application needs to do), but also the non-functional ones. The latter is concerned with application performance, reliability, maintainability and other aspects that don’t directly affect its functionality but have an impact on how the application is experienced by its users, developers and other stakeholders.

Editorial Note: Also read Software is Not a Building.

Aspects of application architecture

Architectural decisions are made at different levels.

software-architecture-designs

Figure 1: Architectural decisions at different levels

Typically, the application architecture starts with the choice of the type of application to develop.

Is it going to be a web application, or will it run locally on a device (mobile or desktop)?

The choice will depend on multiple factors:

  • Will the application be used on a computer, on a mobile phone, or both?
  • Will the users always have internet connectivity, or will they use it in offline mode as well?
  • Does the application take advantage of or even require the use of services and sensors available on devices, such as notifications, geolocation, camera, etc.
  • …and so on.

Closely related to the choice of application type, is the choice of technology. Even if you’ve already decided on the .NET technology stack, there are still a lot of choices for all types of applications: desktop, mobile, and web.

You can read more about them in my previous articles for DNC Magazine:

Once you have decided on the application type and the technology stack, it’s time to look at the architectural patterns.

 

Architectural Patterns

They have a role similar to design patterns, only that they are applicable at a higher level. They are proven reusable solutions to common scenarios in software architecture.

Here’s a selection of well-known architectural patterns:

In Multitier architecture, applications are structured in multiple tiers which have separate responsibilities and are usually also physically separated.

Probably the most common application of this architectural pattern is the three-tier architecture that consists of a data access tier (including data storage), a business tier (implementing the business logic) and a presentation tier (i.e. the application user interface).

In Service-Oriented architecture (SOA), application components are implemented as independent standalone services that communicate over a standardized communication protocol.

A standardized service contract describes the functionality exposed by each service. This allows loose coupling between the services and high level of their reusability. When the architecture pattern was first introduced, the most commonly used communication protocol was SOAP.

Microservices are a more modern subset or an evolution of the Service-Oriented architecture (SOA).

 

As the name implies, they are usually more lightweight, including the communication protocols which are most often REST and gRPC. Each service can use whatever technology works best for it, but they should all be independently deployable with a high level of automation. Microservices and it’s architecture will be covered in the 48th Edition of the DNC Magazine (releasing on October 22nd).

In Event-driven architecture, there’s even more emphasis on loose coupling and asynchronous communication between the components. Although it’s not a requirement, the system can still be distributed, i.e. it can consist of independent services (or microservices).

The main distinguishing factor is that the components don’t communicate with imperative calls. Instead, all the communication takes place using events (or messages) which are posted by components and then listened to by other components that have interest in it.

The component posting the event doesn’t receive any direct response to it. However, it might receive an indirect response by listening to a different message. This makes the communication more asynchronous when compared with the other patterns.

Within a selected high-level architectural pattern, there are still many lower level architectural decisions to be made which specify how an application code will be structured, in even more detail.

There are further patterns available for these decisions, such as the Model-View-Controller (MVC) pattern for web applications and the Model-View-Viewmodel (MVVM) pattern for desktop applications.

As the scope of these patterns becomes even smaller, we sometimes name them design patterns instead of architectural patterns. Examples of those are dependency injection (read more about it in Yacoub Massad’s article Clean Composition Roots with Pure Dependency Injection), singleton (read more about it in my article Singleton in C# – Pattern or Anti-pattern), and others.

After the initial application architecture is defined, it’s necessary to evaluate how it satisfies the list of requirements it’s based on. This is important because in most cases there is no single correct choice for the given requirements.

There are always compromises and every choice has its own set of advantages and disadvantages. A certain architectural choice could, for example, improve the application performance, but also increase operating costs and reduce maintainability. Depending on the relative importance of the affected requirements, such an architectural choice might make sense or not.

application-architecture-evolution

Figure 2: Continuous evolution of application architecture

The application architecture is never set in stone.

It needs to evolve as the application is being developed and new knowledge and experience is gathered.

If a certain pattern doesn’t work as expected in the given circumstances, it should be reevaluated and considered for a change. Requirements (functional and non-functional) might change and affect previous architectural decisions as well.

Of course, some architectural patterns are easier to change than others. For example, it’s much easier to introduce dependency injection into an application or change its implementation than to change the application type or core architectural pattern such as MVC.

Official resources for .NET developers

If you’re focusing on the .NET and Azure technology stack, Microsoft offers a lot of official resources to help you get started with architecting applications.

The .NET Architecture Guides website is probably the best starting point. The resources on the site are organized based on the type of application you want to develop. After you select one (e.g. ASP.NET apps or UWP desktop apps), you get a list of free e-books to download that are applicable to the selected application type. The same e-book might be listed under multiple application types if the guidance it contains applies to more than one.

dotnet-architecture-guides

Figure 3: Entry page of the .NET Architecture Guides website

In general, the e-books follow a similar approach and do a good job at introducing the reader to the topic they cover. Typically, they include the following:

  • An introduction to the technologies involved.
  • An overview of available application sub-types (e.g. MVC vs. single page web applications) and the reasoning behind choosing one.
  • A list of common architectural patterns for the application type with explanation.
  • A tutorial covering the key parts of an application including sample code.

The books primarily target readers with no prior experience in the subject they cover. Their content is suitable both for software architects and developers. They might still be a valuable read even If you have some prior knowledge. In that case, you might skip some parts of the book or skim over them, but nevertheless you could still pick up a few things or get a more thorough overview of the topic.

Many books are accompanied by working sample applications with full source code available on GitHub. These showcase many of the concepts explained in the books and are regularly updated to the latest versions of technologies they use. Often the samples are also updated with features introduced in new versions of those technologies. It’s a good idea to look at the code before starting a new similar project or implementing a pattern that’s featured in a sample.

Azure Architecture Center is another good resource.

As the name implies, it’s mostly focused on applications being hosted in Microsoft Azure, but many of the patterns are also useful in other scenarios. In my opinion, the most useful part of this site are the Cloud Design Patterns. It consists of a rather large list of architectural patterns, grouped into categories based on their intended use. Similar to how software design patterns are usually documented, each pattern has a description of the problem it addresses and the solution it proposes. Many include sample code and links to related patterns.

While this might not be enough information on its own to fully implement a pattern from scratch, it’s a good basis to compare and evaluate different architectural patterns in the context of your own requirements.

Conclusion

In this article, I explained the concept of application architecture and provided some guidelines on how to approach it. I described the importance of architecture evaluation and evolution. I included links to Microsoft’s official resources about application architecture and suggested how they can be used effectively.

This is the first article in the series about application architecture. In the following articles, I will focus on a selection of architectural patterns for different application types.

Stay tuned for my next article where I talk about Architecture of Desktop and Mobile Applications and Architecture of Web Applications.

This article was technically reviewed by Yacoub Massad.

This article has been editorially reviewed by Suprotim Agarwal.

Absolutely Awesome Book on C# and .NET

C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.

We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).

Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.

Click here to Explore the Table of Contents or Download Sample Chapters!

What Others Are Reading!
Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+

Author
Damir Arh has many years of experience with software development and maintenance; from complex enterprise software projects to modern consumer-oriented mobile applications. Although he has worked with a wide spectrum of different languages, his favorite language remains C#. In his drive towards better development processes, he is a proponent of Test-driven development, Continuous Integration, and Continuous Deployment. He shares his knowledge by speaking at local user groups and conferences, blogging, and writing articles. He is an awarded Microsoft MVP for .NET since 2012.


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!

Categories

JOIN OUR COMMUNITY

POPULAR ARTICLES

C# .NET BOOK

C# Book for Building Concepts and Interviews

Tags

JQUERY COOKBOOK

jQuery CookBook