Object Oriented Programming H2: Software Design and Implementation
VerifiedAdded on 2023/05/28
|11
|2029
|404
Report
AI Summary
This report provides a comprehensive overview of object-oriented programming (OOP) principles and software engineering practices. It begins by outlining essential software engineering practices such as developing prototypes, testing, and repository maintenance. The report then delves into the core pillars of OOP: abstraction, encapsulation, inheritance, and polymorphism, providing Python code examples to illustrate each concept. It also discusses software design patterns, specifically the prototype design pattern. Furthermore, the report includes a class diagram and descriptions for a system involving staff and activities, showcasing inheritance and polymorphism in practice. The main method and its functionalities, including user authentication and activity management, are also explained. The document concludes by emphasizing the use of inheritance in creating a hierarchical structure for activity classes.

Running head: OBJECT ORIENTED PROGRAMMING
Object Oriented Programming
Name of the student:
Name of the University:
Author note:
Object Oriented Programming
Name of the student:
Name of the University:
Author note:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

1
OBJECT ORIENTED PROGRAMMING
Task 1
A)
Some of the most important software engineering practices are as follows:
Developing prototypes: This helps to create a small instance of the entire project and
further analyse it to understand the underlying flaws and benefits of the system which
can further be crept into the main system with better polishing. This is one of the main
practices that needs to be adapted if an Object Oriented based software is needed to be
developed. It helps to build a particular part of the software with only a few objects
created and the others defined. This will allow the developers to clearly understand
the working of the entire system with each part working out separately.
Testing: All software products needs to be thoroughly tested before being deployed
and delivered to the client. This includes both White-box (Unit testing) and Black-box
(Integrated Testing) testing.
Repository Maintenance: This is the practice that allows users to keep all their works
in place. Even if new changes are made to the program, the previous pieces of code
lives on and can be later reviewed or adapted.
B)
Object Oriented Programming is the most commonly used and known programming
paradigm. It is widely used in developing software programs and other valuables as it helps
the programmers or the developers to create a replica of the system being developed. This
helps to instantiate a real-life model of the entire system with the main entities, their
attributes and their underlying relationships. This mode of programming makes use of classes
and objects to achieve the objectives. Classes are the blueprints consisting of all internal
details including behaviours and characteristics. Objects on the other hand are the instances
OBJECT ORIENTED PROGRAMMING
Task 1
A)
Some of the most important software engineering practices are as follows:
Developing prototypes: This helps to create a small instance of the entire project and
further analyse it to understand the underlying flaws and benefits of the system which
can further be crept into the main system with better polishing. This is one of the main
practices that needs to be adapted if an Object Oriented based software is needed to be
developed. It helps to build a particular part of the software with only a few objects
created and the others defined. This will allow the developers to clearly understand
the working of the entire system with each part working out separately.
Testing: All software products needs to be thoroughly tested before being deployed
and delivered to the client. This includes both White-box (Unit testing) and Black-box
(Integrated Testing) testing.
Repository Maintenance: This is the practice that allows users to keep all their works
in place. Even if new changes are made to the program, the previous pieces of code
lives on and can be later reviewed or adapted.
B)
Object Oriented Programming is the most commonly used and known programming
paradigm. It is widely used in developing software programs and other valuables as it helps
the programmers or the developers to create a replica of the system being developed. This
helps to instantiate a real-life model of the entire system with the main entities, their
attributes and their underlying relationships. This mode of programming makes use of classes
and objects to achieve the objectives. Classes are the blueprints consisting of all internal
details including behaviours and characteristics. Objects on the other hand are the instances

2
OBJECT ORIENTED PROGRAMMING
of these classes, which can be several in number. The main pillars of Object Oriented
Programming are as follows:
1. Abstraction: Abstraction is the process of hiding the internal and irrelevant details in
order to highlight only those that are essential to the user or the object. This can be
related to a real life example where only the car is displayed to a customer instead of
revealing all the internal parts individually. Data abstraction is used in object oriented
programming in order to ignore the irrelevant attributes of the class and presenting
only the necessary attributes for utilization in the objects. It is these behaviours and
properties of an object that differentiate it from other similar objects and in turn helps
in organizing or classifying them individually. Abstraction allows the initiation of
many background attributes and methods which are not necessarily used in the exact
way meant to. This is how the background details are concealed.
OBJECT ORIENTED PROGRAMMING
of these classes, which can be several in number. The main pillars of Object Oriented
Programming are as follows:
1. Abstraction: Abstraction is the process of hiding the internal and irrelevant details in
order to highlight only those that are essential to the user or the object. This can be
related to a real life example where only the car is displayed to a customer instead of
revealing all the internal parts individually. Data abstraction is used in object oriented
programming in order to ignore the irrelevant attributes of the class and presenting
only the necessary attributes for utilization in the objects. It is these behaviours and
properties of an object that differentiate it from other similar objects and in turn helps
in organizing or classifying them individually. Abstraction allows the initiation of
many background attributes and methods which are not necessarily used in the exact
way meant to. This is how the background details are concealed.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

