Enterprise Application Architecture: Best Practices, Strategies, and More
Application architecture can be thought of as analogous to structural architecture. When you’re building a house, there are many architectural styles from which to choose, such as ranch, craftsman, Tudor, colonial, and Cape Cod. The architecture we select defines our options in terms of interior and exterior design—and the same principle applies to software. Read on to learn about the many styles of enterprise application architecture.
What is application architecture?
Application architecture is a set of patterns and techniques that organizations use to determine how software should be built. It defines interactions between the components of an application as well as interactions involving core services, such as middleware and databases. Architectures may be specific to an organization or industry, or to the type of application being built.
Architecture is distinct from software design in the same way that structural architecture differs from interior design: Building interiors are designed based largely on the structures that house them. Software designs are created based on a foundation of architectural principles. The architecture is the set of guard rails that guides design.
Why do we need an architecture for applications?
There are several reasons why the architecture of applications is important:
- It reduces complexity by ensuring that a limited set of services is used and accessed consistently.
- It reduces costs by limiting redundancy and technology sprawl.
- It provides a consistent roadmap for others to follow when modifying an existing application.
- It improves efficiency by specifying which services are best suited for different types of applications. For example, a specific relational database management system may be recommended for transactional applications, while a preferred NoSQL database may be recommended for analytical use.
Most architectures incorporate three basic layers:
- The database layer includes modules related to low-level dependencies such as servers, databases, networks, storage, and middleware.
- The business layer includes modules that set rules for logic that are specific to the business, such as currency calculations, workflows, application interfaces, and data models.
- The presentation layer defines the way users interact with the application. Examples include menu structure, navigation schemes, and placement of interactive components like buttons.
Other layers may also be used, such as a functional layer, which specifies how the system behaves based on business rules, or an application core layer, which sits just above the database. Good architectural principles specify that each layer may communicate with layers below but not above it. This is to avoid creating dependencies that can increase complexity and result in so-called “spaghetti architecture.”
Application architecture best practices
An effective architecture is built to withstand the test of time, undergird the organization’s software development methodology, maximize flexibility, and minimize complexity and technical debt. It is consensus-driven, which means the definitions and services should be agreed upon by everyone involved in specifying and building software.
Architectures should be defined to maximize reusability for both scale and speed. They should also minimize dependencies between layers by specifying conditions for communication between them.
For example, the database layer should never depend on functions at the presentation layer to avoid creating dependencies that can’t be broken. Similarly, end-user services at the presentation layer should be isolated from each other so that multiple users can be accommodated simultaneously and user sessions don’t become dependent on business or database services being used by a neighbor.
Even within layers, co-dependencies should be minimized. For example, contracts and customers are closely related, but each element should be able to exist without the other. If dependencies are necessary, then the elements should be combined in a single module.
The selection of modules to include in layers should be made with care. Business rules shouldn’t be defined in the database layer, for example; nor should database rules be defined in the business layer. Business layer modules should be limited to those functions that are specific to the company’s business, rather than general-purpose tasks like authentication or validation checks.
As a rule, direct interactions between the presentation layer and the database layer should be avoided. A safe approach is to expose public data as read-only and make updates subject to security controls.
7 types of application architecture
Architecture types have been proliferating as the range of options available to developers has expanded. Here are the most common ones.
1. Monolithic architectures are usually associated with legacy systems that were developed before modern services-oriented constructs were available. In this architecture, all functionality is self-contained, meaning that any changes require the entire application to be tested and recompiled. There are many reasons why this approach is rarely used today. For instance, monolithic software is complex, doesn’t scale well, and is difficult to update. However, it is useful for small projects with simple functionality and low-traffic tools such as web calculators and blogs.
2. Service-oriented architectures emerged in the 1990s and evolved into modern microservices. With this approach, applications are broken down into discrete and reusable services that communicate with each other through a common enterprise service bus. They typically use message queuing or publish-and-subscribe techniques to exchange messages asynchronously.
3. Microservices architectures are widely used in cloud-native, agile development environments like DevOps. With this approach, applications are broken down into the smallest possible components that are loosely coupled, functionally independent, and reusable. Developers assemble applications from microservices, enabling software to be developed much faster. The resulting applications scale well and are resilient because the failure of individual services does not bring down the entire application. They also enable improvements to be introduced without disruption. Multiple developers can work on the same application concurrently.
4. Event-driven architectures are widely used in real-time processing and self-service scenarios. Instead of processing batches of data on a predefined schedule, event-driven architectures respond to an event such as the press of a button, the swipe of a credit card, or the taking of a temperature reading by a sensor. Event-driven applications are often built on top of microservices architectures because an event kicks off a set of specific tasks associated with that action.
5. Web application architecture is specific to programs that run in a browser as well as many mobile applications. It defines components to be used and their logical interactions in the context of the internet’s distributed nature.
Web application architectures have become considerably more nuanced as browser capabilities have improved. For example, progressive web applications are designed to work on any browser and can provide rich functionality even without an internet connection. Architectural specifications may dictate where user interface elements and logic are stored, as well as the order in which elements of a webpage are loaded.
6. Mobile application architectures are similar to their web counterparts, but they consider the greater processing, memory, and storage capacity of mobile devices. They also specify constructs for portability across platforms.
7. Serverless architecture is the most recent evolution of the microservices model and is still relatively rare. With this approach, applications are constructed from cloud-based third-party services that run inside software containers. Serverless functions scale well and can be spun up and shut down very quickly. Serverless is also one of the least expensive ways to deploy software because cloud instances are unnecessary. Popular uses include event processing, image recognition, automated software testing, and machine translation.
How to choose the right architecture
No one architecture is right for every use case, but most are flexible enough to fit multiple scenarios. You can narrow down your choices by starting with the needed functionality and working down to the underlying platform. In some cases, elements of multiple architectures may need to be combined. Here are some factors to consider as you determine the right architecture.
|What functionality is necessary?||The more complexity that’s involved, the more you should lean toward microservices or serverless architectures. Relatively simple on-premises applications may be better suited to a monolithic or service-oriented approach.|
|How important are performance and scalability?||Microservices-based applications deliver the best on both fronts. Elements of web application architecture may also be applied to distribute some processing to user endpoints.|
|Where will the software live?||If the application exists in the cloud, then apply cloud-native constructs such as containers and microservices. If it is built to run on a specific cloud, then use the architectural frameworks provided by the platform operator (e.g., Amazon Web Services). Software that runs behind the company firewall can use service-oriented or microservices definitions specific to its environment.|
|How rapidly will the application evolve?||If you plan to make significant or rapid enhancements, then go with a services approach. A monolithic architecture may be fine for an application that is purpose-built and changes infrequently.|
|What is the skill level of your development team?||This is a key question since microservices, containers, DevOps, and serverless development are very different from traditional techniques. You may want to go with a more mature monolithic or service-oriented architecture until your team is up to speed, and then transition to new constructs gradually.|
Today, organizations have more choices than ever in deciding how to build software. While choice can cause paralysis, there’s no reason why development teams should hesitate to begin transitioning to DevOps techniques and modern cloud-native technologies.
A robust application architecture should accommodate new technologies as they become available, and be suitable for both traditional “waterfall” development and agile practices. By adhering to sound practices for defining layers and the rules around them, development teams can create an architecture that is adaptable and future-proof while ensuring that their work is based on sound fundamentals.