From designing to coding

Similar documents
Creating Class Definitions from Design Class Diagrams: public class SalesLineItem // Java { private int quantity;

Mapping Designs to Code

OO Design2. Design Artifacts

COMP 6471 Software Design Methodologies

What is a Model? Copyright hebley & Associates

Designing for Visibility & Mapping to Code CSSE 574: Session 4, Part 3

Software Modeling & Analysis

References: Applying UML and patterns Craig Larman

Some Software Engineering Techniques (Class Diagrams and Pair Programming)

Constantinos Constantinides Computer Science and Software Engineering Concordia University Montreal, Canada

Download FirstOODesignPractice from SVN. A Software Engineering Technique: (Class Diagrams)

SE203b: OO Design for Software Engineers. Office: TEB349, Ext

Assigning Responsibilities (Patterns of Responsibility Assignment Principles: GRASP)

Information Expert (or Expert)

CTIS 359 Principles of Software Engineering SOFTWARE DESIGN OO(A)D

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

Software Engineering

Assigning Responsibilities by Larman

Software Engineering Testing and Debugging Testing

Object Analysis & Design in the textbook. Introduction to GRASP: Assigning Responsibilities to Objects. Responsibility-Driven Design

Domain Modeling- 2. Generalization

Goal: build an object-oriented model of the realworld system (or imaginary world) Slicing the soup: OOA vs. OOD

COMP 354: INTRODUCTION TO SOFTWARE ENGINEERING

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

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

Main concepts to be covered. Testing and Debugging. Code snippet of the day. Results. Testing Debugging Test automation Writing for maintainability

GRASP: Patterns for. chapter18

Sequence Diagram. A UML diagram used to show how objects interact. Example:

Sequence Diagram. r: Register s: Sale

CS 520 Theory and Practice of Software Engineering Fall 2018

Steps for project success. git status. Milestones. Deliverables. Homework 1 submitted Homework 2 will be posted October 26.

Logical Architecture & Design Preliminaries

ADVANCED SOFTWARE DESIGN LECTURE 7 GRASP

Chapter 3: Object Oriented Design

Softwaretechnik. Lecture 08: Testing and Debugging Overview. Peter Thiemann SS University of Freiburg, Germany

Softwaretechnik. Lecture 08: Testing and Debugging Overview. Peter Thiemann SS University of Freiburg, Germany

COMP 6471 Software Design Methodologies

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

Lecture 15 Software Testing

2 GRASP Patterns and basic OO Design. Roel Wuyts OASS

Testing and Debugging

On to Object-oriented Design

CSE 374 Programming Concepts & Tools. Hal Perkins Fall 2015 Lecture 15 Testing

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

Software Quality Assurance (SQA) Software Quality Assurance

Lab Exercise Test First using JUnit

No Source Code. EEC 521: Software Engineering. Specification-Based Testing. Advantages

Software Design Models, Tools & Processes. Lecture 6: Transition Phase Cecilia Mascolo

CSSE 374: Logical Architecture. Shawn Bohner Office: Moench Room F212 Phone: (812)

Last Time: Object Design. Comp435 Object-Oriented Design. Last Time: Responsibilities. Last Time: Creator. Last Time: The 9 GRASP Patterns

Black Box Testing. EEC 521: Software Engineering. Specification-Based Testing. No Source Code. Software Testing

Testing. CMSC 433 Programming Language Technologies and Paradigms Spring A Real Testing Example. Example (Black Box)?

Regression testing. Whenever you find a bug. Why is this a good idea?

Lecture 10: Introduction to Correctness

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

Problem Solving and Algorithms

Why testing and analysis. Software Testing. A framework for software testing. Outline. Software Qualities. Dependability Properties

Applying UML & Patterns (3 rd ed.) Chapter 15

Bridge Course On Software Testing

Testing and Debugging

Verification and Validation

EXAM Computer Science 1 Part 1

Chapter 8 Software Testing. Chapter 8 Software testing

Operations Contracts and Preliminaries on Design

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

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

I 3 I 2. ! Language of logic design " Logic optimization, state, timing, CAD tools

CS 220: Introduction to Parallel Computing. Arrays. Lecture 4

Overview. State-of-the-Art. Relative cost of error correction. CS 619 Introduction to OO Design and Development. Testing.

Lecture 20: SW Testing Presented by: Mohammad El-Ramly, PhD

Testing. Prof. Clarkson Fall Today s music: Wrecking Ball by Miley Cyrus

Chapter 15 UML Interaction Diagrams. Larman, C. Applying UML and Patterns. 3rd Ed. Ed. Prentice-Hall: 2005.

REPRESENTATION OF CLASS DIAGRAM AND SEQUENCE DIAGRAM IN PROCESS MODELING: UML-BASED STUDY

Unit Testing J2EE from JRuby. Evan Light

Programming Assignment IV Due Monday, November 8 (with an automatic extension until Friday, November 12, noon)

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

GDB Tutorial. A Walkthrough with Examples. CMSC Spring Last modified March 22, GDB Tutorial

Classes, interfaces, & documentation. Review of basic building blocks

An Introduction to Systematic Software Testing. Robert France CSU

Assertions, pre/postconditions

Testing Process and Methods. CS 490MT/5555, Spring 2017, Yongjie Zheng

Unit Testing as Hypothesis Testing

Abstraction and Specification

Domain Modeling: Associations and Attributes

2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C

Introduc)on to tes)ng with JUnit. Workshop 3

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

Verification and Validation

Verification and Validation

