M1-Lesson 1
M1-Lesson 1
PROGRAMMING 1
Module 1
2021
Object-oriented Programming 1
Table of Contents
Module 1 .....................................................................................................................................
Lesson 1 – Introduction to Object-oriented Programming....................................................
History ......................................................................................................................................
What’s different? ......................................................................................................................
What does object orientation mean? ........................................................................................
Objects and their interactions ...................................................................................................
Advantages of OOP .................................................................................................................
Disadvantages of OOP ..............................................................................................................
Object-oriented Programming 1
Rationale
The purpose of the module is to allow the student to gain knowledge on conceptualizing
and designing a web system/information system and the different applications used for the
concept or design implementation. The module also provides learning awareness that will help
the students produce a timely and fit web information systems. It expects that the students
should have at least a 95% passing result at the end of the module. To be able to achieve the
result, the student should be able to read the provided theories and concepts through the reading
materials, view video clips, participate in essential topics in forums, demonstrate activity output
if necessary, and pass the quizzes or tests. Additional reading materials are provided for the
student to gain a piece of advance information aside from the expected learning outcomes.
Lastly, the module requires the student to submit all requirements in a specific period.
The Learning Plan provides a guide to the student in achieving the desired learning
outcomes. Specifically, the learning plan may contain the following sections:
o Let's hit these. This section defines the learning objectives of the students expect to
achieve at the end of the lesson. It describes the knowledge and skills that will be
acquired by a student after completing each lesson.
o Let's get started. This section contains enabling activity, which includes pretest to
determine a baseline knowledge of the topic/s that is about to be learned. The pretest
may be in the form of a case study, video clip, quiz, or any related material that directs
the learner to the topics/s of the lesson.
o Let's find out. This section provides an analysis of the previously given enabling
activity. The said analysis will prepare the learner in moving to the next part of the
module.
o Let's read. This section covers text/readings and other related materials as inputs of the
lesson. This section also provides the student with the opportunity to study and review
the necessary information to understand the topic.
o Let's remember. This section serves as a summary of the lesson. It contains essential
information only that includes the key ideas and main points that are worth noting and
remembering by the students.
o Let's do this. This section allows the instructor to assess the learning of the students
based on the provided lesson or information necessary in achieving the objectives of
the module.
Object-oriented Programming 1
Module 1
Module title: Object-oriented Programming
Module description:
This course focuses on understanding Object-Oriented Programming fundamentals and
concepts. The course will demonstrate the theory and lecture discussion using Hypertext
Preprocessor (PHP) OOP and MySQL OOP. At the end of the course, the students should be
able to demonstrate the different procedural or functional approach of OOP. In addition, the
students should be able to explain the functionalities of OOP regardless of the programming
language utilized. Lastly, students should be able to implement OOP concepts using PHP and
MySQL.
Module Guide:
The students are required to participate in forums, answer the quizzes, case studies if
available, submit the output in individual/group activity, and take the pretest and post-test if
available. The provided reading materials (Let's Read Section & Suggested Readings) are the
necessary information to accomplish the said requirements.
Module Requirements:
At the end of this module, the students should have at least 75% passing grade in overall
quiz results, individual/group activities, forum/class participation, case study analysis, major
output, and major exams.
Key Terms:
OOP, PHP, Programming, HTML, CSS, JavaScript, Object-oriented
Learning Plan
Lesson No: 1
• List down the four foundations of OOP. Explain each based on your understanding
through adding real-world situation samples.
Let's read:
History
The principles of object-oriented programming1 were formulated during the 1960s and 1970s.
This new approach to programming emerged as a result of failed software developments during the
mid-1960s. This was the first time that software costs had exceeded hardware costs, a situation that
triggered the so-called “software crisis”.
But OOP did not gain in popularity until the mid-1980s and has become a widely accepted
computer programming concept during the intervening years.
Most modern programs for personal computers are written in the language C++. These
programs would be inconceivable today without object-oriented program ming. When it was time to
switch from C to C++, programmers were faced with the same paradigm shift as they are today in
automation engineering.
With the Internet age came new programming languages. Java is generally the most popular of
these because it was integrated very early on as a programming tool in WEB browsers. Java as well as
C# both fundamentally support object-oriented programming.
What’s different?
Object-oriented programming encapsulates functions and data in a single object. This means
that data are tightly coupled with the object and the programmer is free to decide the means by which
data may be accessed. Furthermore, in the event of a legal data access operation, it is possible to check
whether the data have been changed to meaningful values. These check mechanisms are capable of
preventing illegal changes to data and eliminating other error sources. The object has complete control
over all its responsibilities at all times.
In Figure 1 you can see two objects in human form communicating with one another. Let’s call
our objects Michael and Manfred. Michael asks Manfred whether he’s got a euro to spare. Manfred is
not willing to give away a euro. Since Manfred always retains control over his responsibilities and data,
Michael is not going to get a euro.
The old procedural programming method that comprises programs, subprograms, functions and
data breaks a task down into individual components. It thus uses a series of commands to define
algorithms which ultimately solve the task. However, a basic principal feature of procedural
programming is that data are not necessarily directly coupled with programs, subprograms or functions.
In other words, data are defined by the programmer and made public for use by programs and functions.
They can thus be globally accessed by any program. When the software is extended or modified,
however, the overall contexts within the data mesh are often not documented, creating an error source
which can lead to malfunctions in the processing plant.
In the example of communication between objects in human form, Manfred has now disclosed
his data in accordance with the procedural method (note: the term “objects” is not strictly correct when
referring to procedural programming). He has disclosed where he keeps his money. Anyone now has
access to it and can change the data (Figure 2). No communication takes place and Manfred is no longer
fully in control. He’s likely to have difficulties – the next time he goes shopping at the very latest.
This example illustrates a fundamental problem with procedural programming. Since there is
no means of limiting or channeling access to data, changes to data can give rise to sporadic and often
inexplicable errors that can be very difficult to locate.
With object-oriented programming, data and operations are uniquely assigned to the object.
The programmer has the option of specifying how data can be accessed and can therefore protect the
data. If data need to be changed for the purpose of the object function, this can only be done by
specifically programmed methods. These methods can include a mechanism for checking whether data
changes are mean ingful. Erroneous transfer of data that can cause processing errors is prevented. An
explanation (including examples) of how methods are programmed and used can be found in later
chapters. First of all, however, we are going to lay the foundation for helping you to understand the
basic principles of object-oriented programming.
means that changes in the behavior or the attributes of an object can only be effected in response to
requests (methods). The object itself decides according to existing (implemented) capabilities whether
or not it can fulfill the request. Pressing the accelerator pedal for our object car will not directly cause
it to accelerate if, for example, the engine is not running and/or the car is not in gear. To be able to drive
a car, the driver needs to understand its fundamental behavior but does not need to know exactly how
the car starts its own engine or accelerates. The only thing the driver needs to grasp is what has to be
done to get the car to start its engine.
We can therefore deduce that a car possesses externally accessible (public) methods and internal
methods that are not externally visible. A core principal of the object orientation concept is that access
to the internal data or functions of objects is not permitted. Data can be changed only by the methods
provided expressly for this purpose.
We have assimilated this view of the world as a series of objects and we find it easy to describe
and categorize them. We learn to handle and interact with objects from an early age. Based on this
insight, it is simply a question of logic when technical functions exploit this view of the world for their
own benefit. By applying this model to software, it becomes easier for us to understand many aspects
of software operation. This precisely was the driving force behind development of the object-oriented
programming concept.
Advantages of OOP
Object-oriented programming is a well-adopted programming style that uses interacting objects
to model and solve complex programming tasks. Two examples of popular object-oriented
programming languages are Java and C++. Some other well-known object-oriented programming
languages include Objective C, Perl, Python, Javascript, Simula, Modula, Ada, Smalltalk, and the
Common Lisp Object Standard.
Some of the advantages of object-oriented programming include:
1. Improved software-development productivity
Object-oriented programming is modular, as it provides separation of duties in object-
based program development. It is also extensible, as objects can be extended to include
new attributes and behaviors. Objects can also be reused within an across applications.
Because of these three factors – modularity, extensibility, and reusability – object-
oriented programming provides improved software-development productivity over
traditional procedure-based programming techniques.
2. Improved software maintainability
For the reasons mentioned above, objectoriented software is also easier to maintain.
Since the design is modular, part of the system can be updated in case of issues without
a need to make large-scale changes.
3. Faster development
Reuse enables faster development. Object-oriented programming languages come with
rich libraries of objects, and code developed during projects is also reusable in future
projects.
4. Lower cost of development
The reuse of software also lowers the cost of development. Typically, more effort is put
into the object-oriented analysis and design, which lowers the overall cost of
development.
5. Higher-quality software
Faster development of software and lower cost of development allows more time and
resources to be used in the verification of the software. Although quality is dependent
upon the experience of the teams, object-oriented programming tends to result in
higher-quality software.
Disadvantages of OOP
Some of the disadvantages of object-oriented programming include:
1. Steep learning curve
The thought process involved in object-oriented programming may not be natural for
some people, and it can take time to get used to it. It is complex to create programs
based on interaction of objects. Some of the key programming techniques, such as
inheritance and polymorphism, can be challenging to comprehend initially.
2. Larger program size
Object-oriented programs typically involve more lines of code than procedural
programs.
3. Slower programs
Object-oriented programs are typically slower than procedure-based programs, as they
typically require more instructions to be executed.
4. Not suitable for all types of problems
There are problems that lend themselves well to functional-programming style, logic-
programming style, or procedure-based programming style, and applying object-
oriented programming in those situations will not result in efficient programs.
References/Sources:
Online Videos:
• Object-oriented Programming in PHP. Retrieved from
https://www.youtube.com/watch?v=Anz0ArcQ5kI&list=PL0eyrZgxdwhypQiZnYXM
7z7-OTkcMgGPh
• What is Object-oriented programming? Retrieved from
https://www.youtube.com/watch?v=xoL6WvCARJY
• Object-oriented programming in 7 Minutes. Retrieved from
https://www.youtube.com/watch?v=pTB0EiLXUC8
Online Reading Materials
• Advantages and Disadvantages of OOP. Retrieved from
https://learn.saylor.org/mod/page/view.php?id=22041
E-Book:
• Braun, M., and Horn, W., (2017). Object-Oriented Programming with SIMOTION:
Fundamentals, Program Examples and Software Concepts According to IEC 61131-3.
Retrieved on July 29, 2021. Retrieved from https://book4you.org/book/3364782/e31ffb