Principles of Software Construction: Objects, Design and Concurrency. Introduction to Design. toad

Similar documents
Introduction, Overview, and Syllabus

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Principles of Software Construction

Josh Bloch Charlie Garrod Darya Melicher

Software Engineering

Principles of Software Construction: Objects, Design and Concurrency. Object-Oriented Design: Assigning Responsibilities.

Principles of Software Construction: Objects, Design, and Concurrency. The Perils of Concurrency Can't live with it. Can't live without it.

Software Engineering

Principles of Software Construction: Objects, Design, and Concurrency. The Perils of Concurrency Can't live with it. Cant live without it.

Introduction to UML. (Unified Modeling Language)

Review of Basic Software Design Concepts. Fethi Rabhi SENG 2021

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Principles of Software Construction: Objects, Design, and Concurrency. Part 1: Designing Classes. Design for Reuse School of Computer Science

Agile Model-Driven Development with UML 2.0 SCOTT W. AM BLER. Foreword by Randy Miller UNIFIED 1420 MODELING LANGUAGE. gile 1.

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod

So#ware Engineering So#ware Design. Klaus Ostermann

Principles of Software Construction: Objects, Design, and Concurrency

Programming II. Modularity 2017/18

Principles of Software Construction: Objects, Design and Concurrency. Static Analysis. toad Spring 2013

Domain Model and Domain Modeling

Principles of Software Construction: Objects, Design, and Concurrency

Software Design and Analysis CSCI 2040

Chapter 1: Programming Principles

Model-based Transition from Requirements to High-level Software Design

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

SonarJ White Paper. Sonar stands for Software and Architecture. It is meant to support software developers and architects in their daily work.

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

CompSci 125 Lecture 20. Inheritance: Introduction, Overrides UML: Introduction to Class Diagrams

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

Principles of Software Construction: Objects, Design, and Concurrency

Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn. 4. Testing

Implementation Architecture

Pattern-Based Architectural Design Process Model

Charlie Garrod Bogdan Vasilescu

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

Requirements. Requirements. Types of Requirement. What Is a Requirement?

Software Design and Analysis for Engineers

Unit 1 Introduction to Software Engineering

Facade and Adapter. Comp-303 : Programming Techniques Lecture 19. Alexandre Denault Computer Science McGill University Winter 2004

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

Requirements. CxOne Standard

Principles of Software Construction: Objects, Design, and Concurrency. Distributed System Design, Part 2. Charlie Garrod Jonathan Aldrich.

Understading Refactorings

Chapter 1: Principles of Programming and Software Engineering

Introduction to Software Engineering (2+1 SWS) Winter Term 2009 / 2010 Dr. Michael Eichberg Vertretungsprofessur Software Engineering Department of

The Unified Modeling Language (UML)

Design Patterns Thinking and Architecture at Scale

The Software Design Process. CSCE 315 Programming Studio, Fall 2017 Tanzir Ahmed

Modularity Guidelines for design in any programming language

Week 9 Implementation

Object-Oriented Analysis and Design

Key Ideas. OO Analysis and Design Foundation. Objectives. Adapted from slides 2005 John Wiley & Sons, Inc.

Introduction - SENG 330. Object-Oriented Analysis and Design

CSCU9T4: Managing Information

Software Engineering with Objects and Components 1 Overview

Principles of Software Construction: Objects, Design, and Concurrency

New Modular Software Development Principles, a Decentralized Approach

UNIT II Requirements Analysis and Specification & Software Design

SOFTWARE ENGINEERING

Concepts of Programming Languages

San Jose State University - Department of Computer Science

Principles of Software Construction: Objects, Design and Concurrency. The Perils of Concurrency, Part 2 (Can't live with it, can't live without it.

Lecture Notes UML UNIT-II. Subject: OOAD Semester: 8TH Course No: CSE-802

Nick Rozanski Andy Longshaw Eoin Woods. Sold! How to Describe, Explain and Justify your Architecture

SOFTWARE ENGINEERING

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

6. The Document Engineering Approach

02291: System Integration

Best practices for OO 10 content structuring

Appendix A - Glossary(of OO software term s)

Analysis of the Test Driven Development by Example

Best Practices for Collecting User Requirements

1 OBJECT-ORIENTED ANALYSIS

Object-Oriented Software Development Goal and Scope

Principles of Software Construction: Objects, Design and Concurrency. The Perils of Concurrency, part 4 Can't live with it. Can't live without it.

Agile Manifesto & XP. Topics. Rapid software development. Agile methods. Chapter ) What is Agile trying to do?

Formal Specification of Software Systems

Requirements Validation and Negotiation

