NOTE: Learn more about object-oriented programming and other concepts on your teacher dashboard. Each unit has an overview that explains the concept in detail. https://dashboard.kodable.com/#/curriculum/8
This video is going to briefly cover the 4 units you’ll be learning about and teaching in Object Oriented Programming. This video is information-heavy—but don’t worry! This is meant to frontload object-oriented programming for you and you’ll be learning more about all of these concepts in depth later.
Definition: Object-Oriented Programming is a programming language paradigm that categorizes pieces of code into logical, self-contained ‘objects.’ Each object in a program is responsible for its own defined set of tasks in the program.
Example: So, a programming language paradigm? What does all of the technical jargon actually mean? Object Oriented Programming is a lot like how the world around us works, which makes it much easier to understand:
Consider the world as a giant collection of objects. Some objects are similar to each other, and some are not. Object-Oriented programming mirrors how objects interact with each other to do things.
Let’s use an example of a specific group of objects here. Think about vehicles, like cars, trucks, vans, or convertibles. All vehicles are fundamentally similar, which is why there is a general name for this category of things: vehicles.
In programming, groups of similar objects belong something called a class, just like this. Your car is part of the vehicle class.
Let’s say you drive a car, and your neighbor drives a truck. Your neighbor’s truck is also a vehicle, but it isn’t a car. Your car and your neighbor’s truck are fundamentally similar but also have clear differences. In programming, we would use the term subclass here- trucks and cars are both subclasses of the Vehicle class.
All objects have characteristics that can describe what they look like and certain actions that they can perform. In programming, these are called properties and functions, which we will dive deeper into as their own units in our curriculum.
Application: Object-oriented programming takes something very complicated and simplifies it by breaking it down. Pieces of code are categorized into logical, self-contained ‘objects’ that are each responsible for their own defined set of tasks in a program.
Everything in Kodable’s Bug World is Object-Oriented Programming! In the on-screen independent practice lessons, the fuzzFamily’s defense against the Bugs and their slime is the Tower class. Students will create new towers, which are individual objects, from the Tower class. Students will edit properties and functions of objects, and create Tower subclasses.
In the independent practice portion of this introductory lesson, students will apply their knowledge of classes and objects to create new towers, which are objects from the tower class. Students will build a new tower from the tower class that best fits their defensive needs to protect the fuzzFamily from the oncoming slime. Since students will have more than one choice, they’ll need to think critically, considering the properties of each tower class, which are shown in the property editor to the left.
As students advance through bug world, they will be awarded new properties and be able to modify properties of individual objects.
When thinking about a program that’s object-oriented, a game is a great example. Games are often written in object-oriented languages since there are different objects that interact with each other to do different things. What makes object oriented programming so useful here is a programmer having the ability to change just one part of an object, like a character being able to throw something, without changing everything about the character or program.
Think of Kodable’s on-screen practice as an example of object-oriented programming: The “Fuzzes” are a class and each “type” of fuzz- blueFuzz, simonFuzz, prismFuzz, are all subclasses of fuzzes. When a student unlocks a fuzz, that one fuzz that is theirs and shows up on their screen is an individual object created from the fuzz class. The color, accessories, and unique characteristics of the fuzz are properties, and the actions it performs, like rolling and making noises, are functions of the fuzz.
Why Use Object-Oriented Programming: Object Oriented Programming makes it easier to control the program by being able to compartmentalize- you can manipulate individual objects without changing everything, adding layers of complexity to the overall program and allows you to create exciting, dynamic programs with a lot of different, moving parts.