Okay, here we are again. This now begins a new section of videos all about… Object-Oriented programming. Is my microphone on? It is on we are recording. Okay great. So here’s the thing we have been learning all this stuff without programming and it’s been great. But now comes the time where we need to start to look at tools and ways of organizing our code to make it more… scalable for the future. You know, we just rewrote some variables up at the top and put some stuff and setup() and put some stuff and draw() and it’s getting bigger and bigger and bigger. We need to start being able say: “Hey, here’s the part of the code that does this. Here’s the part of the code that does this. I want to set this aside over here. Set this aside over here. Start to organize our code with two key principles. Principle number one is essentially what I’ve just been talking about right now. Modularity. We need to make our programs more modular we need to understand them in sections and so that we can come back to them later and see what part is doing what. In addition to modularity we need to think about: Reusability. Maybe that’s one word. Maybe I don’t need that hyphen there. Reusability. We just wrote all this code which figured out how to make this ball fly on the screen in this really cool pattern… well, we want to be able to reuse that code again later if you want hundred of those balls in the same program or if we later when we’re writing another program in Processing we want to take something we did before and reuse it again. Okay, so that’s what we want to do. So… Let’s think about um… What this really means, okay? Energy is coming up here. This next videos is going to be much better This is just a little intro and you can actually skip the next one if you want but if you want a little bit more thinking on what I’m going to do right now in the next minute or two before we move on to the nuts and bolts here is just look at the picture where we want to be at the very end of the next five or six videos. Over here… We have a simple bouncing ball sketch This is one of the basic things we’ve written in Processing. We have an x and y variable we have an x speed, a y speed, the ball is bouncing around it increments by its speed every frame. It’s drawn as a circle. We check if it’s in the edge down here and we send the speed in the opposite direction. This is a nice, lovely program, but again. It’s got some variables up here… Just one little function in setup() and a whole bunch of stuff happening in draw(). What if we could instead write this very same program like this? What if I could say, I’m going to have a ball object called B and in setup() I’m going to say: “Hey, b is a new ball object.” And in draw() I’m going to say things like: “You know, b should move about the screen.” That ball B should move about the screen and that ball B, it should… bounce off the edge, and that ball b, it should also be displayed. This is where we’re going towards. This is where we want to be. Look at this. It’s so beautiful. It’s like, look at all this gobbledygook stuff, and what’s that x for? What’s that y for? This program is so nice and relaxing. We have a ball. We’re going to start that, make that ball in setup() and we’re going to move that ball, bounce that ball, display that ball. We’re going to ask it to do things. This is more readable. Now, this is not making our program more efficient, for Processing from the computer no one really cares about it from the computer standpoint, but we the human thing right here can feel more comfortable with this. It’s modular we have sections. We have the code. We have a function that’s being called to move the ball. We have a function that’s being called to bounce the ball. We have a function we call to display the ball. These are modular pieces in our program now. We have this idea of reusability. We just have this ball object if I wanted to add another one I wouldn’t need all these new variables. I wouldn’t need another x, another y, another xspeed, another yspeed. I could just maybe add another ball object. I could say: “Hey… I want to have two of them. b2 is my second ball object. So this is where we’re going towards we want to be able to start taking all this stuff that we’re writing… to all this stuff is conceptually centered around the idea of this ball bouncing around the screen. Can we take all this and package it up into this mini program in the way. This mini program that’s going to live somewhere else. That’s going to be called a ball class. We’re going to write something called class ball. There’s almost as if this is like a little mini program that has everything embedded inside it to umm… to have a bouncing ball. It’s got the variables that a bouncing ball needs. It’s got the functionality that a bouncing ball needs. This is where we’re going. If we can write this program that it’s this sort of modular piece. It’s all the stuff about the bouncing ball, and we can reuse it. We could make balls in this program… we could make balls in another program balls everywhere. Yay, ok, so this is where we’re going towards. Before we can get all the way to this point… You know, there’s lots to here. What’s this syntax? This dot. You know, what does this mean that we have a variable of type ball, with a capital “B” and how are we going to write this class in the first place? There’s lots of details we need to fill in there. Before we can get to any of these details what we need to understand first is a little bit about writing our own functions. So this… the next video is going to start with saying: “Hmm, what does it mean to call a function in Processing?” We’re doing this all the time, line, rect, background, fill, etc… What does it mean to write our own function? So that’s where we’re going to start. Once we get through functions and learning how to break our program up into separate functions. Then we’ll start to build, put those functions together, wrap them into an object. And that’s where we’re going. It’s going to be very exciting. It’s going to allow us to have lovely relaxing, soothing code. Just like this and it’s going to be great. I forgot to turn the timer on so I actually have no idea how long this video was but this is where I’m going to stop and we’re the next video.