Software Component Specification Using Design by Contract

THE UNIVERSITY OF MISSISSIPPI Software Component Specification Using Design by Contract Yi Liu H. Conrad Cunningham Software Architecture Research Group Dept. of Computer & Information Science University of Mississippi THE UNIVERSITY OF MISSISSIPPI Project Development of component software course • systematic, technology-independent methods – – – – object-oriented analysis and design techniques design by contract design patterns Unified Modeling Language (UML) • Java 2 Enterprise Edition (J2EE) 12/12/2008 2 THE UNIVERSITY OF MISSISSIPPI What is a Component? Clemens Szyperski: A software component is a unit of composition with a contractually specified interface and explicit context dependencies only. A software component can be deployed independently and is subject to composition by third parties. 12/12/2008 3 THE UNIVERSITY OF MISSISSIPPI Software Component input output input output interface inner component Component1 Component2 12/12/2008 4 THE UNIVERSITY OF MISSISSIPPI UML Components Methodology Requirements Specification • Use case model • Domain model 12/12/2008 5 THE UNIVERSITY OF MISSISSIPPI Core Types and Interfaces <> Interface1 <> Coretype1 << type >> Type1 <> Coretype2 <> Type2 12/12/2008 6 THE UNIVERSITY OF MISSISSIPPI UML Components Methodology Design Specification • Component architecture • Component specifications – interface specifications 12/12/2008 7 THE UNIVERSITY OF MISSISSIPPI Design by Contract • Precisely specify WHAT an interface must do • Separate consideration of HOW implemented Helps develop components that are • Reliable • Pluggable in a component framework 12/12/2008 8 THE UNIVERSITY OF MISSISSIPPI Design by Contract Semantics of Operations • Preconditions for correct use • Postconditions for correct result Retrieve record with a given key from a table component pre: record with given key exists in table post: record with given key returned 12/12/2008 9 THE UNIVERSITY OF MISSISSIPPI Design by Contract Invariants • Conditions for correct implementation • Constraints on component instance’s state Invariant for a table component: component instance contains at most one record with any particular value of the key 12/12/2008 10 THE UNIVERSITY OF MISSISSIPPI Design by Contract Information Model Abstract state of object implementing interface <> ITableMgt <> Table <> Key 11 12/12/2008 <> Record THE UNIVERSITY OF MISSISSIPPI Interface Specification • Operations (needed to implement use cases) – signature – precondition – postcondition • Invariants • Information model (derived from domain model) 12/12/2008 12 THE UNIVERSITY OF MISSISSIPPI Pluggability Component with interface C conforms to plug point with interface P where R is refinement invariant: • P.signatures subset of C.signatures • For each operation m in P.signatures – P.op(m).pre & P.inv & R implies C.op(m).pre – C.op(m).post & C.inv & R implies P.op(m).post • C.inv & R implies P.inv 12/12/2008 13 THE UNIVERSITY OF MISSISSIPPI Course Registration System <> IPersonMgt <> Student <> StudentSchedule <> Person <> Term <> Section 12/12/2008 <> Instructor <> InstructorSchedule <> Course 14 THE UNIVERSITY OF MISSISSIPPI Operation Precondition in OCL IPersonMgt::makeStudentSchedule ( in sectioninfo:sectionDetails, in studentinfo:studentDetails, out schedule:scheduleDetails ) : Boolean Pre: ----------------section and student information are valid Course -> exists(c|c.id = sectioninfo.courseId) and Term-> exists(t|t.termNo = sectioninfo.termNo) and Section -> exists (se|se.sectionNo = sectioninfo.sectionNo) and Person-> exists(z|id = studentinfo.studentID) and Student -> exists(y|id = studentinfo.studentID) 12/12/2008 15 THE UNIVERSITY OF MISSISSIPPI Operation Postcondition in OCL Post: Result implies StudentSchedule@pre -> forall(x|x.scheduleRef <> schedule.scheduleRef) and let s = (StudentSchedule – StudentSchedule@pre) -> asSequence -> first in s.schedule.scheduleRef = schedule.scheduleRef and s.schedule.id = schedule.id and schedule.id = studentInfo.studentID and s.schedule.section = schedule.section and schedule.section = sectioninfo.section 12/12/2008 16 THE UNIVERSITY OF MISSISSIPPI Summary • Developing component software course • Using UML-based methods for specifying system models • Applying Design by Contract to state operation semantics 12/12/2008 17 THE UNIVERSITY OF MISSISSIPPI Future Work • Refine methods for nested components • Investigate concept of pluggability • Specify user interfaces of components 12/12/2008 18 THE UNIVERSITY OF MISSISSIPPI Acknowledgements • Supported by Acxiom Corporation • Principal Investigator Conrad Cunningham, cunningham@cs.olemiss.edu • Research Assistants Yi Liu, Pallavi Tadepalli, MingXian Fu, and Jian Li 12/12/2008 19

Related docs
Software Design Specification
Views: 17  |  Downloads: 5
software requirements specification
Views: 31  |  Downloads: 2
A Software Design Specification Template
Views: 1176  |  Downloads: 157
software design specification examples
Views: 162  |  Downloads: 41
Specification Template
Views: 38  |  Downloads: 3
Specification Template
Views: 8  |  Downloads: 0
Design-by-Contract
Views: 50  |  Downloads: 0
SOFTWARE REQUIREMENTS SPECIFICATION
Views: 7  |  Downloads: 2
Other docs by tracy14