‘Object-oriented programming is a programming paradigm that
represents concepts as "objects" that have data fields and associated
procedures known as methods.’ It means to represent the problem on hand in
objects. These objects have properties (variables) and methods (functions). The
biggest advantage of this, in my view, is that it becomes very easy to relate
the program to the ‘real’ thing.
Let’s consider the example of a vehicle. It would have
wheels, a fuel tank, would be able to move, etc. Writing this in a program
without OOP would be hard. But using this technique, we can easily write a
class with wheels, etc. as variables and functions for everything it does.
An important feature of OOP talked about in the class was of
Inheritance. It simply means that we can use the same code in a different program
without having to actually copy-paste it. Its biggest advantage, for me, is not
to write the same piece of code again, we are able to use the same debugged
code. There is always a possibility, even for the best of the programmers, to
make a small mistake in the program that he has previously written (maybe of a
semicolon which is very frustrating). Using inheritance, we can easily avoid
this. Other advantages include stuff like not having to make changes everywhere
when adding a feature to the code, or saving the labour of writing it again.
Good. Try to make your next post show a synthesis of your understanding of the topic beyond what you have read or heard in class.
ReplyDelete