1/30
Basically Topic 4 and answers to past paper questions.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Nature of an Object
Contains attributes and behaviours. Defined by a class.
Class
The blueprint from which an object is created, defining the attributes and behaviours of the object.
Instantiation
Process of using a class constructor to create an object. Uses keyword new.
Inheritance (is-a)
Solid line and hollow arrowhead from child to parent. Allows a class to have the behaviour and attributes of another class.

Aggregation (has-a)
Relationship between two classes where an object of one class has an object of another. Solid line with unfilled diamond closest to the container class.

Dependency
Exists between two classes if the changes to the definition of one may cause changes to the other (but not the other way around). Dashed line with open arrow.

Why are dependencies bad?
Decrease reuse
Reduces development speed
Reduces code quality
Reduces code readability
Harder to maintain code
How can dependencies be reduced?
Interfaces and abstract classes → reduces coupling to one single class. Now applies to “umbrella” of classes.
Encapsulation
The process of combining variables and methods in a single package called a class
Data type
Specifies the size and type of values that can be stored in an identifier or variable
Polymorphism
A programming languages ability to handle different data types with the same interface. This presents as:
Method Overloading
Method Overriding
Method Overloading
Occurs at compile time. Defining more than one method with the same name (constructor).
Method Overriding
Occurs at run time. The ability to redefine methods for subclasses (inheritance).
Advantages of Polymorphism
Common Interface → one name for multiple implementations.
Extensibility → programs can handle new types of data without restructuring existing code.
Code Reuse → common interface, so methods can be reused.
Simple maintenance → reduces complex statements → cleaner code + easier to debug
Advantages of Encapsulation
Simplifies interaction between objects.
Hides the internal details of how an object does something.
A class can change its internal implementation without hurting the overall functionality of the system.
Prevents code from accidental corruption due to programming errors.
Advantages of Inheritance
Code Reuse → don't have to rewrite common code.
Extensibility → code is well structured so easier to expand or update.
Easier Maintenance → code is well structured so it is easier to maintain.
Advantages of code libraries
Increased productivity → programmers don't have to "reinvent the wheel."
Efficient code → code is typically stable and optimized.
Code reuse
Disadvantages of OOP
Size → programs are generally larger than normal programs.
Speed → generally slower than normal programs.
Effort → programs require a lot more time and effort to create.
Learning → there is a larger learning curve when it comes OOP development.
Modularity
The process of creating software modules/sub-programs that can then be combined.
Use of programming teams
Team approach → multiple programmers working on the same piece of source code allows strengths to make up for collective weaknesses; also increases productivity with share responsibilities.
Advantages of modularity
Code reuse
Easier maintenance → easier to debug, modify
Better usability —> easier to read
Increased production → makes program development faster
Internationalisation
The Unicode character set has a set large enough to store every language in the world. Program’s UI can be customised to meet the needs of users.
Moral and Ethical obligations of programmers
Advantages of Open Source Movement
Collaborative and transparent approach
Software is more accessible
More affordable/cost-effective solutions
Software is more flexible/tailored to needs → higher quality
Object reference
A variable that stores the memory address of an object.
Advantages of binary tree over static array
Faster searching
Memory efficient
Can grow and shrink dynamically
Supports ordered storage → efficient retrieval
Disadvantage of binary trees
Uses more memory → each node stores extra pointer
Deleting a node is complex
Trees require careful pointer management/maintenance
Disadvantages of Open Source Movement
Security risks with openly accessible code
Leads to licence violations and propriety issues
Applications of Circular Linked Lists
Playlist
Round-robin scheduling
Implement queue/dequeue
Image galleries
Applications of Queues
Printer queue
Storing client service requests
Multitasking OS/Scheduling → manage multiple processes
Applications of Stacks
Parsing expressions in compiler
Supporting the ‘undo’ feature
History of links in Web browser