Modularity Guidelines for design in any programming language

Similar documents
Modularity!! Guidelines for design! in any programming language!

Setting the stage... Key Design Issues. Main purpose - Manage software system complexity by improving software quality factors

LECTURE 3: SOFTWARE DESIGN. Software Engineering Mike Wooldridge

CAS 703 Software Design

Software Design Fundamentals. CSCE Lecture 11-09/27/2016

Lecturer: Sebastian Coope Ashton Building, Room G.18

Software Design. Levels in Design Process. Design Methodologies. Levels..

Software Architecture Bertrand Meyer. Lecture 3: Language constructs for modularity and information hiding

Elementary Concepts of Object Class

CS560: Formal Modelling and Implementation of Systems (Term II)

CHAPTER 9 DESIGN ENGINEERING. Overview

CHAPTER 5 GENERAL OOP CONCEPTS

Abstraction. Design fundamentals in OO Systems. Fundamental Software Development Principles

Programming II. Modularity 2017/18

PC204. Lecture 5 Programming Methodologies. Copyright 2000 by Conrad Huang and the Regents of the University of California. All rights reserved.

In his paper of 1972, Parnas proposed the following problem [42]:

Object-Oriented Design

Object Orientated Analysis and Design. Benjamin Kenwright

CS211 Lecture: Design Quality; Cohesion and Coupling; Packages

What are Metrics?! Functions, that assign a precise numerical value to. Detecting Design Problems using Metrics

Design and Information Hiding

Chapter 5 Object-Oriented Programming

Software Metrics and Design Principles. What is Design?

In this Lecture you will Learn: Design Patterns. Patterns vs. Frameworks. Patterns vs. Frameworks

Information Hiding and Aspect-Oriented Modeling

21) Functional and Modular Design

Desired Characteristics of Modules. Stefan Resmerita, WS2015

21) Functional and Modular Design

EINDHOVEN UNIVERSITY OF TECHNOLOGY

Unit-3 Software Design (Lecture Notes)

Establishing the overall structure of a software system

Object-Oriented Design

Object-Oriented and Classical Software Engineering DESIGN 11/12/2017. CET/CSC490 Software Engineering Design CHAPTER 14. Stephen R. Schach.

Exam Questions. Object-Oriented Design, IV1350. Maximum exam score is 100, grade limits are as follows. Score Grade 90 A 80 B 70 C 60 D 50 E

Programming II (CS300)

Lecture 4: Design Concepts For Responsibility- Driven Design Kenneth M. Anderson January 20, 2005

Plan. Design principles: laughing in the face of change. What kind of change? What are we trying to achieve?

Obfuscating Transformations. What is Obfuscator? Obfuscation Library. Obfuscation vs. Deobfuscation. Summary

Presenter: Dong hyun Park

Objectives. Architectural Design. Software architecture. Topics covered. Architectural design. Advantages of explicit architecture

CS 292 Software Development

Topic : Object Oriented Design Principles

Chapter 8: Class and Method Design

CSC 330 Object Oriented Software Design. Software Design Phase

Lecturer: William W.Y. Hsu. Programming Languages

System Design and Modular Programming

Reasoning About Imperative Programs. COS 441 Slides 10

An Introduction to Software Architecture By David Garlan & Mary Shaw 94

Programmazione. Prof. Marco Bertini

ADVANCED SOFTWARE DESIGN LECTURE 4 SOFTWARE ARCHITECTURE

Software Engineering Principles

Classes and Objects. Object Orientated Analysis and Design. Benjamin Kenwright

Introduction to Object-Oriented Programming

Computational Expression

A STUDY OF OBJECT ORIENTED ANALYSIS AND DESIGN

Contemporary Multilevel Machines

Unit - IV CHAPTER - 13 INTRODUCTION TO OOP WITH C++ Part 1 Choose the best answer

Design Engineering. Overview

Today's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles

CMPT Data and Program Organization

Introduction to System Design

Chapter 2 Basic Principles of the Object-Oriented Paradigm 2.1 Abstraction

Design Process Overview. At Each Level of Abstraction. Design Phases. Design Phases James M. Bieman

Object-Oriented Concepts and Design Principles

Towards a Memory-Efficient Knapsack DP Algorithm

Sub- PPL Unit-I Class-SE Comp

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!

Introduction to Programming

Object-Oriented and Classical Software Engineering THE TOOLS OF THE TRADE 9/22/2017. CHAPTER 5 Slide 5.2. Stephen R. Schach. Overview Slide 5.

Modularization and Software Architectures

Objectives for this class meeting. 1. Conduct review of core concepts concerning contracts and pre/post conditions

301AA - Advanced Programming [AP-2017]

Software Architecture

Programming Languages & Paradigms PROP HT Abstraction & Modularity. Inheritance vs. delegation, method vs. message. Modularity, cont d.

Scala, Your Next Programming Language

Architectural Decomposition Mei Nagappan

Part II Black-Box Composition Systems 10. Business Components in a Component-Based Development Process

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Complexity. Object Orientated Analysis and Design. Benjamin Kenwright

5/9/2014. Recall the design process. Lecture 1. Establishing the overall structureof a software system. Topics covered

Modules. Cardelli, 1996

CS 575: Software Design

Object-Oriented Modeling Using UML. CS151 Chris Pollett Aug. 29, 2005.

Introduction to Object Oriented Programming. (Hebrew University, CS / Spring 2012 )

