Software Design and Architecture SEG3202 Nour El Kadri.

Slides:



Advertisements
Similar presentations
Agenda Definitions Evolution of Programming Languages and Personal Computers The C Language.
Advertisements

Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
SS ZG653Second Semester Topic Architectural Patterns – Review of Patterns.
CPSC Compiler Tutorial 9 Review of Compiler.
Paradigms for Process Interaction ECEN5053 Software Engineering of Distributed Systems University of Colorado, Boulder.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
Course Instructor: Aisha Azeem
Architectural Design Establishing the overall structure of a software system Objectives To introduce architectural design and to discuss its importance.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
SS ZG653Second Semester, Topic Architectural Patterns Pipe and Filter.
1 Architectural Patterns Yasser Ganji Saffar
What is Software Architecture?
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 7: Architecture Design Omar Meqdadi SE 273 Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
CS 355 – Programming Languages
1/19 Component Design On-demand Learning Series Software Engineering of Web Application - Principles of Good Component Design Hunan University, Software.
1 The Architectural Design of FRUIT: A Family of Retargetable User Interface Tools Yi Liu, H. Conrad Cunningham and Hui Xiong Computer & Information Science.
An Introduction to Software Architecture
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Architectural Design portions ©Ian Sommerville 1995 Establishing the overall structure of a software system.
Chapter 10: Compilers and Language Translation Invitation to Computer Science, Java Version, Third Edition.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Styles.
SOFTWARE DESIGN.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
SE: CHAPTER 7 Writing The Program
Software Architecture and Patterns
Architectural Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
1.  10% Assignments/ class participation  10% Pop Quizzes  05% Attendance  25% Mid Term  50% Final Term 2.
Pipes & Filters Architecture Pattern Source: Pattern-Oriented Software Architecture, Vol. 1, Buschmann, et al.
Unit 2 Architectural Styles and Case Studies | Website for Students | VTU NOTES | QUESTION PAPERS | NEWS | RESULTS 1.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
Topic 4 - Database Design Unit 1 – Database Analysis and Design Advanced Higher Information Systems St Kentigern’s Academy.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Introduction to OOP CPS235: Introduction.
Lecture VIII: Software Architecture
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
CS223: Software Engineering
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter – 8 Software Tools.
Engr 691 Special Topics in Engineering Science Software Architecture Spring Semester 2004 Lecture Notes.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
Presented by : A best website designer company. Chapter 1 Introduction Prof Chung. 1.
Slide 1 Chapter 8 Architectural Design. Slide 2 Topics covered l System structuring l Control models l Modular decomposition l Domain-specific architectures.
Software Connectors. What is a Software Connector? 2 What is Connector? – Architectural element that models Interactions among components Rules that govern.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Pertemuan 09 Architectural Patterns Mata kuliah: T0144 – Advanced Topics in Software Engineering Tahun: 2010.
Design Patterns-1 7 Hours.
Advanced Computer Systems
Chapter 1 Introduction.
Lecture 1 Introduction Richard Gesick.
SOFTWARE DESIGN AND ARCHITECTURE
Software Design and Architecture
Chapter 1 Introduction.
Patterns.
Software Architecture
An Introduction to Software Architecture
Presentation transcript:

Software Design and Architecture SEG3202 Nour El Kadri

Design Patterns Architectural Patterns

Design Patterns – A Definition "A pattern for software architecture describes a particular recurring design problem that arises in specific design contexts and presents a well-proven generic scheme for its solution. The solution scheme is specified by describing its constituent components, their responsibilities and relationships, and the ways in which they collaborate." [Buschmann].

SW Architectures  Pattern is equivalent to: Architectural Style, or Architectural Idiom

Pattern Characteristics  A pattern describes a solution to a recurring problem that arises in specific design situations.  Patterns are not invented; they are distilled from practical experience.  Patterns describe a group of components (e.g., classes or objects), how the components interact, and the responsibilities of each component. That is, they are higher level abstractions than classes or objects.

Pattern Characteristics – Cont’d  Patterns provide a vocabulary for communication among designers. The choice of a name for a pattern is very important.  Patterns help document the architectural vision of a design. If the vision is clearly understood, it will less likely be violated when the system is modified.  Patterns provide a conceptual skeleton for a solution to a design problem and, hence, encourage the construction of software with well-defined properties

Pattern Characteristics – Cont’d  Patterns are building blocks for the construction of more complex designs.  Patterns help designers manage the complexity of the software. When a recurring pattern is identified, the corresponding general solution can be implemented productively to provide a reliable software system.

Pattern Descriptions A pattern is described with a schema that includes at least the following three parts:  Context  Problem  Solution

