Object Oriented Programming Terminology (With Cats)

If you do not have a computer science background, wading through the lingo of programming tutorials can be a challenge. So I took a detour in my app creation efforts to tackle some key terms to increase my understanding.

If you want to program an app for the iPhone or iPad using Apple’s Objective C programming language, it might help to back up and understand how object oriented programming is different from conventional programming. Why did Apple choose this language? What are its roots? How does it power the overwhelming response to app development for iDevices, which are pouring into the App Store at a tremendous rate?

Busting out books and searches on “Conventional Programming” and “Object Oriented Programming”, I discovered that conventional programming stems from a sequential list of tasks or commands. So the more complex programs become, the larger and more interdependent the code is to untangle if there is an issue. What comes to mind is a super long scroll like back in the olden days. If I had to reference something, I’d have to unroll the entire scroll.

Another approach is to chunk things out and organize them into similar groupings. This is where object oriented programming comes in, which segments code into discrete units that can be reusable. Each unit seems to have some sense of autonomy, like a set of instructions on how it can be put into action.

As soon as you start an iPhone programming tutorial, words like Method, Class and Object will come your way. When you look up a standard definition in a programming book, the non-programmer will come across something unhelpful like: “Object: A class that has been invoked and is active in your code.” Now, instead of having one term I don’t understand, I have two terms I don’t understand.

Thankfully, there are some Java tutorials (Java is an object oriented language) that provide real world analogies. I studied these real world analogies while looking at my unhelpful cat – and several of the concepts finally clicked into place!

IMG_1414

CLASS: I think of class as a “type of thing”, like the blueprint from which a thing is created. My cat comes from the “cat” class. This class has certain characteristics, such as four legs, fur and whiskers. This class also has subclasses, which I’ll address further in “inheritance”.

OBJECT: A real world object, like my actual cat, which is a specific instance of the “cat” class. Objects have a state (purring) and a behavior (lazy and mainly concerned about food or birds). If I could package my cat into a data structure complete with instructions about its state and behavior, then I would have an Object in the world of object oriented programming.

METHOD: A method is how the object behaves or functions, like a command that the object can perform. My cat likes to bat the mouse toy. So my understanding is that a “bat the mouse” Method would make my cat bat the mouse toy.

INHERITANCE: The ability to re-use or to share code between classes. So for example, if my pet cat is from the Cat class, it has some of the same properties as a Lion, which is also from the Cat class. However, my cat is from the Domestic subclass, and the Lion is from the Big Wild Cat subclass. The similar properties (four legs, whiskers, tail) are all part of the Cat class. The differences (meow vs. roar) are instances where the behavior of the subclass overrides the default behavior in the class.

After finally getting a sense of Object, Method and Class, I ran into more terms, like Array and and String. I believe these are general programming terms, but once I started with a real-world example it was hard to stop…

ARRAY: A collection of cats, like the figurines my daughter has in her toybox. A systematic way of organizing all of those little plastic cats so they aren’t strewn all over her room.

STRING: A string is a set of characters (numbers, letters, symbols) like the ones in our names or on a label. The string/s for my cat are Oreo, Kitters, or simply, The Cat.

I hope you enjoyed reading this excursion into terminology as much as I enjoyed writing it. Please don’t believe anything I say until I run it by a few of my programmer friends and get their validation or edits on the above.

9 Replies to “Object Oriented Programming Terminology (With Cats)”

  1. This about the coolest analogy I’ve seen – and I’ve seen a bunch. I smiled when I pictured a pile of plastic cats, too funny!

    These ideas are sound and very very helpful when thinking about how to organize code itself. I spend time exposing learners to the world of app making and I’ve found that organizing the app itself (not just the code) into easier to understand parts makes it much easier to conceptualize. I find myself talking in terms of “What does it do (method) and what does it look like (strings and values).

    Realizing that every app, 100% of them, big or small, famous or unknown, is nothing more than a collection of “screens” that look a certain way and behave a certain way. Tap this, get that. Tap that, show this. The transitions between screens and the details about how each screen behaves together become the app itself.

    Another way to put it: An app is like a clowder of cats, each with their own style, behavior, and personality. Figuring out how to organize them into a meaningful collection is the fun part.

    Note: A clowder is a group of cats.

  2. I love this! I wish I had your article to reference when I was trying to figure out these terms myself. It would also have saved my developer husband a lot of anxiety, as he frustrated me terribly by trying to answer my questions about one term with a series of new words I also didn’t understand. Bravo! Cheers to you and your cat.

  3. Thanks Mindy! It will be a long slow road, but I’m determined to continue to pull it back to the “real world” whenever possible. 🙂

  4. Learning object terms is relatively easy until you get into multiple inheritance. Then you have to say what happens when I combine a cat with an airplane.

    The real challenge is getting people to understand the “why”. I can implement objects in ANY language so what makes a language object-oriented? more importantly why do I care?

    It turns out the reason you care is that object concepts are closer to the way people think. All people… developers, domain experts, users, graphics artists. So rather than a designer drawing a cat and a domain expert defining its genus (Felis) and phylum (Chordata) and a developer building data structures and flow charts, all these people can talk about cats. This means when the domain experts realizes something was missed it is easy to explain to the developer (I skipped architect, etc). So “You need red fur on a fox” can be understood by developer without converting to a complex mathematical language first.

    This reduction in translation greatly speeds and improves the communication and often times the result. It also makes changes easier and since the majority of all software development is in maintenance this can drastically reduce cost. As an added bonus human brains like to think in object terms – we like to organize things by describing how they are like or not like other things. So while the definitions may confuse, the concepts of inheritance actually come quite naturally to most of us.

  5. Hi Scott,

    I really appreciate your in depth comment here, especially the part about how human brains “think”. I agree, we like to organize things, or categorize and group things.

    One of the reasons I am trying to understand these concepts (although the process is slow going) is so that more “non programmers” don’t assume a false boundary that they can’t also be builders.

    I don’t want to cut off options regarding my capabilities just because I didn’t have the foresight to pursue computer science in college. I need to pick up the tools and learn. Object oriented programming seems to at the surface level to try a little harder to relate – and I’m hoping that will be helpful down the line.

    Thanks for weighing in.

    Lorraine

  6. Nice article, very well written. I enjoyed this. Surely this would be useful for beginners. Sadly, I came across this nearly 12 months after it has been written.

    In 1989, Roger King of the University of Colorado write a paper entitled “My Cat is Object Oriented” published by ACM. You can see this at http://dl.acm.org/citation.cfm?id=66469.

Leave a Reply

Your email address will not be published. Required fields are marked *