SOEN 343 Software Design Computer Science and Software
- Slides: 17
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin SOEN 343, © P. Chalin SOEN 344, © P. Chalin
Reminders • Hand in your solutions to Exercise Set 1 (they will be returned). • Homework is given in this lecture (see last slide). 2/2/2022 SOEN 343, © P. Chalin, 2
Agenda – Lecture 2 a • OO fundamentals continued. – Delegation, polymorphism. • Design – “Levels” – Methods • UML flash: a language for expressing designs. • Test Drive Development (TDD) and refactoring – a first demonstration – skipped, ran out of time due to room change delay. 2/2/2022 SOEN 343, © P. Chalin, 3
Java – some details to be read on your own. • Primitive types: include – Floating point : float, double. – Integral : byte, short, int, long, char. – boolean, is not assignment compatible with integral types; explicit conversion required. • boolean b = (i == 0 ? false : true); • Class types for “boxing”: – Float, Double, Byte, … Boolean. – E. g. Boolean o = new Boolean(b); 2/2/2022 SOEN 343, © P. Chalin, 4
java. util. Vector • Vector class – Implements a growable array of objects. • Example of use String s = …; Vector v = new Vector(); v. add(s); // adds to end String t = v. element. At(0); v. remove(s); int i = v. size(); 2/2/2022 SOEN 343, © P. Chalin, 5
OO Fundamentals (Exercise Set 2) Answer Q 1 and Q 2 of Exercise Set 2 • Delegation. • Polymorphism. 2/2/2022 SOEN 343, © P. Chalin, 6
Design vs. Requirements and Implementation. Requirements Design Architectural Detailed Implementation 2/2/2022 SOEN 343, © P. Chalin, 7
Design Levels • Architectural design. . . • Detailed design. . . • Implementation (executable designs) 2/2/2022 SOEN 343, © P. Chalin, 8
Two complimentary approaches to design • Planned Design vs. Evolutionary Design • Can we get away with only planned design? 2/2/2022 SOEN 343, © P. Chalin, 9
Evolutionary Design • Practices – XP – Test driven development (TDD) • Do not add code unless you have a test failing … • Important characteristics – “Full” automated test suites – Refactoring • Help us learn detailed design idioms, patterns, … 2/2/2022 SOEN 343, © P. Chalin, 10
Refactoring • A refactoring is a change made to the internal structure of S/W to make it easier to understand less expensive to modify, without changing its observable behavior. 2/2/2022 SOEN 343, © P. Chalin, 11
Can you pick out a good design? • What is a good design? – Satisfies user needs. – Is a simple as possible. Kent Beck: • • Runs all tests Reveals intention. No duplication. Fewest number of classes or methods • … can you smell bad design choices? 2/2/2022 SOEN 343, © P. Chalin, 12
“Bad Smells” • • Duplication. Long method. … we will be learning more. 2/2/2022 SOEN 343, © P. Chalin, 13
Further Reading • Martin Fowler’s, “Is Design Dead”? – martinfowler. com/articles/design. Dead. html 2/2/2022 SOEN 343, © P. Chalin, 14
UML Class Diagram – Class Parts named in class 2/2/2022 SOEN 343, © P. Chalin, 15
UML Class Diagram • Generalization (inheritance) • Dependency 2/2/2022 SOEN 343, © P. Chalin, 16
[Homework] Exercise Set 2 • Complete the exercise set 2. 2/2/2022 SOEN 343, © P. Chalin, 17