Chapter 9. Software Testing

Software Testing Interview Question and Answer

CS18000: Programming I

S/W Programming & Languages

Video 2.1. Arvind Bhusnurmath. Property of Penn Engineering, Arvind Bhusnurmath. SD1x-2 1

Testing Objectives. Successful testing: discovers previously unknown errors

Three General Principles of QA. COMP 4004 Fall Notes Adapted from Dr. A. Williams

Verification and Validation. Verification and validation

Agile Software Development. Lecture 7: Software Testing

Project #1 rev 2 Computer Science 2334 Fall 2013 This project is individual work. Each student must complete this assignment independently.

Introduction to Problem Solving and Programming in Python.

Transcription:

From designing to coding l st step: sensibly split work among team members Choose splits along thin interfaces l Probably not equal parts; split biggest parts again later Formalize the interfaces think of them as contracts Write least-coupled parts first most-coupled last l i.e., classes that don t depend on any other classes l Oh yeah, one more thing to think about: Reserve ample time for testing!

*.h files consider them contracts l Write interfaces first share with the team l Helps to formalizes much of the contract Precisely defines available services (methods) But pre- and post-conditions are not insured l These are communicated by documentation only l Implement classes and their client classes independently Can even compile clients (but cannot fully test)

Pre- and post-conditions l Pre-conditions what the client is responsible for The requires clauses of the contract l Especially include any restrictions on calling arguments l Also any associations that should already exist l Post-conditions what will be accomplished by the operation if the pre-conditions are met The effects and/or modifies contract clauses Include objects created/destroyed, associations formed/broken, attribute values modified Also remember to list side effects, and identify any exceptions that might be thrown

Converting designs into code l Largely a direct translation of key artifacts Class specs variables and method definitions Class and package diagrams associations l Translate to instance variables and/or method arguments Interaction and state-chart diagrams method calls and sequences l Still involves creativity, and probably change Good ideas often arise during coding okay, go for it l But also plan to revise design artifacts to match later

Code from class diagrams SalesLineItem quantity : Integer getsubtotal() : Money described by ProductSpecification class SalesLineItem { public: SalesLineItem(ProductSpecification spec, int qty); Money getsubtotal();... private: int quantity; // attribute ProductSpecification productspec; // association };

Implementing interactions e.g., enteritem(id, qty) { } ProductSpecification spec = catalog.getspecification(id); sale.makelineitem(spec, qty); enteritem(id, qty) :Register 2: makelineitem(spec, qty) :Sale : spec := getspecification(id) :Product Catalog

Least- to most-coupled order Store address : Address name : Text addsale(...)... Houses Register endsale() enteritem(...) makenewsale() makepayment(...) 7 6 Looks-in Captures Uses... Logs-completed 4 * ProductCatalog getspecification(...) Sale date : Date iscomplete : Boolean time : Time becomecomplete() makelineitem(...) makepayment(...) gettotal() 3 5 Paid-by Contains..* Contains..* ProductSpecification description : Text price : Money itemid : ItemID... SalesLineItem quantity : Integer getsubtotal() Payment amount : Money... Describes * 2 4

Use your resources l i.e., don t reinvent the wheel if possible Use STL and other library tools See advice in Code Complete (our textbook) and others l On a real project: consider 3 rd party solutions, existing code, other quick fixes Of course, we hope you mostly do yourself in CS 48 l Program in pairs it works! l And don t wrestle with revision control problems use a revision control system

Revision control problem

Lock-Modify-Unlock Solution

Copy-Modify-Merge Solution: Continued next slide

Copy-Modify-Merge Solution: 2 e.g., Subversion open source and widely used revision control, and everybody s new favorite: Git

Testing goal is to find faults l Faults (a.k.a. bugs) cause systems to fail e.g., a system crashes the most obvious type of fault e.g., a security system that allows unauthorized entry e.g., a shot-down plane that continues on its flight path l Can verify the presence of bugs, not their absence l Testing and debugging are separate processes Testing identifies faults Debugging corrects/removes faults l But it can also introduce new ones, so retesting is required

When are faults introduced? l During requirements analysis Incorrect, missing, or unclear requirements l During domain analysis and system design Incorrect or unclear translation of problem Incorrect or unclear design specification l During system implementation Misinterpretation of system design Incorrect syntax or semantics l Even during testing New faults introduced when old ones corrected Note how naïve to consider this the only source of bugs

Testing steps l Unit testing insure each part is correct Each method of each class of each package should be tested independently l Integration testing insure parts work together l System testing Functional tests a.k.a. use case testing Performance tests test system attribute requirements Acceptance tests client hands-on testing Installation tests final platform testing (on-site)

Unit and integration testing l Test parts of the system before the whole Units test basic parts individully (each function, each class, each package) Integration test basic connections between parts (not whole system at once yet though) l Requires special purpose test programs i.e., driver programs and stubs Or can use a framework like googletest (for testing C++ programs), Junit (Java), Cunit,

System testing phases l Use case testing Test pre- and post-conditions of system functions Best if independent of the user interface l i.e., also requires special purpose testing code l Performance, acceptance, installation tests All involve the complete working system, GUI and all l If any changes to code rerun all tests Term for this philosophy: regression testing

Tragic truth: testing takes time l But it can save time and money in the long run Get in the habit: code a little, test a little, l Inadequate testing costs lots of real world $$$ and maybe lives l Fact: costs of testing/debugging increase as development progresses Cheapest during requirements analysis (especially if an impossible requirement is uncovered) Cheaper during unit than integration testing,