Table of Contents
Course Outline
Calendar Description
A study of design methods and their use in the correct implementation, maintenance and evolution of software systems. Topics include design, implementation, testing, documentation needs and standards, support tools. Students design and implement components of a software system. Weekly 1.5 hour laboratory (starting 2017). Prerequisites: General prerequisites; including SC/MATH 1090 3.00; LE/EECS 2031 3.00.
Learning Outcomes
Software designers are experts at developing software products that are correct, robust, efficient and maintainable. Correctness is the ability of software products to perform according to specification. Robustness is the ability of a software system to react appropriately to abnormal conditions. Software is maintainable if it is well-designed according to the principles of abstraction, modularity, and information hiding. At the end of the course, students will be able to:
1. Specification: Describe software specifications via Design by Contract, including the use of preconditions, postconditions, class invariants, loop variants and invariants
2. Construction: Implement specifications with designs that are correct, efficient and maintainable.
3. Testing: Develop systematic approaches to organizing, writing, testing and debugging software.
4. Analysis: Develop insight into the process of moving from an ambiguous problem statement to a well-designed solution.
5. Architecture: Design software using appropriate abstractions, modularity, information hiding, and design patterns.
6. Tools: Develop facility in the use of an IDE for editing, organizing, writing, debugging, testing and documenting code including the use of BON/UML diagrams for documenting designs. Also the ability to deploy the software in an executable form.
7. Documentation: Develop the ability to write precise and concise software documentation that also describes the design decisions and why they were made.
Topics
- Core Object-oriented Concepts and Techniques including genericity, polymorphism, multiple inheritance, strong typing and dynamic binding
- Design by Contract (preconditions, postconditions, class invariants, and loop variants and invariants). Command-query separation principle.
- Hoare logic, structured development and reasoning about program properties
- Design Documentation and UML/BON diagrams
- Separation of concerns, modularity, clean interfaces, information hiding, single choice principle, and programming to interfaces not implementations
- Debugging, Unit Testing and Test Driven Development
- Abstract Data Types, Modularity and Information Hiding
- Design Patterns (Singleton, Iterator, Observer, Decorator, Visitor, Composite, Undo/Redo)
- Documenting Design Decisions and demonstrating that code satisfies the design
Detailed Topics from last year (2015W)
The suggested textbooks should help you do self-paced learning, a requirement for this course. The lectures, Labs, assignments and Project will exercise your understanding that you should develop by reading and working on your own.
TOC is an introductory text for computer science that covers the topics you normally do in EECS1020/1030/2011 using Java, except that TOC uses Eiffel. It has some more advanced topics such as DbC, multiple inheritance, functional programming, etc. that you may not have seem in your first two years. TOC is highly recommended and you can read it online via the York university Library. The main page of this course wiki also directs you to online lectures and slides for TOC. OOSC2 is on reserve in Steacie.
See the 591 slides of BigEiffel.pdf in the SVN, for a summary of the language and design features.
Slides 02-W15-DBC-TDD
Readings:
- Suggested Reading: OOSC2 Chapter 1 and Chapter 3. See here for a brief summary.
- Required reading:
Topics covered in class using the slides include:
- Requirements, Design and Implementation of software systems.
- Why is their a need for Design? What are the goals of doing Design?
- Illustration of the Design of a small bank system from Requirements to Implementation.
- The importance of Unit Testing. Test Driven Development (TDD).
- Using the ESpec testing framework: boolean tests and violation tests
- What is a Class? It's static structure
- What is an Object? It's dynamic structure
- Representing system architecture via BON and UML class diagrams.
- Relationships between classes: Client-Supplier (associations) and Inheritance
- Uniform Acces Principle and information hiding
- Design by Contract in depth
- Using the EiffelStudio Debugger for Testing, and ECF files for clusters and libraries
- Using the EiffelStudio BON diagraming tool
- The design and use of generic collection classes such as ARRAY[G] and LIST[G].
- Expanded and Reference Types
- Object comparisons versus Reference comparisons
- The difference between “=” and “~”, and redefining
is_equal
- Void Violation Cases and Void Safety
- What is Design? Architecture and Specifications
- BON and UML diagram notations for Design & Architecture
- Information Hiding
- Abstraction and abstract (deferred) classes
- The Command-Query separation Principle and DbC
- DbC: obligations and benefits in contracting
Class included a demo of compile time void safety checks
Slides 03
Iterator (with across construct for quantifiers in contracts) and Singleton Pattern
Slides 04
- Static (compile time) classes vs. dynamic (runtime) objects
- Classes as partially implemented ADTs (abstract data types)
- reference vs. expanded types
Slides 05
- Design by Contract (Dbc)
- Hoare Logic
- Class correctness proof obligations
Slides 06
OOSC2 chapters 14, 15, 16 and 17
- Inheritance, polymorphism and dynamic binding in design
Slides 07
OOSC2 and chapter 20
- Multi-panael Design Pattern
Slides 08
- Eiffel Testing Framework (ETF) and acceptance tests
- ETF includes singleton, command, publish-subscribe and MVC design patterns
Slides 09
Tuples and functional programming (lambda calculus and agents)
Slides 10
- Strategy design pattern
Slides 11
- Observer Design Pattern
- Event Based Programming and Publish-subscribe (EVENT_TYPE abstraction using agents)
SDD -- Software Design Document
SDD – Software Design Document
- Koopman and Toyota Unintended acceleration (see video and slides here). Note the need for testing, static analysis (typing) and the V model (see Lab3).
Slides 12
Design Pattern: Decorator and Open-Closed Design Principle. Static Class Digram and Dynamic Sequence Diagram. See Code sample.
Slides 13
Design Pattern: Composite. See code sample. UML inheritance (generalization) and client-supplier (associations, aggregation and composition).
Slides 14
Design Pattern: Visitor. See code sample. Static and Dynamic sequence diagram.
Slides 15
Design by Contract and Exceptions. An exception is a violation of the contracts not a normal sequencing mechanism. The problem with using exceptions in place of preconditions in Java, C# etc. (a) An exception is the negation of the precondition, but is the precondition that the client needs to know. (b) An exception may appear in a Java interface (e.g Arithmetic-Exception), but is it is non-specific. It does not document for the client how it could have been avoided.
Slides 16
Correctness: (a) Hoare logic and (b) Design by Contract and loop variants and invariants. (c) Tolerant (involving defensive programming) and Demanding routines, depend on the strength of the preconditions. (d) The difference between abstract algorithms and their program implementations.
Lampsort. Algorithms such as Quicksort are normally presented too close to implementation (e.g. as a recursive routine). But Quicksort is really a divide-and-conquer at the abstract level that can be refined to a recursive, iterative or concurrent implementation. Eiffel (and loop variants/invariants) can describe the more abstract algorithm rather than its too detailed implementation.
The Eiffel method treats the whole process of software development as a continuum; unifying the concepts behind activities such as requirements, specification, design, implementation, verification, maintenance and evolution; and working to resolve the remaining differences, rather than magnifying them.
Formal specification languages look remarkably like programming languages; to be usable for significant applications they must meet the same challenges: defining a coherent type system, supporting abstraction, providing good syntax (clear to human readers and parsable by tools), specifying the semantics, offering modular structures, allowing evolution while ensuring compatibility. The same kinds of ideas, such as an objectoriented structure, help on both sides. Eiffel as a language is the notation that attempts to support this seamless, continuous process, providing tools to express both abstract specifications and detailed implementations.