× Terms of Use Privacy Policy

Take me back!! I want my CSS!! Click me to get back :)

×

READY FOR A NEW CAREER?

But not sure where to start? Find out if a tech career is right for you.

TAKE THE 3-MINUTE QUIZ

3 ways to say…object-oriented programming

One of the challenges of learning to code is that you have to wrap your head around a bunch of concepts that are, well, highly conceptual.

Image via Lino M.

One of the challenges of learning to code is that you have to wrap your head around a bunch of concepts that are, well, highly conceptual. Unlike more tactile skills where you might be able to see or touch what you are making, or at least see the process of making it, when you are programming you are in the difficult position of sending things out into the ether and waiting to see if it works (or hits you upside the head with an error message).

And since this stuff is hard to pin down and even harder to explain, there are 8,000 different ways to describe what each piece of the puzzle is and what it does.

We were recently doing research about object-oriented programming and found that there was a huge range of different methods that people are using to convey what object oriented programming is. So we wanted to share some different explanations with you and see, which ones resonated with you and which ones don’t.

Wikipedia says:

“An object-oriented program may be viewed as a collection of interacting objects, as opposed to the conventional model, in which a program is seen as a list of tasks to perform. In OOP, each object is capable of receiving messages, processing data, and sending messages to other objects. Each object can be viewed as an independent “machine” with a distinct role or responsibility. The actions (or “methods“) on these objects are closely associated with the object.”

Code Project says:

“In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.

An object can be considered a “thing” that can perform a set of related activities. The set of activities that the object performs defines the object’s behavior. For example, the hand can grip something or a Student (object) can give the name or address.”

Izzy Johnston of Girl Develop It says:

“Object-oriented programming is playing with virtual lego. Every lego is an object and it has something that’s called state, which are basically its attributes. The lego’s color, its size, whether it has bumps on the top or bumps on the bottom, whether it can connect to other legos. All of those attributes are that lego’s state.

Then legos also have behavior, which nerds call methods. Those behaviors are, can it be stacked on top of another lego? Can it be stacked underneath another lego? Is it, at this moment, being stacked on top of another lego?

Then what you do with all of these legos, is create other methods that say ‘bring all of these legos together and build a ship, then bring all of these legos together and build a castle, bring all of these legos together and build another ship.’

Finally, your final method is some kind of thing where the ships are firing canon balls at each other to get to the castle.”

As some of you already know, we are in the process of building web tutorials here at Skillcrush HQ. In the process, we are thinking a ton about two things: one, how do we find the simplest, most straightforward way to break down some of these more tricky concepts, and two, how do we make sure to give our readers a couple of different ways in which to learn (whether by reading text, looking at an illustration, or watching a video).

So tell us, which one of the above explanations resonates with you? Why? If none of them make sense, what could help? A video explanation? An illustration? A more concrete practical application?

Tell us in the comments!

Your email address will not be published.

