Object Oriented Programming (OOP)
Since the beginning of CS 148, we've been working with classes, objects, instances, attributes, ... and we always hear the buzz work, "Object Oriented Programming". So, what exactly is OOP?
ob·ject
noun \ˈäb-jikt, -(ˌ)jekt\
a thing that forms an element of or constitutes the subject matter of an investigation or science
ori·ent·ed
adjective\ˈȯr-ē-ˌen-təd\
interested in a particular thing, activity, etc.
pro·gram·ming
noun\-miŋ\
Well... ya know... programming
Object oriented programming is a programming paradigm in which you have classes, and instances of those classes called Objects. Classes can be thought of as blueprints for the objects. Every object has attributes and some methods associated with it. The attributes store certain data about the object, and methods are procedures that can be executed on them.
Advantages of OOP:
- One of the main advantages of object oriented programming is that you can recycle code. Instead of writing all the code for every single object, you create a class, and get instances of the class.
- Modifications can be done in a much simpler fashion. If a certain attribute or method has to be changed, removed, or edited, one can do so by simply making the changes to the class.
- OOP forces programmers to plan well before writing their code, which is results in more robust code.
No comments:
Post a Comment