Responsibilities. Using several specific design principles to guide OO design decisions.

How to Collect and Manage Requirements for Successful GIS Projects. Matt Harman Craig Venker

COURSE 2 DESIGN PATTERNS

Design Engineering. Overview

Existing Model Metrics and Relations to Model Quality

Foundations of Software Engineering

MSO Object Creation Singleton & Object Pool

Lecture 8 Requirements Engineering

The Imperative Paradigm

Object Oriented Programming

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

Modeling Crisis Management System With the Restricted Use Case Modeling Approach

Ensuring a Rigorous Curriculum: Practices and Goals

JOURNAL OF OBJECT TECHNOLOGY

CPSC 213. Introduction to Computer Systems. Introduction. Unit 0

Principles of Software Construction: Objects, Design and Concurrency. The Perils of Concurrency, Part 3 Can't live with it. Cant live without it.

Advanced Topics in Object Technology

Examples. Object Orientated Analysis and Design. Benjamin Kenwright

Principles of Software Construction: Objects, Design, and Concurrency. The Perils of Concurrency, Part 3 Can't live with it. Can't live without it.

CPSC 213. Introduction to Computer Systems. About the Course. Course Policies. Reading. Introduction. Unit 0

Incorporating Usability into an Object Oriented. Development Process

Software Service Engineering

Transcription:

Principles of Software Construction: Objects, Design and Concurrency Introduction to Design 15-214 toad Christian Kästner Charlie Garrod School of Computer Science 2012-14 C Kästner, C Garrod, J Aldrich, and W Scherlis

The four course themes Threads and Concurrency Concurrency is a crucial system abstraction E.g., background computing while responding to users Concurrency is necessary for performance Multicore processors and distributed computing Our focus: application-level concurrency Cf. functional parallelism (150, 210) and systems concurrency (213) Object-oriented programming For flexible designs and reusable code A primary paradigm in industry basis for modern frameworks Focus on Java used in industry, some upper-division courses Analysis and Modeling Practical specification techniques and verification tools Address challenges of threading, correct library usage, etc. Design Proposing and evaluating alternatives Modularity, information hiding, and planning for change Patterns: well-known solutions to design problems toad 2

Learning Goals What is software design? Making trade offs Applying the modeling process from domain model to object model to implementation Basic modeling with UML (static and dynamic) Separating the different levels of UML use toad 3

Goal of Software Design For each desired program behavior there are infinitely many programs that have this behavior What are the differences between the variants? Which variant should we choose? Since we usually have to synthesize rather than choose the solution How can we design a variant that has the desired properties? toad 4

Sorting with configurable order, variant A void sort(int[] list, String order) { boolean mustswap; if (order.equals("up")) { mustswap = list[i] < list[j]; } else if (order.equals("down")) { mustswap = list[i] > list[j]; } } toad 5

Sorting with configurable order, variant B void Sorting sort(int[] with configurable list, Comparator order, variant cmp) B { boolean mustswap; mustswap = cmp.compare(list[i], list[j]); } interface Comparator { boolean compare(int i, int j); } class UpComparator implements Comparator { boolean compare(int I, int j) { return i<j; }} class DownComparator implements Comparator { boolean compare(int I, int j) { return i>j; }} (by the way, this design is called strategy pattern ) toad 6

Tradeoffs void sort(int[] list, String order) { boolean mustswap; if (order.equals("up")) { mustswap = list[i] < list[j]; } else if (order.equals("down")) { mustswap = list[i] > list[j]; } } void sort(int[] list, Comparator cmp) { boolean mustswap; mustswap = cmp.compare(list[i], list[j]); } interface Comparator { boolean compare(int i, int j); } class UpComparator implements Comparator { boolean compare(int I, int j) { return i<j; }} class DownComparator implements Comparator { boolean compare(int I, int j) { return i>j; }} toad 7

Quality of a Software Design How can we measure the internal quality of a software design? Extensibility, Maintainability, Understandability, Readability, Robustness to change Low Coupling & High Cohesion Reusability Testability => modularity as opposed to external quality Correctness: Valid implementation of requirements Ease of Use Resource consumption Legal issues, political issues, toad 8

The bad news toad 9

it depends (see context) depends on what? what are scenarios? what are tradeoffs? toad 10

"Software engineering is the branch of computer science that creates practical, cost-effective solutions to computing and information processing problems, preferentially by applying scientific knowledge, developing software systems in the service of mankind. Software engineering entails making decisions under constraints of limited time, knowledge, and resources. [ ] Engineering quality resides in engineering judgment. [ ] Quality of the software product depends on the engineer's faithfulness to the engineered artifact. [ ] Engineering requires reconciling conflicting constraints. [ ] Engineering skills improve as a result of careful systematic reflection on experience. [ ] Costs and time constraints matter, not just capability. [ ] Software Engineering for the 21st Century: A basis for rethinking the curriculum Manifesto, CMU-ISRI-05-108 toad 11