23 comments

  1. AButter Replied

    The lego metaphor did it for me… I also like video/visual representation. Thanks!

  2. Amanda Replied

    The lego version was the easiest to understand – the Wikipedia explanation seems to have implied assumed knowledge.

  3. video, and infogrpahics… Kind of like the HTML cheat sheet. something you can put on your wall and look at anytime you’re in doubt

  4. Lego analogy is great for big picture, the Wikipedia one for more detail. I found the hands analogy confusing.

  5. When I tutor first year programming at university, I say that object-oriented programming is a convention where the data is stored and defined in the same place as the methods for operating on the data.

    This makes sense to me because we start off the course just introducing procedural programming, and then once the students start to write programs that are complex enough they want to start re-using code and making things more modular, then we introduce functions, and then once things get more complex again then we introduce classes and class methods.

  6. Emily Replied

    The wikipedia one by far because it was the only one that gave a comparison to a type of programming that wasn’t object-oriented! “as opposed to the conventional model, in which a program is seen as a list of tasks to perform”. Without this, no amount of analogies are useful.

  7. Cate Replied

    It was also helpful for me to know what OOP is not. What are other concepts and what makes this one different? Wikipedia places OOP in opposition to “the conventional model, in which a program is seen as a list of tasks to perform.” This helped me contextualize the idea.

  8. Bnova Replied

    The third one is the best explanation in my opnion. It is extremely clear and simple. Wikipedia entry is a bit heavy in my opinion and the hand analogy requires a bit more thinking and connecting the dots than the lego. Perhaps because lego pieces are inherently used as materials for making things, whereas I think of hands as something you coordinate those pieces with but you don’t make things out of your palms.

  9. d Replied

    The wikipedia one by far! It was clear and simple. As for the Girl Develop It version I have no idea what it was about and why did it talk about legos? The body and hands -metaphor made a little more sense, but it, too, made the whole concept of objects seem awfully complicated.

    For me such analogies often cloud the subject. I only like them as additional example material. If the to-the-point abstract definition is skipped all together and it’s straight to legos, I rarely understand a thing.

    Also I like graphs with bubbles and arrows. That’s how I think when I think of objects and method calls.

  10. ehren Replied

    I like the wikipedia one. It was clear and to the point. The others were helpful too but seemed to get stuck in the analogy. Maybe it is best to have all three. If they’re short enough it is all helpful.

  11. The Girl Develop It description is the only one that made any sense to me. Interesting how we all learn differently. It’d be nice to have something visual and not just text, though I love your emails and normally can grasp what topic is being discussed. In my Coursera-based COMPSCI101 class when the professor would lecture AND do example code at the same time it made it much easier for me to grasp then just reading.

  12. Alicia Replied

    The Code Project/ hand explanation makes more sense to me than the Lego one. It seems to have more similar structure.

  13. I like the way Alan Kay, inventor of Object Orientation (and the Graphical User Interface – interesting that both OO and GUI are about bringing metaphors to a process) puts it: “I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages.” Objects are metaphors for the real world things that they represent and thus can encapsulate the behavoir (logic) and attributes (data) of those things. Something like that. <3 Skillcrush can't wait to see more!

  14. Amanda Replied

    Definitely the lego one… but I think I’m still a bit confused.

  15. KSO Replied

    As someone who had heard of OOP before but really didn’t know anything about it, Izzy’s Lego explanation was clearest for me. As a visual and practical learner, I personally like explanations that use diagrams and practice but, when well-done, text, video tutorials or even mp3 files can be great ways to learn too. Can’t wait for Skillcrush’s tutorials – I know they’re going to be awesome just like everything else you’ve done so far! :)

  16. I’ve been struggling with trying to explain this, as someone who recently had to figure out what OOP was. Here’s how I would explain it. And it would help to have the expert eye tell me if I’m on the right track.

    In a normal human sentence you have a subject and predicate, which is the part of the sentence that needs at least a verb and an object. Subjects can act alone but mostly they act on objects. (E.g The human kicked the dog) But Objects never act ON subjects, and if you try and make them do that, it’s really bad writing (e.g. The dog was kicked by the human.) In programming, however, everything’s pretty much an object. Objects need to turn around in a lickety split and become a subject empowered with the ability to act on other objects, and they need a notation that gives them the power to do this without getting all bogged down what their position was in other commands. So you need a minimalist notation that gives them both attributes (that work kind of like adjectives) and methods (that work kind of like verbs, if you could pack verbs with all kinds of other verbs inside). This notation allows them to be both the actor, or the acted upon thing depending on what you as a programmer need them to be at that moment.

    Does this make sense.

  17. Logging in destroyed my comment. SO, no comment other than “not quite there yet.”

  18. ariannasimpson Replied

    I would say the Girl Develop it explanation is the most clear. The lego example is easier to follow than the hand-shoulder analogy. Thanks for sharing!

  19. Jess S Replied

    The CodeProject explanation makes the most sense to me.

Want more articles like this?

Sign up to get the most recent tech news, tips and career advice.