3
OBJECT ORIENTED PROGRAMMING
Example in python:
class AbstractClassExample (ABC):
def __init__(self, value):
self.value = value
super ().__init__()
@abstractmethod
def do_something (self):
pass
class DoAdd42 (AbstractClassExample):
def do_something (self):
return self.value + 42
class DoMul42 (AbstractClassExample):
def do_something(self):
return self.value * 42
x = DoAdd42(10)
y = DoMul42(10)
print (x.do_something())
print (y.do_something())
OUTPUT
52
420
2. Encapsulation: Encapsulation in object oriented programming is defined as the
process of wrapping up of data into single module known as the class. When objects
OBJECT ORIENTED PROGRAMMING
Example in python:
class AbstractClassExample (ABC):
def __init__(self, value):
self.value = value
super ().__init__()
@abstractmethod
def do_something (self):
pass
class DoAdd42 (AbstractClassExample):
def do_something (self):
return self.value + 42
class DoMul42 (AbstractClassExample):
def do_something(self):
return self.value * 42
x = DoAdd42(10)
y = DoMul42(10)
print (x.do_something())
print (y.do_something())
OUTPUT
52
420
2. Encapsulation: Encapsulation in object oriented programming is defined as the
process of wrapping up of data into single module known as the class. When objects
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

4
OBJECT ORIENTED PROGRAMMING
of this class are further created, these data members or member methods are included
in each of these instances. Encapsulation further ignites the concept of data hiding,
where only planned out data is made available for access to the outer classes through
the use of private, public and protected techniques. This helps to confine all necessary
data elements into one unit and accessible through it and also makes sure the data is
kept secured from alien class access.
Example in python:
class test (object):
def __init__(self):
self.x = 123
self._y = 123
self.__z = 123
obj = test ()
print (obj.x)
print (obj._y) #should not be accessed by convention, but however no error. Print
(obj.__z) #cannot be accessed as it is a hardcore private variable (Error)
OUTPUT
123
123
Traceback (most recent call last):
File "new.py", line 10, in <module>
print(obj.__c)
AttributeError: ' test ' object has no attribute '__z'
3. Inheritance: This is one of the most important aspects of the object oriented
programming paradigm. Inheritance refers to the ability of a program in which a class
can be so designed for it to inherit certain or all properties from its parent class. This
means that the data members or member methods from the parent class can be
inherited by the child classes and used accordingly. Inheritance is very helpful in
order to set up a meaningful relationship between related classes of the same type or
genre. This technique allows the child classes to have pre-defined member variables
and member methods that were previously initialized in the parent or the base class.
OBJECT ORIENTED PROGRAMMING
of this class are further created, these data members or member methods are included
in each of these instances. Encapsulation further ignites the concept of data hiding,
where only planned out data is made available for access to the outer classes through
the use of private, public and protected techniques. This helps to confine all necessary
data elements into one unit and accessible through it and also makes sure the data is
kept secured from alien class access.
Example in python:
class test (object):
def __init__(self):
self.x = 123
self._y = 123
self.__z = 123
obj = test ()
print (obj.x)
print (obj._y) #should not be accessed by convention, but however no error. Print
(obj.__z) #cannot be accessed as it is a hardcore private variable (Error)
OUTPUT
123
123
Traceback (most recent call last):
File "new.py", line 10, in <module>
print(obj.__c)
AttributeError: ' test ' object has no attribute '__z'
3. Inheritance: This is one of the most important aspects of the object oriented
programming paradigm. Inheritance refers to the ability of a program in which a class
can be so designed for it to inherit certain or all properties from its parent class. This
means that the data members or member methods from the parent class can be
inherited by the child classes and used accordingly. Inheritance is very helpful in
order to set up a meaningful relationship between related classes of the same type or
genre. This technique allows the child classes to have pre-defined member variables
and member methods that were previously initialized in the parent or the base class.

