Announcements/Reminders
• IAR #1 due Friday!
– Submit to your CourseLink dropbox AND to your team’s GitLab site
• Sprint 1 code changes, documentation, Redmine updates, etc. must be finalized by the BEGINNING of your lab next week! (1st week after Break)
– EXCEPT for your Sprint 1 retrospective (and related documentation), which you will complete DURING lab next week, after the Sprint 1 demos are completed.
– During lab, plan to complete your Sprint 1 demo, Sprint 1 retrospective meeting, and Sprint 2 planning meeting.
CIS 3760
Software Engineering
1
Review Discussion: Converting Sequence Diagram to (partial) Class Diagram
2
CIS 3760
Software Engineering
3
Activity Review
CIS 3760
Software Engineering
4
CIS 3760: Software Engineering Software Patterns
Part I – Architectural Pattern
Instructor: Prof. Stacey Scott
School of Computer Science
University of Guelph https://www.uoguelph.ca/computing/people/stacey-scott stacey.scott@uoguelph.ca
©2017-20 Stacey D. Scott
Software Patterns
• Part I: Intro and Architectural Patterns
– Intro to reuse and software patterns
– Some system design definitions
– Architectural patterns
• Part II: Design patterns
CIS 3760
Software Engineering
6
Reuse in Software Engineering
• A core principle of object-oriented software design and development is reuse
• Reuse of:
– Knowledge from previous experience to current
problem
– Functionality already available
• Purpose: leverage prior successes solving similar problems using “tried and true” conceptual or implementation-level solutions
CIS 3760
Software Engineering
7
Reuse: Identification of Existing Solutions
• Use of inheritance
• Off-the-shelf components and additional solution objects • Use of Architectural and Design patterns
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources
8
Software Patterns
• Patterns are collected, not created
– An architecture handbook workshop collected successful
outcomes of experienced software professionals
• What are they?
– Reusable high-level or low-level architectures that often solve recurring and recognizable problems
– Recurring solutions to design problems
– A set of rules or suggestions about how to accomplish certain tasks
CIS 3760
Software Engineering
adapted from slides by Pressman and Maxim, McGraw-Hill 9
Architectural and Design Patterns
• Architectural patterns focus on how major parts of the system fit together, how messages and data flow through the system, and other structural concerns
• Design patterns typically focus on class-level design and illustrate the relationship between the classes within a solution
CIS 3760
Software Engineering
5-layered architectural pattern
https://en.wikipedia.org/wiki/Adapter_pattern
Adapter design pattern
Image and text adapted from https://www.oreilly.com/ideas/ 10 contrasting-architecture-patterns-with-design-patterns
Some definitions: Subsystems and Services
• Subsystem
– Collection of classes, associations, operations, events that are
closely interrelated with each other
– The classes in the system design (i.e. the conceptual) model are
the “seeds” for subsystems • Service
– A group of externally visible operations provided by a subsystem (also called subsystem interface)
– The use cases in the functional model provide the “seeds” for services
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 11
Subsystem Decomposition Example
• Example case study:
– ARENA Tournament Management System
– Multi-user web-based system for scheduling and facilitating game tournaments (e.g., chess, card games)
– Players can connect from anywhere on the Internet, and join any game that supports the ARENA interface
– Organizers set the rules for the games, and the structure for each tournament
– The ARENA system owners can also place advertisements during games to recoup costs
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 12
Example: Services provided by the ARENA Subsystems
User Interface
Manages advertisement banners & sponsorships
Manages tournaments,promotions, applications
Administers user accounts
Advertisement
Component
Management
Adds games, styles, and expert rating formulas
Tournament
Services are described
by subsystem interfaces
User Management
Session
Management
Tournament
Statistics
User Directory
Maintains state during matches
Stores results of archived tournaments
Stores user profiles (contact info & subscriptions)
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 13
ARENA Subsystem Decomposition: Thoughts on this Initial Design?
User Interface
Component
Management
Advertisement
Tournament
Tournament
Statistics
Session
Management
User Management
CIS 3760
Software Engineering
Depends on at runtime
Slides adapted from Bruegge & Dutoit, Pearson online resources 14
Software Patterns
Part I: Intro and Architectural Patterns Intro to reuse and software patterns
Some system design definitions
– Architectural patterns
• Part II: Design patterns
CIS 3760
Software Engineering
15
Subsystem Interface (or Service)
• Subsystem interface: Set of fully typed (specified) UML operations
– Specifies the interaction and information flow to and from subsystem boundaries, but not inside the subsystem
– Service should be well-defined and of reasonable (small) scope
– Subsystem interfaces are defined during system design
• Application programmer’s interface (API)
– The API is the specification of the subsystem interface in a
specific programming language
– APIs are defined during implementation
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 16
Design Complexity of Subsystems
• Goal of good subsystem design Reduce system complexity while allowing change
• Key system design concepts that can impact complexity
– Cohesion measures dependency among classes (within a subsystem)
– Coupling measures dependency among subsystems
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 17
Cohesion and Coupling of Subsystems
• Cohesion measures dependency among classes
– High cohesion: The classes in the subsystem perform similar
tasks and are related to each other via many associations
– Low cohesion: Lots of miscellaneous and auxiliary classes, almost no associations
• Coupling measures dependency between subsystems
– High coupling: Changes to one subsystem will have high impact
on the other subsystem
– Low coupling: A change in one subsystem does not affect any other subsystem.
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 18
Conceptually: Cohesion and Coupling
Cohesion: how conceptually and functionally related
are the classes within a subsystem / module
Coupling: how dependent subsystems / modules are on each other
www.researchgate.net/profile/Md_Masudur_Rahman9/publication/317401856/figure /fig2/AS:502944442793984@1496922707329/Coupling-and-Cohesion.png
static.javatpoint.com/tutorial/software-engineering/images/software-engineering- coupling-and-cohesion.png
CIS 3760
Software Engineering Adapted from S. Reeves, “Software Design” presentation: slideplayer.com/slide/5265721/ 19
Cohesion and Coupling of Subsystems
Good System Design
• Cohesion measures dependency among classes
– High cohesion: The classes in the subsystem perform similar
tasks and are related to each other via many associations
– Low cohesion: Lots of miscellaneous and auxiliary classes, almost no associations
• Coupling measures dependency among subsystems
– High coupling: Changes to one subsystem will have high impact
on the other subsystem
– Low coupling: A change in one subsystem does not affect any other subsystem
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 20
Example: Cohesion and Coupling
CIS 3760
Software Engineering
Adapted from S. Reeves, “Software Design” presentation: slideplayer.com/slide/5265721/ 21
How to Achieve High Cohesion
• High cohesion can be achieved if most of the interaction is within subsystems, rather than across subsystem boundaries
• Questions to ask:
– Does one subsystem always call another one for a specific service?
Yes: Consider moving them together into the same subsystem
– Which of the subsystems call each other for services?
Can this be avoided by restructuring the subsystems or changing the subsystem interface?
– Can the subsystems even be hierarchically ordered (in layers)?
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 22
How to Achieve Low Coupling
• Low coupling can be achieved if a calling class does not need to know anything about the internals of the called class (Principle of information hiding, David Parnas)
• Questions to ask:
– Does the calling class really have to know any attributes of classes in the lower layers?
– Is it possible that the calling class calls only operations of the lower level classes?
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 23
(More) Midterm Information and Prep
• Midterm held during regular Lecture time on Thurs, Mar 4
• Midterm will be given in CourseLink Quiz
– No respondus
• Format:
– Closed questions (MC, TF, matching, etc.)
– Written answers
• Prep activity: in breakout rooms discuss the following question: How do the specific concepts of the Product Backlog, Sprint Backlog, and Backlog refinement relate to the 4 agile core values?
CIS 3760
Software Engineering
24
Midterm Prep Activity: in breakout rooms discuss the question
• How do the specific concepts of the Product Backlog, Sprint Backlog, and Backlog Refinement relate to the 4 agile core values?
–
– – –
Individuals and interactions over processes and tools Working software over comprehensive documentation Customer collaboration over contract negotiation Responding to change over following a plan
CIS 3760
Software Engineering
25
Review: Reuse Concepts in SE (see Zoom poll instead)
• What are two key “things” that we try to reuse in SE?
• What types of existing “solutions” can we reuse in SE?
• What is a key difference between Architectural Patterns and Design Patterns?
– What’s a subsystem?
CIS 3760
Software Engineering
26
Software Patterns
Part I: Intro and Architectural Patterns Intro to reuse and software patterns
Some system design definitions
Architectural patterns
• Part II: Design patterns
CIS 3760
Software Engineering
27
Architectural Patterns and S/W Architecture
• Subsystem decomposition: Identification of subsystems, services, and their relationship to each other
• Architectural Pattern (or Style): A pattern for a subsystem decomposition
– Tested or common way to structure a large piece of software
• Software Architecture: Instance of an architectural pattern
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 28
Benefits of Architectural Patterns
• Design reuse
– Well-understood solutions applied to new problems
• Code reuse
– Shared implementations of invariant (unchanging) aspects of a style
• Visualizations and understandability
– Style-specific depictions matching developers’ mental models
• Interoperability
– Supported by style standardization
CIS 3760
Software Engineering
*from UW’s ECE651, Dr. I. Ivkovic, Fall 2013
29
Examples of Architectural Patterns
• Layered Architecture
– Example: Three-tier architecture
• Model-View-Controller (MVC)
• Networking Architectures
– Client/Server (email, web-based applications)
– Peer-To-Peer (Torrents, git, Bitcoin)
• Others:
– Publish-Subscribe (twitter, blogs)
– Repository Architecture
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 30
Recall, “Spaghetti” ARENA Design
User Interface
Component
Management
Advertisement
Tournament
Tournament
Statistics
Session
Management
User Management
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 31
Alternative (Layered) Design for ARENA
Layer 3
Advertisement
Tournament
User Management
Layer 2
Layer 1
Component
Management
Session
Management
Tournament
Statistics
User Directory
CIS 3760
Software Engineering
Depends on at runtime Depends on a compile time
Slides adapted from Bruegge & Dutoit, Pearson 32
User Interface
Layers and Partitions
• A layer is a subsystem that provides a service to another subsystem with the following restrictions:
– A layer only depends on services from lower layers
– A layer has no knowledge of higher layers
• A layer can be divided horizontally into several independent subsystems called partitions
– Partitions provide services to other partitions on the same layer
– Partitions are also called “weakly coupled” subsystems.
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 33
Typical Operating System Architecture
http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/01/07/unisa-chatter-operating-system- concepts-part-2-system-structures.aspx
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson34
Layered Architectural Pattern
uses
A layer is a subsystem that provides a service to another subsystem with the following restrictions:
– A layer only depends on services from
lower layers
– A layer has no knowledge of higher
layers
Hierarchical Relationship
Client
Layer N
Layer N-1
Layer N-2
. . .
calls calls calls
Layer 1
calls
Layer 0
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 35
Closed Architecture (Opaque Layering)
C1ass1
attr
op
C1ass2
attr
op
C1ass3
attr
op
C1assE
attr
op
C1assF
attr
op
C1assC
attr
op
C1assD
attr
op
C1ass B
attr
op
Class A
attr
op
•
Each layer can only call operations from the layer directly below
Design goals:
Maintainability, flexibility
Adv(+)/Disadv(-):
+ Minimizes coupling between subsystems
+ Subsystems can be integrated and tested incrementally
– Introduces speed and storage overhead
CIS 3760
Software Engineering
L4 L3 L2 L1
Slides adapted from Bruegge & Dutoit, Pearson 36
Opaque Layering in ARENA (the tournament management system)
Interface
ArenaClient
Layer 3
Application Logic
ArenaServer
UserManagement
GameManagement
Layer 2
TournamentManagement
AdvertisementManagement
Notification
Storage
ArenaStorage
CIS 3760
Software Engineering
Layer 1
Slides adapted from Bruegge & Dutoit, Pearson 37
Example: Closed Layered Architectural Style
• ISO’s OSI Reference Model
– ISO = International Standard Organization
– OSI = Open System Interconnection
• Reference model which defines 7 layers and communication protocols between the layers
– Computers use this model (now, a simplified version of this model) to communicate over a network
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson
38
Application
Presentation
Session
Transport
Network
DataLink
Physical
Level of abstraction
CIS 3760
Software Engineering
https://www.imperva.com/learn/application-security/osi-model
39
OSI vs. TCP/IP network communication models
CIS 3760
Software Engineering
https://www.imperva.com/learn/application-security/osi-model
40
Open Architecture (Transparent Layering)
• Each layer can call operations from any layer below
Design goal:
Runtime efficiency
Adv(+)/Disadv(-):
L4
L3
C1ass1
attr
op
C1ass2
attr
op
C1ass3
attr
op
C1assE
attr
op
C1assF
attr
op
C1assC
attr
op
C1assD
attr
op
Class A
attr
op
C1ass B
attr
op
+ Increases storage and
speed efficiency L2
– Increases subsystem coupling, which increases complexity
CIS 3760
Software Engineering
L1 Slides adapted from Bruegge & Dutoit, Pear4so1n
Common Layered Architecture: 3-Layered (or 3-Tiered) Architecture
• 3-Layered Architectural Pattern
– An architectural style, where an application consists of 3 hierarchically ordered subsystems
A user interface, middleware and a database system
The middleware subsystem services data requests between the
user interface and the database subsystem
• Often used for the development of Websites:
1. The Web Browser implements the user interface
2. The Web Server serves requests from the web browser
3. The Database manages and provides access to the persistent data
CIS 3760
Software Engineering
42
CIS 3760
Software Engineering
43
Midterm Prep Activity / Concept understanding activity: in breakout rooms discuss the questions
• How do software patterns fit into the Scrum process?
• Where would we decide on an architectural pattern to use in the system or where to apply specific design patterns?
CIS 3760
Software Engineering
44
Review: Layered Architectural Pattern (Style)
• Which architectural pattern is this?
• For what type of application is this pattern often
used?
• Is this an open or closed
layer architectural pattern & why?
• What are one advantage & one disadvantage of the closed architectural pattern?
CIS 3760
Software Engineering
User Interface Layer Middleware Layer Database Layer
45
Examples of Architectural Pattern
Layered Architecture
Example: Three-tier architecture
Model-View-Controller
• Networking Architectures
– Client/Server (email, web-based applications)
– Peer-To-Peer (Torrents, git, Bitcoin)
• Others:
– Publish-Subscribe (twitter, blogs)
– Repository Architecture
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 46
Model-View-Controller Architectural Pattern
• Problem: In systems with high coupling changes to the user interface (boundary objects) often force changes to the entity objects (data)
– The user interface cannot be reimplemented without changing the representation of the entity objects
– The entity objects cannot be reorganized without changing the user interface
• Solution: Decoupling! The model-view-controller (MVC) style decouples data access (entity objects) and data presentation (boundary objects)
Model: Subsystem with entity objects
Views: Subsystems containing boundary objects
Controller: Subsystem mediating between Views (data presentation) and Models (data access).
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 47
Model-View-Controller (MVC) Architectural Style / Pattern
• Consists of 3 subsystems:
– Model subsystem: Responsible for domain knowledge
– View subsystem: Responsible for displaying information
– Controller subsystem: Responsible for interacting with the user and notifying views of changes in the model
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 48
MVC Subsystem Associations
and Roles
CIS 3760
Software Engineering
*from: http://webtechnologyworld.synthasite.com/mvc.php 49
e.g. Selecting a Different view in a GIS (Geographical Information System) application
CIS 3760
Software Engineering
50
Updating the Map View to 3D in MVC
CIS 3760
Software Engineering
*from: http://webtechnologyworld.synthasite.com/mvc.php 51
Updating the Map View to 3D in MVC
1. Renders ListBox Control (UI), Facilitates selection
CIS 3760
Software Engineering
*from: http://webtechnologyworld.synthasite.com/mvc.p5h2p
Updating the Map View to 3D in MVC (Active Model MVC)
6. Informs all viewState “Observers” that viewState is now “3-D view”
5. Model sets viewState attribute to “3-D view”
1. Renders ListBox Control (UI), Facilitates selection
7. Updates MapView widget to display 3D map, using data from the Model
4. calls setViewState(“3-D view”)
CIS 3760
Software Engineering
2. triggers ListBox Selection event “3-D view”
3. Handles ListBox Selection
event,
sends information to model
*from: http://webtechnologyworld.synthasite.com/mvc.p5h3p
– OR – (Passive Model MVC)
5. Model sets viewState attribute to “3-D view”
7. Updates MapView widget to display 3D map, using data from the Model
1. Renders Listbox Control (UI), Facilitates selection
6. Controller calls updateMapView(“3-D view”)
4. calls setViewState(“3-D view”)
CIS 3760
Software Engineering
2. triggers Listbox Selection event “3-D view”
3. Handles Listbox Selection
event,
sends information to model
*from: http://webtechnologyworld.synthasite.com/mvc.p5h4p
8. View queries the Model for state data, and
In BOTH cases
updates the MapView with this data
CIS 3760
Software Engineering
5
5
*from: http://webtechnologyworld.synthasite.com/mvc.p
h
p
Additional Resources & Related Architectural Patterns
• Nice article from Google Developer, Florina Muntenescu, on implementing MVC in Android, and the pros & cons of MVC in Android, especially for implementing simple / automated unit testing
– https://upday.github.io/blog/model-view-controller/
• She also talks about a related pattern, Model-View-
Presenter (MVP) that solves the unit testing problem – https://upday.github.io/blog/model-view-presenter/
CIS 3760
Software Engineering
56
Example Architectural Patterns/Styles
Layered Architecture
Example: Three-tier architecture
Model-View-Controller
Networking Architectures
– Client/Server (email, web-based applications)
– Peer-To-Peer (Torrents, git, Bitcoin)
• Others:
– Publish-Subscribe (twitter, blogs)
– Repository Architecture
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 57
Networking Architectures: Two Broad Categories
• Client-server architectures – Two-tier
– Three-tier – N-tier
• Peer-to-peer architectures
CIS 3760
Software Engineering
58
Client/Server Architectures
• Often used in the design of database systems
– Front-end: User application (client)
– Back end: Database access and manipulation (server)
• Functions performed by client:
– Input from the user (Customized user interface)
– Front-end processing of input data
• Functions performed by server:
– Centralized data management
– Data integrity and database consistency
– Database security
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 59
Client/Server Architectural Style
• One or many servers provide services to instances of subsystems, called clients
• Each client calls the server, which performs some service and returns the result
– The clients know the interface of the server
– The server does not need to know the interface of the client
• The response in general is immediate
• End users interact only with the client
Server
Client
requester
CIS 3760
Software Engineering
provider
**
+service1()
+service2()
+serviceN()
Slides adapted from Bruegge & Dutoit, Pearson 60
Networking Architectures: Two Broad Categories
• Client-server architectures **
+service1()
+service2()
+serviceN()
Server
Client
requester
• Peer-to-peer architectures requester
provider
Peer
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 61
*
*
service1() service2() … serviceN()
provider
Peer-to-Peer (P2P) Architecture
• In a P2P system architecture, there is no central server
• Each workstation on the network shares its files or resources (e.g. printers and other peripherals) equally with the others
• No central storage or authentication of users
• E.g., home network or small-business network often use P2P networks to share files and resources
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson 62
Peer-to-peer Architectural Pattern
Peer
requester
*
*
service1() service2() … serviceN()
provider
CIS 3760
Software Engineering
http://infosecawareness.in/peer-to-peer-network
Slides adapted from Bruegge & Dutoit, Pearson63
Git: Example of a peer-to-peer architecture
Git in a Nutshell (excerpt from “Git”, Ch. 6, The Architecture of Open Source Applications, by Susan Potter)
Git enables the maintenance of a digital media (files/directories) by many collaborators using a peer-to-peer network of repositories. It supports distributed workflows, allowing a body of work to either eventually converge or temporarily diverge.
r = repository on developer’s workstation
CIS 3760
Software Engineering
Git is a distributed version control system (DVCS). By design, it does not need a central repository. In practice, one depo is often used as the “Central” repo (e.g. GitHub).
http://www.aosabook.org/en/git.html
64
Midterm Prep Activity / Concept understanding activity
• Torrents and Bitcoin are examples of applications that use peer-to-peer networking
• Based on your knowledge of these applications/services, discuss why these applications / services use this networking approach rather than client-server networking approach?
CIS 3760
Software Engineering
65
Client/Server vs. P2P Architectures
Advantages of Client-Server
Advantages of P2P
All files are stored in a central location. Versioning is clear (not multiple versions of data).
Do not need an expensive server because individual workstations are used to access the files.
Network peripherals are controlled (and secured) centrally
No need for specialist technicians because each user sets their own permissions for file sharing, peripheral sharing, etc.
Backups and network security are centrally controlled
If one computer fails it will not disrupt any other part of the network; only locally stored files and shared peripherals will be unavailable.
Users can access shared data which is centrally controlled
Each local site can work locally, accessing local data and peripherals, even if network is down.
CIS 3760
Software Engineering
http://www.teach-ict.com/gcse_new/networks/peer_peer/miniweb/pg3.htm
66
Summary
• Subsystem Decomposition
– Decomposes the overall system into manageable part by using the principles of cohesion and coupling
• Architectural Pattern (or Style)
– A pattern for a subsystem decomposition
• Software architecture
– An instance of an architectural style
CIS 3760
Software Engineering
67
Slides adapted from Bruegge & Dutoit, Pearson
Review: MVC & Network Architectural Styles
• What is the main role of the “View” component in the MVC architectural pattern?
• What is the main role of the “Model” component in MVC?
• What is the role of the “Controller” in handling user interaction with the user interface?
• We’ve discussed two versions of MVC: Passive Model MVC and Active Model MVC.
– How do these two versions of MVC differ?
• What are the two broad categories of network
architectural styles we’ve discussed?
CIS 3760
Software Engineering
68
Summary of Architectural Patterns/Styles
Layered Architecture
Model-View-Controller
Client/Server (email, web-based applications)
Peer-To-Peer (Torrents, git, Bitcoin)
• Others:
– Publish-Subscribe (twitter, blogs); type of networking architecture we will cover similar to the “Observer” Design pattern we will cover in “Design Patterns” section
– Repository Architecture (similar to the MVC architecture… the “Model” is considered a repository for entity objects (data))
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pear6so9n
Additional Information & Readings
• Slides for this section have “Additional Materials” section with more examples and information some of the concepts we have covered.
(Optional) Additional Readings
• J.D. Day and H. Zimmermann (1983)
– The OSI Reference Model,Proc. IEEE, Vol.71, 1334-1340
• Frank Buschmann et al:
– Pattern-Oriented Software Architecture, Vol 1: A System of Patterns, Wiley, 1996.
CIS 3760
Software Engineering
70
Additional Materials
Observation about Modeling of the Real World
• “Strict modeling of the real world leads to a system that reflects today’s realities but not necessarily tomorrow’s.”
[Gamma et al., 94]
• There is a need for reusable and flexible designs
• Design knowledge complements application domain knowledge and solution domain knowledge.
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 72
Example: Open Architecture: Java Swing
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pear7so3n
Example: Peer-to-Peer & Layered Architectural Style
• ISO’s OSI Reference Model
– ISO = International Standard Organization
– OSI = Open System Interconnection
• Reference model which defines 7 layers and communication protocols between the layers
Application
Presentation
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 74
Session
Transport
Network
DataLink
Physical
Level of abstraction
OSI Model Layers and their Services
• The Application layer is the system you are building (unless you build a protocol stack)
– The application layer is usually layered itself
• The Presentation layer performs data transformation services, such as byte swapping and encryption
• The Session layer is responsible for initializing a connection, including authentication
Application
!
Presentation
Session
Transport
Network
DataLink
Physical
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 75
OSI Model Layers and their Services
• The Transport layer is responsible for reliably transmitting messages
– Used by Unix programmers who transmit messages over TCP/IP sockets
• The Network layer ensures transmission and routing
– Services: Transmit and route data within the network
• The Datalink layer models frames (i.e. unit of data transmission)
– Services: Transmit frames without error
• The Physical layer represents the hardware interface to the network
– Services: sendBit() and receiveBit()
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 76
Application
Presentation
Session
Transport
Network
DataLink
Physical
The Application Layer Provides the Abstractions of the “New System”
Java RMI
Application
Presentation
Session
Transport Network
Data Link Physical
Bidirectional associa- tions for each layer
Application
Presentation Session
Transport Network
Data Link Physical
Processor 2
Processor 1
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources 77
An Object-Oriented View of the OSI Model
• TheOSIModelisa closed software architecture (i.e., it uses opaque layering)
• Each layer can be modeled as a UML package containing a set of classes available for the layer above
Session
Transport
Message
Network
Packet
DataLink
Frame
Physical
Bit
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pearson online resources
Application
Presentation
Format
Connection
OSI (older internet architecture) vs. TCP/IP Model (newer internet architecture)
CIS 3760
Software Engineering
https://www.imperva.com/learn/application-security/osi-model
Design Goals for Client/Server Architectures
Service Portability
Location- Transparency
High Performance
Scalability Flexibility
Reliability
Server runs on many operating systems and many networking environments
Server might itself be distributed, but provides a single “logical” service to the user
Client optimized for interactive display-intensive tasks; Server optimized for CPU-intensive operations
Server can handle large # of clients
User interface of client supports a variety of end devices (PC, smartphone, laptop, wearable computer)
Server should be able to survive client and communication problems.
Slides adapted from Bruegge & Dutoit, Pear8so0n
CIS 3760
Software Engineering
CIS 3760
Software Engineering
81 Slides from Anon. post to Slideplayer.com (http://slideplayer.com/slide/5009473)
Sequence of Events (UML Collaborations Diagram)
CIS 3760
Software Engineering
82 Slides from Anon. post to Slideplayer.com (http://slideplayer.com/slide/5009473)
MVC vs. 3-Tier Architectural Style
• The MVC architectural style is nonhierarchical (triangular):
– View subsystem sends updates to the Controller subsystem
– Controller subsystem updates the Model subsystem
– View subsystem is updated directly from the Model
• The 3-tier architectural style is hierarchical (linear):
– The presentation/UI layer never communicates directly with the data
layer (opaque/closed architecture)
– All communication passes through the middleware layer
CIS 3760
Software Engineering
Slides adapted from Bruegge & Dutoit, Pear8so3n
Recall, 3-Tier Architectural Style
3-Tiers:
Presentation (UI)
Logic (Middleware)
Data (Database)
Logic subsystem services data requests between the UI and Data subsystem
CIS 3760
Software Engineering
(http://en.wikipedia.org/wiki/File:Overview_of_a_three-tier_application_vectorVersion.svg) 84
Common Use of MVC & 3-Tier Styles Together
Presentation Tier
Logic Tier Data Tier
CIS 3760
Software Engineering
http://www.briggs.myweb.port.ac.uk/WEBP/notes/servlets/structure.htm Slides adapted from Bruegge & Dutoit, Pearson 85
Software Patterns
Part I: Intro and Architectural Patterns Intro to reuse and software patterns
Some system design definitions – Architectural patterns
• Part II: Design patterns
Review:
– What specific types of reuse have we discussed?
– Where do patterns come from?
– What’s a subsystem?
CIS 3760
Software Engineering
86
Benefits of high cohesion and low coupling
• Modules are easier to read and understand • Modules are easier to modify
• There is increased potential for reuse
• Modules are easier to develop and test
CIS 3760
Software Engineering
Adapted from S. Reeves, “Software Design” presentation: slideplayer.com/slide/5265721/ 87
Vocabulary Review Crossword Activity
CIS 3760
Software Engineering
88
Software Patterns
Part I: Intro and Architectural Patterns Intro to reuse and software patterns
Some system design definitions
Architectural patterns
• Part II: Design patterns
CIS 3760
Software Engineering
89
Review
• What is a subsystem?
• What is high / low cohesion? • What is high / low coupling?
• What type of design constitutes “good design”?
CIS 3760
Software Engineering
90
Review: Reuse Concepts in SE
• What are two key “things” that we try to reuse in SE?
• What types of existing “solutions” can we reuse in SE?
• What is a key difference between Architectural Patterns and Design Patterns?
– What’s a subsystem?
CIS 3760
Software Engineering
91