Software Architecture Patterns and Deployment Topologies

Approaches to application architecture 

What is a component?

  • An individual unit of encapsulated functionality
  • Serves as a part of an application in conjunction with other components

Component characteristics

  • Reusable: reused in different applications
  • Replaceable: easily replaced with another component
  • Independent: doesn’t have dependencies on other components
  • Extensible: add behavior without changing other components
  • Encapsulated: doesn’t expose its specific implementation
  • Non-context specific: operates in different environments

Component examples

  • API
  • Data Access Object
  • Controller

Component-based architecture

  • Decomposes design into logical components
  • Higher level abstraction than objects
  • Defines, composes, and implements loosely coupled independent components so they work together to create an application

Services

A service is a component that can be deployed independently

  • Designed to be deployed independently and reused by multiple systems
  • Solution to a business need
  • Has one unique, always running instance with whom multiple clients communicate

Examples of Services

  • Checking a customer’s credit
  • Calculating a monthly loan payment
  • Processing a mortgage application

Service-oriented architecture

  • Loosely coupled services that communicate over a network
  • Supports building distributed systems that deliver services to other applications through the communication protocol

Distributed systems

  • Multiple services located on different machines
  • Services coordinate interactions via a communication protocol such as HTTP
  • Appears to the end-user as a single coherent system

Distributed system characteristics

  • Shares resources
  • Fault-tolerant
  • Multiple activities run concurrently
  • Scalable
  • Runs on a variety of computers
  • Programmed in a variety of languages

Nodes

  • Any device on a network that can recognize, process, and transmit data to other nodes on the network
  • Distributed systems have multiple interconnected nodes running services

Distributed system architectures

  • Client-server
  • Peer-to-peer
  • Three-tier or n-tier
  • Microservices

Recap

  • Components are reusable, independent, replaceable, extensible;
  • encapsulated, and non-context specific
  • Component-based architecture is the decomposition of the system into logical independent components
  • Services are made of components and components consist of objects.
  • Services are deployed independently and can be reused by multiple systems
  • SOA is a loosely coupled services that interface with each other via a communication protocol over a network
  • Distributed systems:
    • multiple services on different machines
    • appear to the end-user as a single coherent system

Architectural Patterns in Software

Types of architectural patterns

  • 2-tier,
  • 3-tier,
  • Peer-to-peer,
  • Event-driven,
  • Microservices,
  • Model-view-controller,
  • Message-broker,
  • Blackboard,
  • Pipe-filter, Controller-responder

Examples

  • 2-tier: Messaging apps
  • 3-tier: Web apps
  • Event-driven: Ride sharing
  • Peer-to-peer: Cryptocurrency
  • Microservices: Social media

Combining patterns

Some patterns can be combined in a single system

Example:

  • 3-tier with microservices
  • Peer-to-peer with event-driven

Some patterns cannot be combined

Example: Peer-to-peer with two-tier

Application Deployment Environments 

Application environments

Include:

  • Application code/executables
  • Software stack (libraries, apps, middleware, OS)
  • Networking infrastructure
  • Hardware (compute, memory and storage)

Pre-production environments

  • Development: Project is being actively coded
  • QA: QA team tests the application’s components
  • Staging: Replicates production environment but not meant for general users

Production environment

  • Entire solution stack ++
  • Intended for all users
  • Take load into consideration
  • Other non-functional requirements
  • Security
  • Reliability
  • Scalability
  • More complex than preproduction environments

On-premises deployment

  • System and infrastructure reside in-house
  • Offers greater control of the application
  • Organization is responsible for everything
  • Usually more expensive when compared to cloud deployment

Cloud deployment types

  • Public: Shared infrastructure over internet and hardware is owned by the provider
  • Private: Infrastructure is provisioned for a single organisation
  • Hybrid: Some infrastructure provided over the internet and some provisioned by a single organisation

Recap

  • Application environments include developmen test/QA, staging, and production
  • Production environments must also take into account non-functional requirements like load, security, reliability, and scalability
  • Deployment platforms: on-premises, public, private cloud, & hybrid cloud

Production Deployment Components

Firewall

  • Monitors traffic between an interior and an exterior network
  • Permits or blocks data based on a set of security rules
  • Acts as a barrier between networks to block viruses and hackers from accessing the internal network

Load balancers

Purpose:

  • distributes traffic
  • efficiently amongst multiple servers

Functions:

  • Prevents server traffic overload
  • Maximises server capabilities and responsiveness
  • Ensures no one server is overworked
  • Manages concurrent requests fast and reliably

Web and Application Servers

  • Servers: Provide services, resources, data, or applications to a client
  • Store, process, and manage network data, devices, and systems

Web Servers:

Delivers web pages, files, images, and videos to the client. Responds to HTTP requests from a browser

App Servers:

  • Runs the apps and provides the app to the client or the web server
  • Stores code that determines how data can be created, stored, or changed

Proxy server

  • An intermediate server that handles requests between two tiers
  • Can be used for load balancing, system optimization, caching, as a firewall, obscuring the source of a request, encrypting messages, scanning for malware, and more
  • Can improve efficiency, privacy, and security

Databases and database servers

  • Databases are a collection of related data stored on a computer that can be accessed in various ways
  • DBMS controls a database by connecting it to users or other programs
  • Database servers control the flow and storage of data

Recap

  • Common production environment components include a firewall, a load balancer, web and application servers, proxy servers, and database servers
  • A firewall is a security device that monitors traffic between networks
  • Load balancers distribute network traffic among servers
  • A web server delivers web content
  • An app server provides business logic
  • A database server stores and controls the flow of data through a DBMS

Complete Recap

  • Software architecture functions as a blueprint and represents the importance of a good architectural design. 
  • Structured design breaks down a software problem into well-organized smaller solution elements whereas behavioral models describe the behavior of the system without explaining how the system implements the behavior. 
  • Developing UML diagrams saves time and money by helping developers quickly get up to speed on a project, plan features in advance of coding, and navigate source code easily. Types of UML diagrams include state transition, interaction, and class diagrams.  
  • Objects contain data, and they also have behaviors that prescribe the actions the object can take, whereas classes are blueprints for objects.  
  • A service-oriented architecture (SOA) consists of loosely coupled services that interface with each other via a communication protocol over a network. Distributed systems run on multiple services on different machines, but they appear to the end-user as a single coherent system. 
  • An architectural pattern is a repeatable solution to an architectural problem. Types of architectural patterns include 2-tier, 3-tier, event-driven, peer-to-peer, and microservices. Two or more patterns can be combined in a single system, but some are mutually exclusive.  
  • Application environments include development, testing or QA, staging, and production. Production environments tend to be more complex than pre-production because they must take into account non-functional requirements like load, security, reliability, and scalability.  
  • Application environments can be deployed either on-premises on traditional hardware, or on public, private, or hybrid cloud platforms. 
  • Common components needed for a production environment include a firewall, a load balancer, web and application servers, proxy servers, and database servers.