Context  The Context section describes the situation in which the design problem arises.

Problem  The Problem section describes the problem that arises repeatedly in the context.  The problem describes the set of forces arising in the context, for instance: requirements the solution must satisfy (e.g., efficiency) constraints that must be considered (e.g., use of a certain algorithm or protocol) desirable properties of a solution (e.g., easy to modify)

Solution  The Solution section describes a proven solution to the problem.  The solution specifies a configuration of elements to balance the forces associated with the problem.

Solution  A pattern describes the static structure of the configuration, identifying the components and the connectors (i.e., the relationships among the components).  A pattern also describes the dynamic runtime behavior of the configuration, identifying the control structure of the components and connectors.

Pattern Categories  Patterns can be grouped into three categories according to their level of abstraction [Buschmann]: Architectural patterns Design patterns Idioms

Architectural Patterns  "An architectural pattern expresses a fundamental structural organization schema for software systems. It provides a set of predefined subsystems, specifies their responsibilities, and includes rules and guidelines for organizing the relationships between them." [Buschmann]

Architectural Patterns  An architectural pattern is a high-level abstraction.  Its choice is a fundamental design decision in the development of a software system.  It determines the system-wide structure and constrains the design choices available for the various subsystems.  It is, in general, independent of the implementation language to be used.

Architectural Patterns - Example  An example of an architectural pattern is the Pipes and Filters pattern.  In Unix for instance, a filter is a program that reads a stream of bytes from its standard input and writes a transformed stream to its standard output. These programs can be chained together with the output of one filter becoming the input of the next filter in the sequence via the pipe mechanism. Larger systems can thus be constructed from simple components that otherwise operate independently of one another.

Other Examples  Layered systems  Blackboards  Model-View-Controller pattern for graphical user interfaces

Design Patterns  "A design pattern provides a scheme for refining the subsystems or components of a software system, or the relationships between them. It describes a commonly- recurring structure of communicating components that solves a general design problem within a particular context." [Buschmann]

Design Patterns -  A design pattern is a mid-level abstraction.  Its choice does not affect the fundamental structure of the software system, but it does affect the structure of a subsystem.  Like the architectural pattern, the design pattern tends to be independent of the implementation language to be used.

Example – Adapter Pattern Adapter (Wrapper, Envelope) pattern. This pattern adapts the interface of one existing type of object to have the same interface as a different existing type of object.  The paper "Creating Applications from Components: A Manufacturing Framework Design" by H. A. Schmid (IEEE Software, Nov. 1996) also gives an example of how the Adapter pattern can be used in an application framework. The paper shows that a portal robot machine class can be adapted for use as a transport service class.

Example – Iterator Pattern  Iterator pattern This pattern defines mechanisms for stepping through container data structures element by element.  The Iterator interface is part of the Java Collections framework.

Example – Strategy Pattern  Strategy (or Policy) pattern. The goal of this pattern is to allow any one of a family of related algorithms to be easily substituted in a system.  See Schmid article.

Idioms  "An idiom is a low-level pattern specific to a programming language. An idiom describes how to implement particular aspects of components or the relationships between them using the features of the given language." [Buschmann]

Idioms – Cont’d  use of a consistent program coding and formatting style guidelines for naming variables, laying out declarations, indenting control structures, ordering the features of a class, determining how values are returned, and so forth.  A good style that is used consistently makes a program easier to understand than otherwise would be the case.

Idiom Examples  In Java, the language-specific iterator defined to implement the Iterator interface can be considered an idiom. It is a language-specific instance of the more general Iterator design pattern.

Pipes and Filters Architectural Pattern  "The Pipes and Filters architectural pattern provides a structure for systems that process a stream of data. Each processing step is encapsulated in a filter component. Data [are] passed through pipes between adjacent filters. Recombining filters allows you to build families of related filters." [Buschmann]

Context  The context consists of programs that must process streams of data

Problem  Suppose we need to build a system to solve a problem: that must be built by several developers that decomposes naturally into several independent processing steps for which the requirements are likely to change.

Forces  The following forces must be considered as to the design of the components and their interconnections the [Buschmann]: It should be possible to enhance the system by substituting new filters for existing ones or by recombining the steps into a different communication structure. Components implementing small processing steps are easier to reuse than components implementing large steps. If two steps are not adjacent, then they share no information.

Forces – Cont’d  Different sources of input data exist.  It should be possible to display or store the final results of the computation in various ways.  If the user stores intermediate results in files, then the likelihood of errors increases and the file system may become cluttered with junk.  Parallel execution of the steps should be possible.