Verification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1

Architectural Decomposition Reid Holmes

Java and Software Design

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

Introduction to Computer Science and Business

Architectural Design

Implementing Layered Designs with Mixin Layers

SELECTED TOPICS in APPLIED COMPUTER SCIENCE

Lecture 3. Parnas Information Hiding

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Inheritance (Chapter 7)

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases

Design Patterns. Gunnar Gotshalks A4-1

Image Processing. Filtering. Slide 1

Component-based software engineering. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 19 Slide 1

Transcription:

Modularity Guidelines for design in any programming language 14-1

Modular Software Software constructed as assemblies of small pieces» Each piece encompasses the data and operations necessary to do one task well Modular software ==> maintainable software» Uses divide and conquer principle Meyer:» To achieve extendibility, reusability, compatibility, need modular software and methods to produce modular software In OO design non-oo design» Module Class Module File 14-2

Issues in Modular Design Information hiding Independence» Each module implements a separable part of the whole» modules have small, simple interfaces» high interaction between modules is usually symptomatic of a bad modular design Key ideas: coupling and cohesion» Cohesion how "self contained" a module is» Coupling how dependent modules are on each other Want high cohesion and low coupling 14-3

Criteria for Modularity Want a modular design method satisfying» Decomposability» Composability» Understandability» Continuity» Protection Without these, we cannot produce modular software 14-4

Decomposability Decomposition» Break a problem into sub-problems connected by simple structures > Minimize communication between sub-problems > Permit further work to proceed separately on each sub-problem» Example > See slides on top down design 14-5

Composability Composition» Produce software from reusable plug and play modules» Composed software is itself a reusable module» Reusable modules work in environments different from the ones in which they were developed» Examples > Using pipe in the Unix shell to combine Unix commands > See slides on abstract data types and bottom-up design 14-6

Decomposability and Composability Composability and decomposability are independent and often at odds» Top down design favours generating modules that fulfill specific requirements, hence, are unsuitable for composition» Bottom up design favours general modules that are too general, hence when combined generate inefficient systems in size and speed Both top down decomposition and bottom up composition are required, however» Trick is to know when and how to best use both methods 14-7

Understandability and Continuity Understandable» Minimize need to understand module context > Know or examine as few other modules as possible > Very important for maintenance Continuity» The smaller the change in specification, the fewer the number of modules that must be changed (edited) and if possible compiled > Example: use of symbolic constants need to change value in one place but requires recompilation of every module using the constant 14-8

Understandability and Continuity 2 Related to coupling and cohesion A module should do one thing well 14-9

Modular Protection Confine abnormal run time errors to one or a very few modules Avoid propagation of error conditions to neighbouring modules» Example > Validate input before propagating it to other modules Exceptions in languages like C++ and Java can be used in an undisciplined manner leading to violations of protection» Exceptions raised in one part of the system should not be handled by a remote part of the system 14-10

Design Rules to Ensure Modularity We have seen criteria for modular software development From them we can deduce the following rules that can help establish the properties we want in our designs» Direct Mapping rule» Few interfaces rule» Small interfaces rule» Explicit interfaces rule» Information Hiding rule 14-11

Direct Mapping Rule Correspondence The structure used in implementing a software system should remain compatible with the structure used in modeling the system Software design involves addressing needs in a problem domain Have to understand the problem AND its domain, then formulate a solution Model our solution in some notation (we use BON) Need a clear mapping from the proposed solution (in BON) to program source text Arises from continuity and decomposability 14-12

Few Interfaces Rule Every module should communicate with as few others as possible Restrict the number of communication channels between modules Arises from protection, continuity, composability, decomposability and understandability Hub Composite Ring 14-13

Small Interfaces Rule If two modules communicate, they should exchange as little information as possible Also known as weak coupling Relates to the size of connections rather than their number 14-14

Small Interfaces Rule 2 Historical bad idea: Fortran COMMON block» COMMON block1 A[75], B[25]» COMMON block1 C[50], D[50] > View memory in two different ways! block1 block2 Local variables via Algol-60 block structure var i Access all variables in outer block i := i + 5 14-15

Explicit Interfaces Rule Whenever two modules A and B communicate, this must be obvious from the text of A or B or both Conversation is limited to a few participants and only a few words Conversations are loud and public Really important with respect to understandability Worry about procedure parameters as well as shared data 14-16

Information Hiding Rule (Parnas 72) The designer of every module must select a subset of properties as the official information about the module, to be made available to client modules Only some, but not all of the module's properties are public; the rest are secret Public interface Public Private & Secret 14-17

Software Construction Principles Linguistic Modular Units Principle» Modules must correspond to syntactic language units Self-Documenting Principle» Module designers should make all information about the module part of the module itself 14-18

Software Construction Principles 2 Uniform Access Principle» All module services should be available through a uniform notation, which does not betray whether they are implemented through storage or computation» Allow implementer to make space-time tradeoffs Single Choice Principle» Whenever a system must support a set of alternatives, one and only one module in the system should know their exhaustive list 14-19

Software Construction Principles 3 In real projects A module needs to be both open and closed! Open-Closed Principle» Open Available for extension add new features» Closed Available for client use stable in spite of extensions» When are we done?» We must make modules available to others! Classical approach» Close when stability is reached, reopen when necessary» But need to reopen all the clients too!» Inheritance offers a solution to this problem 14-20