5
OBJECT ORIENTED PROGRAMMING
This helps in curbing off code complexity and encourages re-usability of code. The
members that have already been defined in the parent class needs not anymore be
defined in the children. In addition, apart from the inherited properties, the child class
can have other data members as well which will be its own.
Example in python:
class User:
name = ""
def __init__(self, name):
self.name = name
def printName(self):
print "Name = " + self.name
class Programmer(User):
User.__init__ (self, name):
self.name = name
def doPython(self):
print ("Programming Python")
brian = User("brian")
brian.printName()
diana = Programmer("Diana")
diana.printName()
diana.doPython()
OBJECT ORIENTED PROGRAMMING
This helps in curbing off code complexity and encourages re-usability of code. The
members that have already been defined in the parent class needs not anymore be
defined in the children. In addition, apart from the inherited properties, the child class
can have other data members as well which will be its own.
Example in python:
class User:
name = ""
def __init__(self, name):
self.name = name
def printName(self):
print "Name = " + self.name
class Programmer(User):
User.__init__ (self, name):
self.name = name
def doPython(self):
print ("Programming Python")
brian = User("brian")
brian.printName()
diana = Programmer("Diana")
diana.printName()
diana.doPython()
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

6
OBJECT ORIENTED PROGRAMMING
OUTPUT:
Name = brian
Name = Diana
Programming Python
4. Polymorphism: Polymorphism is a term inspired from its usage in chemical
engineering. Poly means ‘many and Morphus means ‘forms’. Polymorphism in object
oriented programming defines the use of one or more methods in different forms. A
particular method can be defined with various names but having a different set of
parameters or arguments will able it to practice polymorphism fruitfully. This too
enhances good programming practices as similar types of tasks can be performed
using only methods of a similar name. Another form of polymorphism is exhibited
with inheritance and is known as overriding. Here, the objects can call the methods of
their respective classes even though other child or parent classes have the same named
methods.
Example in Python:
class Bear(object):
def sound(self):
print "Groarrr"
class Dog(object):
def sound(self):
print "Woof woof!"
def makeSound(animalType):
animalType.sound()
bearObj = Bear()
dogObj = Dog()
OBJECT ORIENTED PROGRAMMING
OUTPUT:
Name = brian
Name = Diana
Programming Python
4. Polymorphism: Polymorphism is a term inspired from its usage in chemical
engineering. Poly means ‘many and Morphus means ‘forms’. Polymorphism in object
oriented programming defines the use of one or more methods in different forms. A
particular method can be defined with various names but having a different set of
parameters or arguments will able it to practice polymorphism fruitfully. This too
enhances good programming practices as similar types of tasks can be performed
using only methods of a similar name. Another form of polymorphism is exhibited
with inheritance and is known as overriding. Here, the objects can call the methods of
their respective classes even though other child or parent classes have the same named
methods.
Example in Python:
class Bear(object):
def sound(self):
print "Groarrr"
class Dog(object):
def sound(self):
print "Woof woof!"
def makeSound(animalType):
animalType.sound()
bearObj = Bear()
dogObj = Dog()
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

7
OBJECT ORIENTED PROGRAMMING
makeSound(bearObj)
makeSound(dogObj)
OUTPUT:
Groarrr
Woof woof!
C)
In software engineering, a commonly occurring software problem can be solved using
a general repeatable solution. This solution or set of solutions is known as a software design
pattern. Unlike a finished design documentation that can be directly converted into a
developed programming prototype, it is merely a template that can be used to solve an
individual problem that is recurring in nature within the system, or in other, it is a description
documentation of a solution that can be used in many situations within the bigger problem.
Prototype design pattern is one very important creational design documentation
process. In object oriented programming modules, prototypes are designed in order to guide
the program by mentioning the kind of objects that are to be used with multiple instances for
the entire problem.
Task 2
A) Class Diagram
OBJECT ORIENTED PROGRAMMING
makeSound(bearObj)
makeSound(dogObj)
OUTPUT:
Groarrr
Woof woof!
C)
In software engineering, a commonly occurring software problem can be solved using
a general repeatable solution. This solution or set of solutions is known as a software design
pattern. Unlike a finished design documentation that can be directly converted into a
developed programming prototype, it is merely a template that can be used to solve an
individual problem that is recurring in nature within the system, or in other, it is a description
documentation of a solution that can be used in many situations within the bigger problem.
Prototype design pattern is one very important creational design documentation
process. In object oriented programming modules, prototypes are designed in order to guide
the program by mentioning the kind of objects that are to be used with multiple instances for
the entire problem.
Task 2
A) Class Diagram

