Enterprise Software Architecture Patterns

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Design patterns help realize architecture

True (A)

What does B2C stand for in the context of an online store?

Business to consumer

Top layer uses the services defined by the bottom one.

False (B)

Lower layer is aware of the top layer.

<p>False (B)</p> Signup and view all the answers

We only need to know 1st layer below, independently from others below.

<p>True (A)</p> Signup and view all the answers

Extra layers may reduce performance.

<p>True (A)</p> Signup and view all the answers

Name the three layers found in a 3-layer architecture.

<p>Presentation, Data Sources, Domain Logic</p> Signup and view all the answers

Give an example of a technology used for the presentation layer of a 3-layer architecture.

<p>HTML</p> Signup and view all the answers

Give an example of a technology used for the data source layer of a 3-layer architecture.

<p>Databases</p> Signup and view all the answers

What is the purpose of the domain logic layer in a 3-layer architecture?

<p>Application-specific functionality</p> Signup and view all the answers

Why is layers separation useful even only on one computer?

<p>Layers separation useful even only on one computer.</p> Signup and view all the answers

Give an example of something that could be done on the client side to improve responsiveness.

<p>Client application (Applet, App,...)</p> Signup and view all the answers

What is the simplest domain logic pattern?

<p>Transaction Script</p> Signup and view all the answers

The Domain Model pattern works well with simple data.

<p>False (B)</p> Signup and view all the answers

The more complex the domain, the easier to map to relational databases.

<p>False (B)</p> Signup and view all the answers

What pattern is designed to operate with "Record Set"?

<p>Table Module</p> Signup and view all the answers

Which of the following interface types is almost universal and platform independent?

<p>HTTP Interface (D)</p> Signup and view all the answers

Name a type of program with HTTP processing capabilities that outputs HTML strings.

<p>CGI or Java Servlets</p> Signup and view all the answers

What receives the response using HTTP session object and displays it?

<p>View</p> Signup and view all the answers

Which pattern's page structure defines presentation, with markers to include executable code for dynamic content?

<p>Template View (A)</p> Signup and view all the answers

Which view pattern is based on a transformation language like XSLT for XML data?

<p>Transform View (B)</p> Signup and view all the answers

If you use the Two Steps View pattern, how many second steps will there be?

<p>1</p> Signup and view all the answers

What isolates the responsibilities to process and serve HTTP requests and to decide what to do with them?

<p>Front Controller</p> Signup and view all the answers

Name an alternative to object DBs.

<p>Relational DB</p> Signup and view all the answers

What is the basic pattern for Row Data Gateway and Table Data Gateway?

<p>Gateway (A)</p> Signup and view all the answers

If technology platform supports data recovery pattern _______, then it is easier to use Table Data Gateway.

<p>Record Set</p> Signup and view all the answers

What pattern is appropriate when the domain model is similar to the database schema?

<p>Active Record</p> Signup and view all the answers

What is registered by Unit of Work?

<p>loaded and modified objects</p> Signup and view all the answers

Which pattern controls what is read?

<p>Identity Map</p> Signup and view all the answers

_________: special field in the object keeping its identify, helps mapping between between objects and relational DB keys.

<p>Identity Field</p> Signup and view all the answers

Name an option for storing inheritance.

<p>Single Table Inheritance, Concrete Table Inheritance, Class Table Inheritance</p> Signup and view all the answers

Class Table Inheritance is very flexible/extensible, and efficient

<p>False (B)</p> Signup and view all the answers

Single Table Inheritance: a lot of duplication and table affected by each domain change, but very efficient, without JOINS.

<p>True (A)</p> Signup and view all the answers

What facilitates the reuse of mapping tools?

<p>Metadata Mapping</p> Signup and view all the answers

Name a problem to avoid when dealing with concurrence.

<p>Lost updates, Inconsistent readings</p> Signup and view all the answers

Name the process of coordinating requests accessing same data to avoid concurrency issues.

<p>Transaction</p> Signup and view all the answers

What's a mechanism to avoid problems in concurrence?

<p>Isolation</p> Signup and view all the answers

What are possible Measures of concurrency control?

<p>both (C)</p> Signup and view all the answers

In ____ locking the focus is on detecting conflict

<p>Optimistic</p> Signup and view all the answers

What kind of lock requires reading?

<p>read lock</p> Signup and view all the answers

What is the main concurrency control tool in enterprise applications?

<p>Transaction</p> Signup and view all the answers

Give an example of a business transaction

<p>online banking</p> Signup and view all the answers

Concurrence patterns for transactions spanning more than one request.

<p>Offline Concurrency Control</p> Signup and view all the answers

The main goal of distributed objects, is minimize distribution degree but with efficiency problems

<p>False (B)</p> Signup and view all the answers

What should we differentiate for callable objects?

<p>local and remote interfaces</p> Signup and view all the answers

______ interface: for local calls, many methods with simple functionality. No problem if many calls needed.

<p>Local</p> Signup and view all the answers

_____ interface: for remote calls, methods provide complex functionality, minimize number of calls.