Solution  Divide the task into a sequence of processing steps.  Let each step be implemented by a filter program that consumes from its input and produces data on its output incrementally.  Connect the output of one step as the input to the succeeding step by means of a pipe.  Enable the filters to execute concurrently.  Connect the input to the sequence to some data source, such as a file.  Connect the output of the sequence to some data sink, such as a file or display device.

Structure  The filters are the processing units of the pipeline. A filter may enrich, refine, or transform its input data [Buschmann]. It may enrich the data by computing new information from the input data and adding it to the output data stream. It may refine the data by concentrating or extracting information from the input data stream and passing only that information to the output stream. It may transform the input data to a new form before passing it to the output stream. It may also do some combination of enrichment, refinement, and transformation.

Filters, Pipes, Data Source & Sink  A filter may be active (the more common case) or passive.  The pipes are the connectors  A data source is an entity (e.g., a file or input device) that provides the input data to the system.  A data sink is an entity that gathers data at the end of a pipeline.

Implementation  Implementation of the pipes-and-filters architecture is usually not difficult. It often includes the following steps [Buschmann]: Divide the functionality of the problem into a sequence of processing steps. Define the type and format of the data to be passed along each pipe. Determine how to implement each pipe connection. Design and implement the filters. Design for robust handling of errors. Configure the pipes-and-filters system and initiate the processing.

Example An example pipes-and-filter system might be a retargetable compiler for a programming language. The system might consist of a pipeline of processing elements similar to the following:  A source element reads the program text (i.e., source code) from a file (or perhaps a sequence of files) as a stream of characters.  A lexical analyzer converts the stream of characters into a stream of lexical tokens for the language--keywords, identifier symbols, operator symbols, etc.  A parser recognizes a sequence of tokens that conforms to the language grammar and translates the sequence to an abstract syntax tree.

Example – Cont’d 4. A "semantic" analyzer reads the abstract syntax tree and writes an appropriately augmented abstract syntax tree. Note: This element handles context-sensitive syntactic issues such as type checking and type conversion in expressions. 5. A global optimizer (usually optionally invoked) reads an augmented syntax tree and outputs one that is equivalent but corresponds to program that is more efficient in space and time resource usage. Note: A global optimizer may transform the program by operations such as factoring out common subexpressions and moving statements outside of loops. 6. An intermediate code generator translates the augmented syntax tree to a sequence of instructions for a virtual machine. 7. A local optimizer converts the sequence of intermediate code (i.e., virtual machine) instructions into a more efficient sequence. Note: A local optimizer may transform the program by removing unneeded loads and stores of data.

Example – Cont’d 8. A backend code generator translates the sequence of virtual machine instructions into a sequence of instructions for some real machine platform (i.e., for some particular hardware processor augmented by operating system calls and a runtime library). 9. If the previous step generated symbolic assembly code, then an assembler is needed to translate the sequence of symbolic instructions into a relocatable binary module. 10. If the previous steps of the pipeline generated a sequence of separate binary modules, then a linker might be needed to bind the separate modules with library modules to form a single executable (i.e., object code) module. 11. A sink element outputs the resulting binary module into a file.

Benefits  The pipes-and-filters architectural pattern has the following benefits [Buschmann]:  Intermediate files unnecessary, but possible. File system clutter is avoided and concurrent execution is made possible.  Flexibility by filter exchange. It is easy to exchange one filter element for another with the same interfaces and functionality.  Flexibility by recombination. It is not difficult to reconfigure a pipeline to include new filters or perhaps to use the same filters in a different sequence.  Reuse of filter elements. The ease of filter recombination encourages filter reuse. Small, active filter elements are normally easy to reuse if the environment makes them easy to connect.  Rapid prototyping of pipelines. Flexibility of exchange and recombination and ease of reuse enables the rapid creation of prototype systems.  Efficiency by parallel processing. Since active filters run in separate processes or threads, pipes-and-filters systems can take advantage of a multiprocessor.

Liabilities The pipes-and-filters architectural pattern has the following liabilities [Buschmann]:  Sharing state information is expensive or inflexible. The information must be encoded, transmitted, and then decoded.  Efficiency gain by parallel processing is often an illusion. The costs of data transfer, synchronization, and context switching may be high. Non-incremental filters, such as the Unix sort, can become the bottleneck of a system.  Data transformation overhead. The use of a single data channel between filters often means that much transformation of data must occur, for example, translation of numbers between binary and character formats.  Error handling. It is often difficult to detect errors in pipes-and- filters systems. Recovering from errors is even more difficult.

References:  Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. “Pattern-Oriented Software Architecture: A System of Patterns”, Wiley, 1996.