Design Strategies Design while coding Implement a solution Try-revise, ideally supported by refactorings Draw, then code Draw some diagrams Explore solution at a higher level our Explore alternatives focus Then switch to coding Iterate if necessary Discuss: Worth the overhead? How much drawing? Draw only Generate code from diagrams Diagrams turn into programming language Requires very formal process of using diagramming languages toad 12

The design process 1. Object-Oriented Analysis Understand the problem Identify the key concepts and their relationships Build a (visual) vocabulary Create a domain model (aka conceptual model) 2. Object-Oriented Design Identify software classes and their relationships with class diagrams Assign responsibilities (attributes, methods) Explore behavior with interaction diagrams Explore design alternatives Create an object model (aka design model and design class diagram) and interaction models 3. Implementation Map designs to code, implementing classes and methods toad 13

UML: A visual modeling language Unified Modeling Language Graphical Notation to describe classes, objects, behavior, and more You will need: Class Diagrams Interaction Diagrams (Sequence or Communication Diagrams) Read chapter 2 of the textbook "Design Patterns Explained" Additional readings: Extra slides on 214 website Craig Larman, Applying UML and Patterns, Prentice Hall, 2004 Martin Fowler. UML Distilled. Addison-Wesley, 2003 toad 14

Code vs Graphical Models Graphical models abstract from implementations Focus on interfaces and relationships, or on interactions, while hiding details Easier to communicate Allows focus on higher-level design issues Forces to make relationships explicit Useful for sketching, trying alternatives, and documentation toad 15

Demo / Discussion Virtual World toad 16

A word on notation UML notation is broadly known, well documented Informal notations/sketching often sufficient, but potentially ambiguous for communication and documentation In practice: Graphical modeling very common in general Agree on some notation Adapt/extend as needed UML rarely full heartedly adopted In this course Use UML and conventions for communication Keep it simple Clarity is imperative, document your extensions/shortcuts We don't require or recommend a drawing tool toad 17

Aside: UML in Practice No UML (35/50) Retrofit (1/50) don t really use UML, but retrofit UML in order to satisfy management or comply with customer requirements; Automated code generation (3/50) UML is not used in design, but is used to capture the design when it stabilizes, in order to generate code automatically (typically in the context of product lines); Selective (11/50) UML is used in design in a personal, selective, and informal way, for as long as it is considered useful, after which it is discarded; Wholehearted (0/50 but described in secondary reports) organizational, top-down introduction of UML, with investment in champions, tools and culture change, so that UML use is deeply embedded. Further Reading: Petre. UML in Practice. ICSE 2013 toad 18 Empirical Evidence

Aside: UML in Practice Reasons for No Use Lack of Context Overheads of Understanding the Notation Issues of Synchronization/Consistency Selective Use UML as "Thought Tool" Communication with Stakeholders Collaborative Dialogues (eg. with architects) Significant Adaptation "Keeping it small" Further Reading: Petre. UML in Practice. ICSE 2013 toad 19 Empirical Evidence

Aside: Diagramming in Practice Further Reading: Cherubini et al. Let s Go to the Whiteboard: How and Why Software Developers Draw Code. CHI 2007 toad 20 Empirical Evidence

Aside: Diagramming in Practice Further Reading: Cherubini et al. Let s Go to the Whiteboard: How and Why Software Developers Draw Code. CHI 2007 toad 21 Empirical Evidence

Aside: Key Observations How used? transient forms for exploration, permanent solutions for communication with larger groups mostly ad-hoc white-board diagrams during meetings Why used? to understand, to design, to communicate "code is king" Graphical conventions? Use of formal diagramming language is low too formal for mostly informal visualizations; cost benefit ratio Culture? limited adoption of drawing tools; high value diagrams recreated more formally toad 22 Empirical Evidence

Literature on OO Design Alan Shalloway and James Trott. Design Patterns Explained, Addison Wesley, 2004 Brief introduction to UML Introduction to design with design patterns Mandatory reading Craig Larman, Applying UML and Patterns, Prentice Hall, 2004 Introduction to UML Excellent discussion of object-oriented analysis and object-oriented design with and without patterns Detailed additional material, many guidelines Bertrand Meyer, Object-Oriented Software Construction, Prentice Hall, 1997 Detailed discussion of design goals and modularity toad 23