object-oriented design fall 2012 · •for this course: ooa/d structures/decomposes a domain in...
TRANSCRIPT
![Page 1: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/1.jpg)
Object-Oriented Design Fall 2012
Kent Saxin Hammarström
Teaching assistants: Stavros Aronis, David Klaftenegger
![Page 2: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/2.jpg)
Lecture 1
• Practical matters (1 h)
• Subject introduction (1 h)
![Page 3: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/3.jpg)
Practical matters: Registration etc.
• Apply (www.antagning.se (Sen anmälan)) Except
– Master’s students: Contact programme co-ordinator
– Exchange students: [email protected]
– Re-registration: IT student office ([email protected])
– Reserves: Wait for acceptance from IT office
• Register: studentportalen.uu.se
• Dropping course: Notify [email protected] within 3 weeks
![Page 4: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/4.jpg)
Course focus
• Pragmatic / applied
– Background
– Learning analysis/design
• Focus on design in software projects
• No actual programming
![Page 5: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/5.jpg)
Course structure
• Lectures
• Group project assignment
• Final examination as poster presentation/review of project
![Page 6: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/6.jpg)
Course structure: Lectures
• 2 lectures / week
• No compulsory text book
– 9 articles
• http://www.it.uu.se/edu/course/homepage/ood/ht12 (+ link from the Student Portal course page)
• Kent only available on lecture days
![Page 7: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/7.jpg)
Course structure: Project
• Weekly (obligatory) TA meetings – Bonus for satisfactory progress
• Mid-course poster presentation of analysis in half-class
• Final poster presentation of design with 3 groups at a time
• Hand-in of analysis and design (4 credits) for grading
• Presentations: 1 credit. Pass/Fail, but…
![Page 8: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/8.jpg)
Project groups
• Form groups before Thursday lunch – We will create groups for those who haven’t by
then
• As soon as groups finalized, there’ll be sign-up lists for the projects
• Two projects (one per TA) – Vote 2 out of 3 on Wednesday lecture
• First TA meeting next week; sign-up lists for 1st occasion
![Page 9: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/9.jpg)
Break?
![Page 10: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/10.jpg)
Object-oriented design
• Design
• Object-oriented
• Object-oriented design?
![Page 11: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/11.jpg)
Design
• Conceptual plan for “building”
• SE: Requirements – analysis – design (system & object) – implementation
– Linear or not? Feedback. Waterfall vs agile
• Motivations
– Handling complexity
– Communication
![Page 12: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/12.jpg)
Object-orientation
• No universal definition
• Encapsulation – inheritance – dynamic binding
• In A/D contrasted with top-down structured and data-driven
• In OOP one dimension of several
![Page 13: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/13.jpg)
Object-oriented design 2
• OO as a property of design?
• Pragmatic OOD: Design intended to be implemented in an OOP – Minimizes gap
• For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form an inheritance hierarchy
![Page 14: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/14.jpg)
OO concepts
• Objects, state, behaviour and identity
• Class
• Encapsulation
• Inheritance
• Polymorphism
• Static and Dynamic binding
• Composition and aggregation
![Page 15: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/15.jpg)
Objects, state, behaviour and identity
• Object
– State: instance variable values
– Behaviour: Messages trigger activity
– Identity: Identity != Equality
![Page 16: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/16.jpg)
Class
• Concept vs instance
– Design perspective
– (deductive reasoning)
• Classification of objects
– Analysis (and post hoc) perspective
– (inductive and abductive reasoning)
![Page 17: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/17.jpg)
Encapsulation
• No direct manipulation of instance variables
• Isolate representation of state from accessing
• [code example]
![Page 18: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/18.jpg)
Inheritance
• Classes as extensions of other classes: Subclassing
– (diagram)
– Specification inheritance
– Implementation inheritance
• Maintenance etc.
• Polymorphism
![Page 19: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/19.jpg)
Polymorphism
• Subtype/parametric polymorphism
– Subtype p: Any subclass can be substituted for its superclass(es)
• Cf inheritance above
– (code snippet)
• Ad hoc polymorphism (overloading)
![Page 20: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/20.jpg)
Static and Dynamic binding
• Static b: Names acquire their values before run-time. E.g. C and C++
• Dynamic b: Names acquire their value during run-time. E.g. Java and Python
– Hooks for future code, as objects can be sub-classed for changed behaviour
• (code snippet)
![Page 21: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/21.jpg)
Composition and aggregation
• Objects as members/attributes of other objects
• Strength of association / ownership
• Composition: ”owns a”, ”consists of”; 1-to-1 or 1-to-many
• Aggregation: ”has a”; many-to-many
• + general relation: ”uses a”
• Life cycle management
– (cf. cascade-on-delete)
![Page 22: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/22.jpg)
Why OO?
• Most common languages: Java & C++
• OO more a design approach
– OOP provide features to support OO, but don’t enforce it
![Page 23: Object-Oriented Design Fall 2012 · •For this course: OOA/D structures/decomposes a domain in terms of stateful communicating objects, with objects grouped into classes that form](https://reader035.vdocument.in/reader035/viewer/2022063018/5fdcde39c26ca5567461bf59/html5/thumbnails/23.jpg)
Next lecture
• Object-oriented analysis