Presentation is loading. Please wait.

Presentation is loading. Please wait.

“Object-orientation” – what is it all about? Gill Harrison, Innovation North.

Similar presentations


Presentation on theme: "“Object-orientation” – what is it all about? Gill Harrison, Innovation North."— Presentation transcript:

1

2 “Object-orientation” – what is it all about? Gill Harrison, Innovation North

3 Aims and Objectives this week To appreciate what is meant by “object-orientation’ how it arose why it is a useful approach

4 What is Object-Orientation? A method of writing programs and developing software that is “oriented” (or orientated or directed) towards the use of objects

5 What are objects? A software object is

6 What are objects? A software object is something which holds both

7 What are objects? A software object is something which holds both data

8 What are objects? A software object is something which holds both data

9 What are objects? A software object is something which holds both data Stock Code Description Number in Stock Unit cost Stock object

10 What are objects? A software object is something which holds both data and the program instructions (organised into “methods”) for processing that data Stock Code Description Number in Stock Unit cost Stock object

11 What are objects? A software object is something which holds both data and the program instructions (organised into “methods”) for processing that data Stock Code Description Number in Stock Unit cost Stock object

12 What are objects? A software object is something which holds both data and the program instructions (organised into “methods”) for processing that data Stock object Stock Code Description Number in Stock Unit cost Method to change the Number in Stock Method to calculate value

13 How is a system built? One object can send a “message” to another asking it to perform one of its methods on its data

14 How is a system built? Stock Code Description Number in Stock Unit cost Method to change the Number in Stock Method to calculate value One object can send a “message” to another asking it to perform one of its methods on its data Stock object

15 How is a system built? Stock Code Description Number in Stock Unit cost Method to change the Number in Stock Method to calculate value One object can send a “message” to another asking it to perform one of its methods on its data an object dealing with goods received Stock object

16 How is a system built? Stock Code Description Number in Stock Unit cost Method to change the Number in Stock Method to calculate value One object can send a “message” to another asking it to perform one of its methods on its data increase your number in stock by 1000 an object dealing with goods received Stock object

17 If you’re interested (this is Java)... public class Stock { private String stockCode, description; private int numberInStock, unitCost; public void changeNumberInStock(.......) { some lines of program code here } public float calculateValue() { lines of code } methods data

18 If you have met programs before.. You will realise that programs generally have variables to hold data procedures and functions, which seem to be like methods calls to these procedures and functions, which seem like messages So what’s new about objects?

19 Encapsulation Stock Code Description Number in Stock Unit cost Method to change the Number in Stock Method to calculate value The details of data and methods are shielded from outside view or interference. This is called “encapsulation”.

20 Encapsulation Stock Code Description Number in Stock Unit cost Method to change the Number in Stock Method to calculate value The details of data and methods are shielded from outside view or interference. This is called “encapsulation”.

21 Encapsulation Just send me messages and I’ll send replies The details of data and methods are shielded from outside view or interference. This is called “encapsulation”.

22 A bit of history Objects arose via programming languages rather than via Analysis and Design In the 1960s, the first language to use objects was Simula, a simulation language. A vehicle or a lift could be modelled more easily this way

23 A bit of history in the 1970s, an important research team at Xerox Palo Alto Research Centre (Xerox PARC) produced –ideas about Graphical User Interfaces (GUIs) and –Smalltalk - the first pure O-O language Programs with GUIs are “event-driven” - these are much easier to write if you use software objects

24 Object-oriented Programming languages Simula - a simulation language Smalltalk - the first pure O-O language Eiffel C++ (C with objects) Java

25 Features of object-orientation We define a general class of objects we are interested in, e.g. students, customers, orders A specific individual of the class is called an object, or an instance We define attributes of the class, which will have particular values for each instance We define methods for the class, which any instance will be able to carry out in response to a message

26 Objects and Entities OBJECTSENTITIES classis likeentity type instanceis like occurrence attribute is like attribute? methodhas no equivalent -

27 Objects and Entities Objects seem like entities, with processing added in. But ERDs show entities and DFDs show processing.

28 Looking at DFDs and ERDs

29 It is almost as though an entity...

30 absorbs bits of processing

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45 Hey, I’m an object!

46 Evolution of Systems Analysis and Design methods Methods using Structure Charts and Data Flow Diagrams..... plus Entity Relationship Diagrams Object-Oriented Analysis and Design Methods

47 Relative maturity Mature Immature O-O Programming Languages O-O Databases O-O Analysis and Design

48 Object-Oriented Analysis and Design Methods Lots, often associated with the name of a person: Rumbaugh - Object Modeling Technique (OMT) Jacobsen - Object Oriented Software Engineering (OOSE) Booch Coad and Yourdon Wirfs-Brock Schlaer and Mellor

49 Object-Oriented Analysis and Design Methods Lots, often associated with the name of a person: Rumbaugh - Object Modeling Technique (OMT) Jacobsen - Object Oriented Software Engineering (OOSE) Booch Coad and Yourdon Wirfs-Brock Schlaer and Mellor have combined to create Unified Modeling Language (UML)

50 What use is it? Stock balance now held as –balance at stock-taking –total number received since then –total number issued since then Without objects - detailed changes to every program that deals with stock With objects - just change stock methods: other objects send the same messages as before

51 What use is it? Resilience to change - data is stable, processing is not Small changes are localised Far better chance of reusing objects than of reusing separate data and processes Standard classes (e.g. for GUI features like buttons, list boxes) make software development faster and easier

52 What use is it? These factors should give rise to faster development of software software than is more reliable and error-free software that is easier to change to meet new requirements

53 Achieved objectives? A software object holds: data (like an entity in an ERD) / processing (like a process in a DFD) / both? The hiding of the internal workings of an object is called Objects communicate by passing Why has Object-Orientation arisen?

54


Download ppt "“Object-orientation” – what is it all about? Gill Harrison, Innovation North."

Similar presentations


Ads by Google