Oh, Oh, Pea; Or, A Strange Look At Object Oriented Programming
Wednesday • December 28th 2022 • 11:20:15 pm
Programming is a thing for humans, it is a talent we all have.
When I was a baby, I had a thing about pixels.
But back then, I saw programming, as telling the computer what to do line by line.
I would say, something like, go to 0,0, start a line, and now go to 10,10, and now 20,20.
I could just plot a line, by moving to different coordinates.
I had a lot to learn about computers, for many years, I would just open shareware…
Figure out how it works, close it an never use it again.
I learned how to make web pages, and developed a hunger for making a window this time.
But not just any window, it had to be empty, it had to be for me to program.
Just as soon as I got it open, I needed a button to do something.
And when I clicked it, I was thrown into a code editor, in the middle of a function.
It was something like the name that I gave to the button, followed by underscore, and the word click, yum.
Click, was an event name, you could also trigger a DblClick very cool.
This was no longer, line by line, here I was jumping into a really long program - divided into functions.
Things didn’t flow anymore, they jumped.
All the important programming was done with functions, you made functions, you called other function from within functions, it was Fun.
Then, it got really weird.
It was necessary, because once you had hundreds of functions, you had to categorize, organize, refactor, and that was boring.
This idea of a bag came up, basically, you could bag a bunch of related functions together.
People always give the example of a cat, or person, but the example of a File is best.
If you put all your file functions like move, copy, delete, into a File bag, then you would have everything in one place.
Cool, beans.
You still wrote functions everywhere, but inside an object, they were called methods.
It got weirder, suUuper weird.
Since you can nest objects by saying, this object has a list object.
And list objects can contain other objects, that also contain lists of objects.
You can make a game by saying Room has a list named doors, that contains other Rooms.
Or travel the universe by saying new Location, name edge of universe, add a transporter room…
Teleport to Earth, the program would beep…
Object earth, has not yet been defined, do you want to describe it?
My favorite object is a radio, I almost always put one inside my programs.
I make all the program components listen to it, and then just emit messages, like changeBackground image sunny,jpg.
I don’t have to think about where the function for it is, I just broadcast the message, and I know the function will hear it.