TL;DR version: Click here for a great explanation of how OOP can make certain programs much easier and better
I normally consider myself not-so-stupid, but OOP made me feel downright moronic. I went through the FCC stuff. No problem. But following those simple steps didn’t tell me what OOP really was or why I should use it or when. I’ve actually been looking for what I would have imagined would be a simple answer to a very simple question for over a month!
Book after book, site after site, I kept running across the exact same thing. “This is how you make an object. This is how to make a constructor function. Variables in objects are called properties. Functions are called methods. Encapsulation. Inheritance. Polymorphism.” It’s like telling you how to build a carburetor without having any clue as to what it does or how it interacts with the engine or where it goes.
Nothing was helping me to understand why it’s better than what I was doing before. Making my Pomodoro timer was simple enough. User clicks and a function is called, which after a certain time calls another function, which after a certain time, calls the first function again, etc. Click on something else and you stop the timer. Click again and it starts again. Works beautifully. I could say this about all the projects I’ve done so far. Try as I might, I couldn’t understand why OOP was needed or how to implement it in a useful way. Why would I need to use objects for this? How would it make it better or easier to code?
And then, two days ago, I finally found someone that explained OOP in a way that makes sense! Joy filled me to the brim. LOL
I don’t know if this will help anyone else, but here is a clear breakdown with a concrete example of how trying to code something without OOP can be unwieldy and how OOP can come to the rescue. This is the link.
Going back to Pomodoro, I still don’t see how using OOP would be any better though. However, I still feel like I’ve unlocked a level here because I CAN see how objects would be immensely useful for certain games and other applications that would require you to keep track of things by using several arrays, etc.
If anyone knows of any other, similar sites/tuts that explain not only how to create objects, but instead shows how to use them effectively and when, please post a link here. I would love to see more like this to really wrap my head around it.