8
OBJECT ORIENTED PROGRAMMING
B) Class Descriptions
The Staff class holds the base for the basic details of all the staffs that are to be added
to the program. Each staff has attributes for their basic details and an additional list entity to
hold the activities that are assigned to each of these staffs.
The Activity class holds the basic details for each activity like their names and date.
Furthermore, it acts as the parent or the base class for the other two General activity and
Investigator activity classes. It also has a display class that is inherited by the child classes
and used by utilizing the polymorphism technology.
The GeneralAct class is one of the two child classes of the Activity class. It has all
the basic attributes of its parent class and in addition to that it beholds a Time constraint data
attribute. It overrides the Display() method definition from the parent Activity class.
The InvestigatorAct class is one of the other child class of the Activity class. It too
has all the basic attributes of its parent class and in addition to that it beholds a the resource
attribute that the investigator requires for the particular activity and a status that is primarily
OBJECT ORIENTED PROGRAMMING
B) Class Descriptions
The Staff class holds the base for the basic details of all the staffs that are to be added
to the program. Each staff has attributes for their basic details and an additional list entity to
hold the activities that are assigned to each of these staffs.
The Activity class holds the basic details for each activity like their names and date.
Furthermore, it acts as the parent or the base class for the other two General activity and
Investigator activity classes. It also has a display class that is inherited by the child classes
and used by utilizing the polymorphism technology.
The GeneralAct class is one of the two child classes of the Activity class. It has all
the basic attributes of its parent class and in addition to that it beholds a Time constraint data
attribute. It overrides the Display() method definition from the parent Activity class.
The InvestigatorAct class is one of the other child class of the Activity class. It too
has all the basic attributes of its parent class and in addition to that it beholds a the resource
attribute that the investigator requires for the particular activity and a status that is primarily
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

9
OBJECT ORIENTED PROGRAMMING
set to negative, to mark that the resources have not yet been received. It too overrides the
Display() method definition from the parent Activity class, in order to produce a different
display result as compared to the General Activity objects that has a different set of attribute.
The main() method is the driver or the controller of the program. It has the list to
store all the newly added staffs. It displays the required menu to the user. A staff can use the
system to add new staff entities and also add new activities to them. The Vice-principal is
treated as the administrator of the system. He needs to sign into the system with a registered
password (“asdqwe”). On validation of the password, the VP will be allowed to review all the
staffs and their activity details added to the system. Furthermore, he or she can also access the
resource status of the investigator staffs and update them to “Received” in case not already
set as so. In this way, a track of the whole can be kept by the VP or the administrator.
OBJECT ORIENTED PROGRAMMING
set to negative, to mark that the resources have not yet been received. It too overrides the
Display() method definition from the parent Activity class, in order to produce a different
display result as compared to the General Activity objects that has a different set of attribute.
The main() method is the driver or the controller of the program. It has the list to
store all the newly added staffs. It displays the required menu to the user. A staff can use the
system to add new staff entities and also add new activities to them. The Vice-principal is
treated as the administrator of the system. He needs to sign into the system with a registered
password (“asdqwe”). On validation of the password, the VP will be allowed to review all the
staffs and their activity details added to the system. Furthermore, he or she can also access the
resource status of the investigator staffs and update them to “Received” in case not already
set as so. In this way, a track of the whole can be kept by the VP or the administrator.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

10
OBJECT ORIENTED PROGRAMMING
Task 3
B)
The Activity class has been used as the parent class and the GeneralAct and
InvestigatorAct classes as its child classes. They both are required to have the same set of
basic attributes and methods like an activity name, initiation date and the display() member
method. However, the activity stats of a general staff will be different from that of an
investigator’s. Therefore, inheritance was used here. The general staff will have a general
activity object under its tally with a time constraint as the attribute where as an investigator
staff will store and access InvestigatorAct objects with a resource and receive status attribute.
OBJECT ORIENTED PROGRAMMING
Task 3
B)
The Activity class has been used as the parent class and the GeneralAct and
InvestigatorAct classes as its child classes. They both are required to have the same set of
basic attributes and methods like an activity name, initiation date and the display() member
method. However, the activity stats of a general staff will be different from that of an
investigator’s. Therefore, inheritance was used here. The general staff will have a general
activity object under its tally with a time constraint as the attribute where as an investigator
staff will store and access InvestigatorAct objects with a resource and receive status attribute.
1 out of 11
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.