<p>Remote</p> Signup and view all the answers

Name one of the Distributed Objects Patterns

<p>Remote Facade, Data Transfer Object</p> Signup and view all the answers

Flashcards

What is a Pattern?

Describes a common problem and guidelines to solve it. It provides practical foundations and can have different specific solutions for the same pattern.

Layered Architecture

A common approach to decompose a complex problem, where the top layer uses services defined by the bottom layer, and the bottom layer is unaware of the top layer.

Presentation Layer

The logic of user-application interaction, examples including command lines, menus, rich clients, and HTML.

Data Sources Layer

Communication with systems that provide data, such as transaction monitors, legacy systems, and databases.

Signup and view all the flashcards

Domain Logic Layer

Application-specific functionality, such as validating tickets, generating invoices, and computing problems.

Signup and view all the flashcards

Transaction Script

A procedure that receives input parameters from the Presentation layer, processes them, interacts with the database, and responds to the Presentation layer with data.

Signup and view all the flashcards

Domain Model

A pattern based on the use of objects, suitable for complex domains, but potentially difficult to map to relational databases.

Signup and view all the flashcards

Table Module

Designed to operate with a Record Set (result of a DB query), it is a compromise between Transaction Script and Domain Model, structured with tables but missing inheritance.

Signup and view all the flashcards

Web Presentation

User interfaces based on web browsers, offering advantages like no software installation and universal access.

Signup and view all the flashcards

Controller (MVC Pattern)

Receives an HTTP request, redirects to the appropriate Model object, and selects the appropriate View to display the response.

Signup and view all the flashcards

Template View

Defines the presentation structure with markers for executable code. It is commonly used for server pages but can lead to messier code.

Signup and view all the flashcards

Transform View

Based on a transformation language (e.g., XSLT for XML), offering flexibility and adaptability to different formats and devices but can be complex.

Signup and view all the flashcards

Page Controller / Front Controller

Involves a Controller object for each page of the website or action, isolating responsibilities to process HTTP requests.

Signup and view all the flashcards

Mapping to Relational DB

Storing objects in relational databases, which can be challenging due to different data structures.

Signup and view all the flashcards

Gateway Pattern

A basic pattern for accessing a relational database. It maps an in-memory class to a DB table, with a field per DB column.

Signup and view all the flashcards

Active Record Pattern

Combines the Gateway and domain object in one class.

Signup and view all the flashcards

Unit of Work

Registers loaded and modified objects and manages updates to the database.

Signup and view all the flashcards

Concurrence

Multiple processes or threads manipulating the same data, requiring concurrency control mechanisms to avoid issues like lost updates and inconsistent readings.

Signup and view all the flashcards

Optimistic Locking

Focuses on detecting conflicts, allowing users to freely copy and edit files, then detecting conflicts upon saving.

Signup and view all the flashcards

Remote Facade & Data Transfer Object

Remote Facade groups methods to be called remotely, while Data Transfer Object simplifies version of local objects reducing data sent.

Signup and view all the flashcards

Study Notes

  • The content discusses patterns for enterprise software architecture, covering topics from basic principles to distributed applications, database mapping, concurrency, and presentation layers.

Introduction

  • The objective involves structuring business applications
  • Architecture is defined to be the main application parts and their connections
  • Architectural patterns involve important decisions about these parts
  • Design patterns should help realize that architecture

Sample business application

  • Online store (B2C) with many users, simple business logic, generic web interface, and a database for orders and inventory is a sample application
  • Processing house renting is characterized by few users, complex business logic and user interfaces, and a database integrated with external packages for valuations and credit checking
  • Small company expenses management is defined by few users, simple logic and scalability, but it also mentions being integrated with complex applications
  • A pattern describes a common problem and provides guidelines for solving it on practical foundations
  • Solutions can differ on solutions while addressing the same pattern

Layered Architecture

  • Layered architecture is a common approach to decompose complex problems, a top layer usually uses services from a bottom layer without a response, bottom layer hides internal levels.
  • Benefits include needing to know only the layer below, independent layers that can be replaced with implementations, minimized dependencies, and layer reuse
  • Increased risk of cascading changes, performance hits from extra layers, and difficulty in dividing functionality constitute disadvantages
  • Presentation is the logic of user application interaction
  • Data sources communicate with data providing systems
  • Domain logic involves application specific functionality
  • The client and the server must decide where layters should be operated for benefits like upgradeability, maintainablity, responsiveness and also offline operation.

Transaction Script

  • It is a domain logic pattern for processing, storing/retrieving, invoking other systems, and responding, as is the case in an online store
  • It offers a simple procedural model that works well with simplistic data, but disadvantages include incompatibility with complex domain logics
  • Domain Model disadvantages include the use of objects to provide suitability for complex data
  • Table Module is designed to operate with Record Sets as a compromise between these approaches
  • Record is structured around tables, less structured than other OO data, however ideal for things such as .NET

