Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Staffordshire UNIVERSITY School of Computing Slide: 1 Objects and Classes.

Similar presentations


Presentation on theme: "1 Staffordshire UNIVERSITY School of Computing Slide: 1 Objects and Classes."— Presentation transcript:

1 1 Staffordshire UNIVERSITY School of Computing Slide: 1 Objects and Classes

2 2 Staffordshire UNIVERSITY School of Computing Slide: 2 Objects and Classes Lecture Objectives Explain the idea of Classes and Objects Explain how O-O systems differ from Structured systems in terms of internal functions. Explain the idea of:  Encapsulation  Inheritance  Polymorphism Explain the idea of  Inheritance/Generalisation  Association  Aggregation and Composition

3 3 Staffordshire UNIVERSITY School of Computing Slide: 3 Objects and Classes Classes and Objects Overview Define what type of ‘building blocks’ are used to construct an O-O based system, and the way that these building blocks fit together i.e., they define the system’s structure. Enable the unique features of O-O modelling:  Encapsulation  polymorphism  Inheritance. Form the basis of many other types of UML diagram e.g., sequence diagrams and state machine diagrams. Fundamental to O-O programming languages, therefore, they are the key link between the system design and its implementation.

4 4 Staffordshire UNIVERSITY School of Computing Slide: 4 Objects and Classes Classes and Objects Overview

5 5 Staffordshire UNIVERSITY School of Computing Slide: 5 Objects and Classes Classes and Objects Attribute Scope Underlined fields are “classifier” or static fields

6 6 Staffordshire UNIVERSITY School of Computing Slide: 6 Objects and Classes Classes and Objects Class Packages ‹Guillemet quotes› are used to denote a “stereotype” – extra type information. Note that ‹‹business›› is often considered as a default and left out.

7 7 Staffordshire UNIVERSITY School of Computing Slide: 7 Objects and Classes Classes and Objects Operations Note that instance object class diagram only shows important information

8 8 Staffordshire UNIVERSITY School of Computing Slide: 8 Objects and Classes Classes and Objects Encapsulation

9 9 Staffordshire UNIVERSITY School of Computing Slide: 9 Objects and Classes Classes and Objects Structured Systems vs O-O Design

10 10 Staffordshire UNIVERSITY School of Computing Slide: 10 Objects and Classes Classes and Objects Structured Systems Design Code: findAlbums Gototo record 1. test if titlecontains“Vol. 1” if so add it to the results list. Gototo record 2 … until all record tested Data: albums Data: albums Search for Albums Tab Data: results Data: results

11 11 Staffordshire UNIVERSITY School of Computing Slide: 11 Objects and Classes Classes and Objects OO System Design 2. addToAlbumList(artist=“My Artist”, title=“My Title”) 1. search(artist=“”, title=“*Vol 1*”, results=“Tab1:searchTab”)Tab1:searchTab :album

12 12 Staffordshire UNIVERSITY School of Computing Slide: 12 Objects and Classes Classes and Objects Finding Class Class Patterns Abbott analysis, otherwise known as a noun analysis. Involves looking though the documentation already generated about the system, and a particularly good source of information are the use case scripts but may also include e.g.:  Specifications  Notes from interviews  Questionnaire results

13 13 Staffordshire UNIVERSITY School of Computing Slide: 13 Objects and Classes Classes and Objects Finding Classes: Use Case Scripts

14 14 Staffordshire UNIVERSITY School of Computing Slide: 14 Objects and Classes Classes and Objects Class Hierarchies

15 15 Staffordshire UNIVERSITY School of Computing Slide: 15 Objects and Classes Classes and Objects Class Hierarchies

16 16 Staffordshire UNIVERSITY School of Computing Slide: 16 Objects and Classes Classes and Objects Class Hierarchies

17 17 Staffordshire UNIVERSITY School of Computing Slide: 17 Objects and Classes Classes and Objects Class Hierarchies

18 18 Staffordshire UNIVERSITY School of Computing Slide: 18 Objects and Classes Classes and Objects Polymorphism

19 19 Staffordshire UNIVERSITY School of Computing Slide: 19 Objects and Classes Classes and Objects Polymorphism

20 20 Staffordshire UNIVERSITY School of Computing Slide: 20 Objects and Classes Classes and Objects Links: Association

21 21 Staffordshire UNIVERSITY School of Computing Slide: 21 Objects and Classes Classes and Objects Links: Aggregation

22 22 Staffordshire UNIVERSITY School of Computing Slide: 22 Objects and Classes Classes and Objects Links: Composition

23 23 Staffordshire UNIVERSITY School of Computing Slide: 23 Objects and Classes Classes and Objects Link

24 24 Staffordshire UNIVERSITY School of Computing Slide: 24 Objects and Classes Classes and Objects Links

25 25 Staffordshire UNIVERSITY School of Computing Slide: 25 Objects and Classes Lecture Objectives Explain the idea of Classes and Objects Explain how O-O systems differ from Structured systems in terms of internal functions. Explain the idea of:  Encapsulation  Inheritance  Polymorphism Explain the idea of  Inheritance/Generalisation  Association  Aggregation and Composition

26 26 Staffordshire UNIVERSITY School of Computing Slide: 26 Objects and Classes Self-Test Questions What is the difference between a class and an object? What is the difference between an instance scoped attribute and a classifier scoped attribute? What are class packages, and why are they useful? What are class operations, and how are they invoked? What do we mean by the term encapsulation, and why is this a useful idea? What is the difference between the ways that data and code are treated in structured and O-O based systems? What are the common ways of identifying the classes for a system design? What do we mean by the terms inheritance, and what is another name for this term? What do we mean by the term super class? What is an abstract class? What is the main benefit of using a class hierarchy? What do we mean by the term polymorphism, and why is it a useful idea? How are associations, aggregations and compositions different from each other?


Download ppt "1 Staffordshire UNIVERSITY School of Computing Slide: 1 Objects and Classes."

Similar presentations


Ads by Google