100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Summary

Summary Grade 12 IEB IT Theory: Object Orientated Programming (OOP)

Rating
2.0
(1)
Sold
8
Pages
5
Uploaded on
18-07-2020
Written in
2019/2020

IT Theory Notes on the section of Object Orientated Programming (OOP) for the 2020 IEB Exams Created by a Student with an A for IT in Grade 11

Institution
Module









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Module

Document information

Uploaded on
July 18, 2020
Number of pages
5
Written in
2019/2020
Type
Summary

Subjects

Content preview

OOP UPDATED NOTES
OBJECT ORIENTATED PROGRAMMING


CHARACTERISTICS
 Emphasis on data rather than procedure
 Programs are divided into object
 Methods that use/change object data are in the same class
 Data is hidden and cannot be externally accessed
 Objects can communicate through methods
 New data/functions can easily be added


ADVANTAGES
 Modularity – object code can be changed/maintained independently from main
code. Objects can also be easily passed around the system
 Information-hiding – details of objects remain hidden outside of the object’s
methods
 Code re-use – if an object already exists, it can be reused in other people’s code
 Plug-ability and debugging ease - If a particular object turns out to be
problematic, you can simply remove it and replace it with a different object

CLASS

 It is a construct used to define a distinct new type and is made up of:
o Attributes/fields that are grouped together to describe the object
o Methods that describe what the object can do
 Class – A template or prototype to define the common attributes and behaviour
for all the objects of the class
 Examples: JFrame Form & Scanner

OBJECT

 Object – a dynamic instance of a class
 Is a software bundle of related state and behaviour
 Need to declare an object as an instance of the class (declaring doesn’t create it)

CONSTRUCTORS

 Constructor – used to create an object and set up fields of an object so that it is
ready to use
 You cannot call any of the class’ methods (unless the class is declared as static)
unless an object is created first
 A constructor must be declared as public and must be the same as the class’
name
 Default constructors:
o Does not have any parameters and is used to initialise the attributes with
default values
 Parameterised constructors:
o Contains parameters which are used to assign values to the corresponding
attributes

, o Partially parameterised: only part of the class’ attributes will be
assigned
o Fully parameterised: all attributes will be assigned custom values




ENCAPSULATING PRINCIPLE

 Encapsulation – a way of organizing data and functionality into a structure
(single unit) by concealing the way the object is implemented
o Allows restricted access to data
o Guarantees the integrity of the object’s data
o Visibility to the functionalities of the object, but not to its data
 Encapsulation principle – the class’ attributes should only be read/written by
methods of the class itself
o Encapsulating principle is also known as information hiding
 Information hiding – all fields and auxiliary methods are declared as private in
the class. Access to the data is limited to using Accessors and Mutators
 data abstraction – the concept of representing important details and hiding
away the implementation details


ACCESS SPECIFIERS AND MODIFIERS
 Access specifiers are used to identify access rights for the data and member
functions of the class
 It helps in implementing information hiding & data abstraction
 In Java, there are 3 access specifiers:
o Public – can be used by any function (“+”)
o Protected – can only be used by member functions and classes & function
of the class. They can also be used by classes derived from the class
(“#”)
o Private – can only be used by member functions and classes & functions
of the class (“-”)

DESTRUCTOR/GARBAGE COLLECTOR

 Destructor – a special method called when the object’s lifecycle is over in order
to free the memory and deallocate resources
o Used in languages with manual memory management
o Important to use to avoid memory leaks
 Garbage collector – program that runs on the JVM and recovers memory by
deleting objects that are not used anymore or are not accessible from the code
o Runs automatically and periodically checks the references in contrast to
the objects in the memory heap
o In Java you can access the Garbage Collector, however you cannot force
what memory will be release, just that you would like to release garbage
(System.gc() OR Runtime.getRuntime().gc() )
 The difference between a Destructor and a Garbage Collector is the level of
developer’s interference to memory management

ACCESSOR/GETTER METHODS

Reviews from verified buyers

Showing all reviews
1 year ago

2.0

1 reviews

5
0
4
0
3
0
2
1
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
verdaa17
Follow You need to be logged in order to follow users or courses
Sold
18
Member since
5 year
Number of followers
15
Documents
7
Last sold
10 months ago

2.0

1 reviews

5
0
4
0
3
0
2
1
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Frequently asked questions