Class Specifications CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides are intended.

Slides:



Advertisements
Similar presentations
EDUC4417 Senior Computers Dr. Mumbi Kariuki January 28, 2004 Object-Orientation David Cuillerier.
Advertisements

Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Karlstad University Computer Science Design Contracts and Error Management Design Contracts and Errors A Software Development Strategy Eivind J. Nordby.
Computer Science School of Computing Clemson University Introduction to Mathematical Reasoning Jason Hallstrom and Murali Sitaraman Clemson University.
Addressing the Challenges of Current Software. Questions to Address Why? What? Where? How?
Introduction to Object Oriented Programming Java.
Feb 2003 R McFadyen1 Contracts (Ch 13) Used to help understand requirements more completely based on assertions; assertions are applicable to any.
COP th Lecture September 26, 2005 COP 4009 Component-Based Software Engineering Fall 2005 Instructor: Masoud Sadjadi
ITEC200 Week01 Introduction to Software Design.
Software Engineering and Design Principles Chapter 1.
CBSD – Component Based Software Development - Introduction -
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
Term Project User Interface Specifications in a Usability Engineering Course: Challenges and Suggestions Laura Leventhal Julie Barnes Joe Chao Bowling.
September 2002 R McFadyen1 Domain Model Use Case Model text diagram SSD System operation contracts Design Model Figure 13.3.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
Analysis Modeling (cont’d) CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
CS 1031 Introduction (Outline) The Software Development Process Performance Analysis: the Big Oh. Abstract Data Types Introduction to Data Structures.
Analysis Modeling (cont’d) CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Computer Science School of Computing Clemson University Mathematical Reasoning across the Curriculum Software Development Foundations and Software Engineering.
Lecture 16 March 22, 2011 Formal Methods CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Implementing Specifications CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh.
Computer Science School of Computing Clemson University Introduction to Formal Specification Murali Sitaraman Clemson University.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
1 These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are provided with permission by.
Lecture 17 March 24, 2011 Formal Methods 2 CS 315 Spring Adapted from slides provided by Jason Hallstrom and Murali Sitaraman (Clemson)
Computer Science and Engineering College of Engineering The Ohio State University Interfaces The credit for these slides goes to Professor Paul Sivilotti.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Introduction to CSE 331 Software Design & Implementation Winter 2011
Reformatted slides from the textbook, C++ How to Program, 6/e Pearson Education, Inc. All rights reserved Chapter 3. [Lecture 02] Introduction to.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Deriving Operational Software Specification from System Goals Xin Bai EEL 5881 Course Fall, 2003.
Analysis Modeling (cont’d) CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
CSC 480 Software Engineering Design by Contract. Detail Design Road Map Begin with architectural models  Class model: domain classes  Overall state.
Introduction to Design (and Zen) CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These.
Software Design Process
Analysis Modeling CpSc 372: Introduction to Software Engineering
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Requirement Engineering. Recap Elaboration Behavioral Modeling State Diagram Sequence Diagram Negotiation.
Protocols Software Engineering II Wirfs Brock et al, Designing Object-Oriented Software, Prentice Hall, Mitchell, R., and McKim, Design by Contract,
Class Design I Class Contracts Readings: 2 nd Ed: Section 9.5, Advanced Topic nd Ed: Section 8.5, Advanced Topic 8.2 Some ideas come from: “Practical.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
CSSE501 Object-Oriented Development. Chapter 10: Subclasses and Subtypes  In this chapter we will explore the relationships between the two concepts.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
PI2134 Software Engineering IT Telkom.  Layered technology  Software Process  Generic Process (by Pressman)  Fundamental activities (by Sommerville)
CS-2852 Data Structures LECTURE 2 Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
Object-Oriented Design Concepts University of Sunderland.
The Software Process CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides are intended.
Representation Invariants CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Examples (D. Schmidt et al)
Design by Contract Jim Fawcett CSE784 – Software Studio
Design by Contract Jim Fawcett CSE784 – Software Studio
Formal Specification of Java Interfaces
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Design by Contract Fall 2016 Version.
Stack ADT & Modularity 2 implementations of the Stack abstract data type: Array Linked List Program design: modularity, abstraction and information hiding.
Specifying Object Interfaces
Introduction to Data Structures
Introduction to Components and Specifications Using RESOLVE
Introduction to Classes and Objects
Formal Specification of Interfaces
Data Structures and Algorithms for Information Processing
Formal Methods Lecture 16 March 22, 2011 CS 315 Spring 2011
Presentation transcript:

Class Specifications CpSc 372: Introduction to Software Engineering Jason O. Hallstrom Authorship Disclaimer. These slides are intended to serve as teaching instruments for an undergraduate course in Software Engineering. While the slides were formatted by Dr. Hallstrom, the content is compiled from other sources, including the readings listed on the course website, Dr. Pressman’s Software Engineering textbook, and various internet materials. In almost every case, the ideas belong to someone other than Dr. Hallstrom. Indeed, text is often quoted verbatim without an explicit citation (to improve the readability of the slides). The original authors retain all copyrights. If you are interested in citing any of the material in these slides, please contact Dr. Hallstrom for the original source(s). DO NOT CITE THIS PRESENTATION. THE CONTENT SHOULD NOT BE ATTRIBUTED TO DR. HALLSTROM. SEE DR. HALLSTROM IF YOU HAVE ANY QUESTIONS.

CpSc 372 Coping With Complexity Abstractions allow us to hide complexity that would otherwise overwhelm our intellectual abilities. Software systems are some of the most complex manmade artifacts in existence. In object-oriented systems, classes are the basic units of modularization and abstraction. How do we describe these abstractions?

CpSc 372 Class Specifications A class specification consists of four primary elements. A description of the abstract data model An initial value for the data model A list of exposed methods (including signature information) A list of method contracts (in terms of the abstract model)  A description of each method’s preconditions  A description of each method’s postconditions A class specification is a tool for describing the abstraction implemented by a class.

CpSc 372 Design by Contract Design by Contract is a programming methodology based on the metaphor of a binding contract. Every method is characterized by two sets of clauses. Preconditions  Properties that must be satisfied before calling a method Postconditions  Properties guaranteed by a method upon termination, assuming its preconditions were satisfied Method contracts bind callers and callees.

CpSc 372 A Sample Interface Specification public interface Stack { /* modeled by: String of Object initial value: <> */ void push(Object obj); /* … */ Object pop() /* requires: (|self| != 0) ensures: there exists a: String of Object, b: Object (#self = * a) and (self = a) and (pop() = b) */ … } Abstract model (may include constraints) Initial value Precondition Postcondition Contracts aren’t always this formal.

CpSc 372 Specification Exercise #1 How would we specify getLength(), getTop(), and push() ?

CpSc 372 Specifying Classes is Hard Work! Although it is considered a best practice to specify every class/interface in detail, almost nobody does it in practice. Developing class/interface specifications for a real system can be a challenging task. Time- and cost-to-market requirements make some best practices economically infeasible.

CpSc 372 Specifications in Practice In industry, software engineers specify many classes/interfaces informally. Only certain classes/interfaces are specified in the detailed format we’ve been examining. Core system classes/interfaces Complex system classes/interfaces Reusable classes/interfaces

CpSc 372 Specification Exercise #1 How would you specify the Queue interface? public interface Queue { void clear(); void enqueue(Object x); Object dequeue(); Object getFront(); int getLength(); }