You are on page 1of 6

OBJECT ORIENTED PROGRAMMING

(https://medium.com/from-the-scratch/oop-everything-you-need-to-know-about-object-oriented-
programming-aee3c18e281b

https://assignmenthelp4me.com/article-advantages-and-disadvantages-of-object-oriented-
programming-161.html)

NOTE – The below is the summary (in formatting of notes) in to note making. Make notes
out of it. And make summary also a in style of summary.
1) Object oriented programming
a) (incomplete) (What) – a programming paradigm which organizes methods and data
related to an entity in a single unit. The key concepts are -
i) Class –
ii) Object –
* Message passing (given below. Only tell if asked) [2]
b) Pillars/features of OOPS (Explain each with the same real-world object)
i) Encapsulation
(In the other laptop)
ii) (incomplete) Abstraction
iii) (incomplete) Inheritance
iv) (incomplete) Polymorphism
c) Why OOPS IS BETTER THAN PROCEDURAL
i) (incomplete) Problems with procedural.
ii) Then tell advantages of OOPS (given below) leaving ii) point, because it is
provided by procedural through functions.
d) (WHY) Advantages of OOPS / Why OOPS
i) MAIN REASON TO USE OOPS IS THAT IT - Gives better understanding to
programmers by organizing methods and data related to an entity in a single unit
(ex - data and methods of a car (entity) can be enclosed in a car class).
(encapsulation) (* read Quora answer below for more [1]). (Show this by making a
code, which involves multiple entities, in procedural and then converting it to
oops and you will notice how better it becomes in terms of understanding).
ii) Allows code reusability (inheritance).
iii) Enhanced security - as we can control the access of code using access specifiers
like private, we make sure that the data is not accidently changed by other parts
of code, increasing the security. (data hiding – part of encapsulation).
iv) (INCOMPLETE) Helps reduce complexity (in medium.com article – using
abstraction)
v) OOP makes fixing bugs easier. Fixing an error contained in a well-structured class
is easier than finding the error in multiple places in code.
e) (WHY NOT) Disadvantages of OOPS
i) In comparison to procedural approach, programs developed with Object
Oriented Programming language are large in size. Not only this, it requires
additional resources for its implementation which can lead to runtime overhead
issues.
The increased line of code will also have a significant impact on the processing
time. This is because of the instructions that are added in the program logic and
thereby these instructions will require comparatively more processing time for its
execution. Recommendation
ii) The concepts included in Object Oriented Programming are a bit more complex
than the procedural programming languages. Therefore, it might become difficult
for programmers or coders to understand their complex working in the initial
development phase. For instance- concepts of polymorphism, abstraction and
inheritance are little hard to comprehend. Therefore, it can be said that
programming using Object Oriented requires a specialized skill set in developing
program logics. Otherwise, it may become difficult for programmers to manage
and debug the code.
iii) Majority of programs created using the Object-Oriented model are more efficient
and flexible in nature, yet there are some limitations to it. One such limitation is
the inability of these programs to fit in every situation. In such cases, other
programming languages such as functional or other procedural programming
languages are more suitable to solve such problems.
iv) There is another functionality of message passing in OOP methodology which
enables objects of different classes to share data using message passing
techniques. However, in the case of complex software applications, it might be a
challenging task to track messages among different instances. Thus, it increases
overall processing time in debugging of software modules.
ADDITIONAL INFO
1. Answer on Quora

2. Message passing –
There are two definitions in widespread use, which refer to two completely different things.

The definition from SmalltalkLanguage: A message is simply a method call on an object.


Smalltalk messages are perfectly synchronous (the caller waits for the callee to return a value),
and not terribly different then function/method calls in other languages. A few key points about
Smalltalk message passing:
 Like C/C++/Java/ML/Lisp/Scheme, and unlike Haskell, Smalltalk messages are strict--all
arguments are evaluated before the message is sent.
o However, Smalltalk blocks make it very easy to
implement LazyEvaluation or NormalOrderEvaluation semantics
(see SmalltalkBlocksAreThunksInDisguise). Simply pass a block as an argument,
and the contents of the block won't be evaluated until someone passes the
block the "value" message (or value: or value: value:, etc.) SchemeLanguage has
a similar mechansim with delay and force. (See ExplicitLazyEvaluation)
 Like C++ and Java (and unlike CommonLispObjectSystem, DylanLanguage, etc.), Smalltalk
messages are SingleDispatch. The types of the arguments have no say in what method is
selected to receive the message), though Smalltalk makes delegation easy.
 The syntax of Smalltalk message invocations is somewhat unusual, though highly
readable once you get used to it.

The definition from many concurrent programming paradigms: A message is a method


for asynchronous dispatch, and used to communicate between different processes (which may
run on different machines). Different concurrent models have different semantics regarding
messages, such as whether or not the receiver and sender must rendezvous, whether or not the
receiver must name the sender, etc. See MessagePassingConcurrency and ProcessCalculi for
more information.

3. Why OOPS is called prioritizing data over code? (In reality both are important and this
question is useless but you have included this so that you can answer if asked in
interview. DON’T CONNECT THIS ANS WITH NOTES AND GET CONFUSED. KEEP IT A
SEPARATE STANDALONE ANSWER)
This approach is called prioritizing data over code (explained in video given in folder).

4. Bottom-up vs Top-down (again this is also redundant as oops can be both bottom up
and top-down, as explained in next answer, but included to answer if asked in
question).
5.

You might also like