Remote Interfaces to Domain Logic

  • Main remote interface forms of HTTP is defined through browsers or web-service formats (HTML, JSON, XML) for message content (universal, easy to deploy), or OO using CORBA, ActiveX, Java RMI (explicit interface)

Web Presentation

  • Web Presentation based on web browsers offers universal access and no software installs
  • Servers interpret URLs and pass control to applications
  • Main structure involves programs such as CGIs or Java Servlets and server pages (HTML and code templates)
  • Applying the Model View Controller pattern involves a controller receiving a request, redirecting to a model object, which queries data sources and returns to a controller for the view and displays

View Patterns

  • Three patterns for views include Transform, Template, and Two Step
  • Template Views define the presentation and are usual for server pages that need easy development but messy code
  • Transform Views bases on languages such as XSLT for XML data and can adapt to formats or devices with complexity

Controller Pattern

  • In controller patterns, a page controller is an object for each page, while a front controller isolates the responsibilities to process HTTP requests
  • Centralized request management is an advantage here

Mapping to Relational DB

  • Storing objects in relational DBs faces challenges due to structure differing objects, so object DBs are an alternative
  • Mapping for relational DBs can be achieved through Row Data Gateways, Table Data Gateways, Active Records, and Data Mappers
  • Gateways are basic patterns mapping classes to database tables
  • Patterns contain all the mapping code, but not domain logic
  • It should be appropriate for the domain model to be similar to the database schema, combining aspects, although these responsibilities should be seperate
  • Data mappers are more complex and flexible, allowing domain objects to be independent from the DB schema

Concurrence

  • The topic lists: loading, saving, tracking changes and guaranteeing persistence that avoids loaded objects being concurrently edited in a database
  • Unit of Work registers loaded and modified objects; otherwise, domain layer must decide reads and writes

Data Reading

  • Mapping classes encapsulate SQL for object-relational mapping, using Identity Map to control what is read
  • Mapping data structures faces issues with links (foreign keys) and collections (individual values)
  • Identity Fields keep the objects identity to map between databases and objects
  • A common relational database has no inheritance mechanism
  • Options in mapping is limited to a single table (all classes) or a set of connected tables
  • Metadata Mapping facilitates the reuse of mapping tools using files/annotations

Concurrence

  • Concurrence is where multiple processes manipulate the same data, but creates issues
  • Interaction problems, can be avvoided within a transaction or problems will occur
  • Offline-concurrence can span multiple transactions
  • You would require things to avoid concurrency mechanism in order not to lose updates or have inconsistent readings

Execution Contexts

  • Requests or sessions can be interaction contexts
  • Processes offer heavy weight context, and threads are a more lightweight context and transaction coordinate things in DBs
  • Isolation is a mechanism to avoid problems, using examples such as operating system memory access or file locks
  • Shared data can coordinate concurrently
  • Concurrency control can be optimistic or pessimistic

Concurrency Control

  • Optimistic locking detects conflicts, while pessimistic locking is focused on a way to prevent any conflicts
  • Optimistic locking works best with rare infrequent conflicts and a higher concurrency, with pessimistic locking as default for major conflicts
  • Pessimistic locks avoid inconstistent readings through read locks (shared by readers) and write locks (exclusive)
  • Pessimistic locking lead to deadlocks, requiring detection/fixes or order blocks

Transactions

  • Transactions are the main concurrency control tool, with each applied to DBs, message queues, printers, etc
  • Atomicity, consistency, isolation, and persistence are key properties
  • System transactions use SQL commands, while business transactions happen at a higher level

Business Transactions

  • They span multiple request/responses, and its hard to handle concurrency, or they can lock the system
  • Atomicity and persistence are achieved at a user-agreed moment
  • Consistency involves the application implementing business rules, with isolation using session controls
  • Offline concurrency control is defined as more complex
  • Easier to implement and efficient, but detects conflict at the end

Distributed Applications

  • Objects from application design become components, with each executed on different nodes
  • For distributed objects, differentiate local (multiple simple methods) and remote interfaces (fewer complex methods)
  • Minimizing calls and avoiding distributed objects are recommendations
  • Local Interfaces for local calls, many methods with simple functionality
  • Remote Interfaces for remote calls, methods provide complex functionality, minimise number of calls
  • An alternative to that would be scaling up with more application replicas

Distribution Scenarios

  • Remote calls are unavoidable between client and server or application server and database
  • Remote Facade can group methods of a remote interface
  • Data Transfer Objects offer simplified versions of remote objects used to reduced data sent

Putting Into Practice

  • Steps for using patterns while developing, using the techincal platform and the domain layer: Transaction Script, Table Module and Domain Model, however Domain Models can require relational databases
  • In Transaction Script, the platform uses a database with Row/Table Gateways
  • Minimising concurrency problems and corresponding to a system transaction
  • Exception needs load data, edit it using Optimistic Offline Lock
  • Data access layers uses relational mapping too and a single database table to use multiple classes (inheritance) and class table, use a table per class
  • In Table module, the best choice is to use Record Set
  • Presentation-Layer can use rich client-side frameworks, and the model can be domain.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser