OOP (Object Oriented Programming)

Angela Geronimo
1 min readJan 1, 2017

--

Image by: https://webbootcamp.eu/wp-content/uploads/2016/09/636248_1cfd_2.jpg

Although this sounds like someone making a mistake, it is actually one of the oldest and basic forms of programming. The most important aspects of OOP are objects. Objects are mainly used for creating “blueprints,” (aka “constructors”) which can be used repeatedly to describe things.

OOP can be used by game developers as they use it to describe characters, locations, etc. We used OOP to create blueprints for books, cats and cars. We were also introduced to “this,” which is used in writing constructors. OOP is good for creating clones of the same type of thing with different properties. For those of you in AoE reading this, it’s similar to creating configurations in SolidWorks.

Keep in mind that constructors are essentially functions (aka “methods”) that act like objects. Here’s an example of a constructor:

//constructors start with capital letters
function Book(title, author, numPages) {
this.title = title;
this.author = author;
this.numPages = numPages;
}
var book = new Book(“Green Eggs and Ham”, “Dr. Seuss”, 34);
//instantiates book
//variable can have same name as constructor, but in lowercase

--

--