CSIT121 - Object Oriented Design and Programming

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

Objects in Software

They are the main building blocks in OOD. In programming, they make up the structure of software.

2
New cards

Object Interactions

They can communicate with each other by sending and receiving messages. When an object receives a message, it can respond with a result

3
New cards

Hidden Structures of Objects

When you use an object, you don’t need to know how it works on the inside. Its internal structure is hidden, which makes it easier to work with.

4
New cards

Main Purpose of Programs

This is to process data. They exist to take in info, work on it, and produce useful results.

5
New cards

Task of OOD

It is to split a system’s data and behaviour into a set of interacting objects. This makes the program easier to manage and understand.

6
New cards

OOD View of Programs

It represents a program as a collection of objects that interact with each other. Each object manages its own part of the work but connects with other objects to complete the system.

7
New cards

Role of Objects in Applications

They define what the program does. They are not just storage units but active parts that shape how the application works.

8
New cards

Object Roles

  • Data Provider

  • Service Provider

  • Controller

  • Constructor

  • Coordinator

An object may play one role, or it may take on serveral roles at the same time, depending on what the program needs.

9
New cards

Object Roles: Data Provider

It collects, stores and provides data for use in the program.

10
New cards

Object Role: Service Provider

An object offers services and performs computing tasks for the program.

11
New cards

Object Role: Controller

An object makes decisions about how the program should respond or behave

12
New cards

Object Role: Constructor

An object generates other objects and maintains the relationships between them.

13
New cards

Object Role: Coordinator

An object analyses events and delegates tasks to other objects.

14
New cards

Internal Structure of Objects

Each object contains data and methods to process that data. To interact with other objects, an object also includes interface methods. Interaction between objects is only possible through these interface methods.

15
New cards

Physical Form of an Object

An object is made up of binary data and microprocessor instructions. These occupy a reserved block of memory, but the actual layout is system-dependent.

16
New cards

Links between Objects

These can be created at compilation time, when the program is built, or dynamically at run time, while the program is running.

17
New cards

Logical Form of an Object

An object must be declared in your program through classes. When it is declared, it is given a unique name, which allows you to identify it and follow the relationships between all objects in the program.

18
New cards

Object-Oriented Analysis

Looking at a problem, system or task and identifying the objects and interactions between those objects.

19
New cards

Object-Oriented Design

Converting requirements into an implementation specification. Name the objects, define the behaviours, and specify object interaction

20
New cards

Object-Oriented Programming

Converting the design into a working program that does exactly what the customer wants

21
New cards

Object Identity

This means each object must have a unique identifier. This unique name allows the object to be recognised and ensures correct interaction with other objects. This can be specified by a programmer or assigned by another object acting as a constructor.

22
New cards

Object State

This refers to the actual values stored in it, which reflect the properties or attributes of the object. For example, a circle circle object might store values for its coordinates, radius and constant values like pi. Objects from the same class share attributes but may have different states.

23
New cards

Object Behaviour

This is what the object can do, defined by its supported actions called methods. These methods determine how an object acts and reacts to its role.

24
New cards

Object Mutator Methods

They can change the object’s state.

25
New cards

Object Accessor Methods

They only access values without changing them.

26
New cards

Meaning of ‘self‘ parameter in Python

This is a specific reference to the object that is calling the method. It makes sure the method knows which object it is working with.

27
New cards

Why ‘self‘ is needed in object methods

Object methods must contain an argument that refers to the objcet calling the method. It connects the method to the exact object that is using it.

28
New cards

‘self‘ and other functions

A normal function or a class method does not have the ‘self‘ argument. Only object methods require it, because they need to know which object is calling them.

29
New cards

Calling methods with and without ‘self‘

If you call a method using the object directly, Python assigns the object to the ‘self‘ argument automatically. But if you call it by class name without passing the object, Python will give an error because there is no value for ‘self‘.

30
New cards

Instance (Object) Variables

These variables are for data that is unique to each object. They are not shared with other objects. They are defined inside methods with the prefix ‘self‘. They are accessed using self.object-variable inside the class

31
New cards

Class (Static) Variables

These variables are for data that is shared by all objects of the same class. THey are defined outside methods but still inside the class. They are accessed using object.class-variable or class-name.class-variable.

32
New cards

Class Method

This is created using the @ decorator. Unlike an object method, it works with class variables instead of instance variables. To call one, you use the class name or the object name.

33
New cards

Difference Between Object and Class Methods

Python automatically passes the object name as the first argument for the object methods. For class methods, Python automatically passed the class name as the first argument.

34
New cards

Static Method

This is created using the @ decorator. It does not receive an object or a class automatically when called. To call one, you can use either use the class name or the object name. In both cases, no object or class reference is passed to it.