Thursday, 19 March 2015

Week 6: A Summary of Object Oriented Programming Concepts

Object oriented programming is a type of programming language that revolves around storing data in "objects". These objects have properties and behaviour that can be accessed and utilized when solving problems pertaining to these objects. 

To better communicate how object-oriented programming actually works, let's take a look at an example of an object: a human. Humans have names, titles, addresses, phone numbers, and countless other instances of information that describe something about that particular human. Depending on what exactly you wanted to do with your human, you'd need different information. An employer would want a degree or diploma and a criminal record, if any, while a school looking at prospective applicants would want an academic transcript. A potential significant other would be more interested in this human's interests, hobbies, and, well, knowledge of a criminal record definitely wouldn't hurt. 

Working with these human objects involve needing the ability to access all of this information (ideally in a quick, convenient manner) and to update the information as our human conducts his life. In addition, though all humans have certain characteristics in common, some will require keeping track of additional information that other humans won't need to deal with. For example, a student will need a list of courses they're enrolled in, the name of the school they attend, and an academic transcript, to name a few things. In contrast, a carpenter would have absolutely no use for those things to help him or her perform as a carpenter. A doctor, a lawyer, and a teacher yet have different sets of data that they require that would lack any application or meaning in a different profession. And yet, all of these people need to keep track of basic information like their names.

Object oriented programming addresses all of these issues and more through implementing concepts like inheritance. You can create a general class that stores all the general information that every human needs, while creating subclasses for specialized humans that have specialized needs. You can easily access and modify all of this information to solve the various problems that arise with various different types of humans. An additional strength with OOP is that, without even looking at any of the source code of the super class, you can simply use the methods in the super class to create specialized methods by amalgamating the more general super class methods.

Object-Oriented programming is a powerful paradigm that provides a simple, straightforward way to translate complicated real world issues into code. 

No comments:

Post a Comment