Object Oriented Programming (OOP) is a framework for system design. This framework looks at all datastructures within the system as objects. These objects have attributes that define the object. Methods are used to manipulate data within these objects. Entities are external storages and human users of the system. An entity relationship model is a model that contains objects, methods and entities and their interactions with one another. Contemporary programmers use the OOP framework to design automated systems (docs.oracle.com). In this paper, we examine two key concepts of OOP and present a sample algorithm using OOP concepts.
Deborah J. Armstrong proposed some fundamental concepts to define the OOP framework (www.johnloomis.org). Many of these concepts were weeded out by Benjamin C. Pierce and other researchers (Pierce, 2002). The OOPS concepts that became universally accepted are dynamic dispatch, encapsulation, polymorphism, and inheritance. As per the requirements of this paper, two of the concepts – encapsulation and inheritance – are explained below.
Encapsulation refers to packaging the data and methods into a single unit. Object oriented programming uses classes to achieve this objective. Programming languages like Java use classes to include certain objects and methods to present data in a given format, perform calculations, or update data. Programmers use classes to encapsulate objects, methods and entities within a single unit. This enables them to present the user with information relevant to the user and hide all irrelevant information (en.kioskea.net).
Inheritance is the property of one class to be created from another class. The new class contains the properties of the original class. The relationship between the classes is defined as a parent-child relation where the new class is the child of the original class. Inheritance is also referred to as subclass. The advantage of inheritance is that new attributes can be applied to the attributes of the parent class without disturbing the structure of the parent class. Programmers create complex hierarchies using subclasses. Some classes are standardized and put in libraries for use in other structures. Such standardized classes and libraries are also sold commercially (en.kioskea.net).
The concept of OOP is not a new concept. With a view to understanding the concept and its constructs, we have presented detailed information about two of the main concepts of OOP – encapsulation and inheritance. We now present an algorithm for determining student grades.
This is a hypothetical grading system in a hypothetical university. Grades are awarded to students for tests conducted in class and as a part of periodic assessment. All these grades are summed up and an average is arrived at. The final exam grade is calculated separately. This consists of the grades for the written paper and for the thesis. The student is required to pass in both the class tests and the final exam. 40% is considered pas.
This algorithm is based on the OOP framework. Each identified process is a potential class in the automated system. The following steps or classes are envisioned.
- Enter the results of the various tests and assessments conducted.
- Sum up the grades for the various tests and arrive at the average A1.
- Enter the results of the final exam.
- Enter the results of the thesis.
- Sum up the results of the final exam and thesis and arrive at an average A2.
- Calculate the final grade by summing up the two averages A1 and A2.
- Calculate a new average a new average A3
- Calculate the overall percentage of marks.
- IF percentage (P) < 40 the student is declared FAIL
- ELSE the student is declared PASS.
Bibliography
Fundamental concepts of Object-Oriented Programming, n.d. Johnloomis.org. Available at: <http://www.johnloomis.org/ece538/notes/oop_principles/oop_wikipedia.html> [Accessed 06 December 2014].
OOP - Data encapsulation, November 2014. Kioskea.net. Available at: <http://en.kioskea.net/contents/421-oop-data-encapsulation> [Accessed 06 December 2014].
OOP – Inheritance, December 2014. Kioskea.net. Available at: <http://en.kioskea.net/contents/422-oop-inheritance> [Accessed 06 December 2014].
Lesson: Object-Oriented Programming Concepts, n.d. The JavaTM Tutorials. Available at: <http://docs.oracle.com/javase/tutorial/java/concepts/> [Accessed 06 December 2014].