Object Oriented Programming for Dummies Like Me – Java

I just loaded the Netbeans IDE 10 for Java SE 11. It has a nice UI Builder called Swing for adding all sorts of form type Widgets including containers and menus and buttons, etc. It reminds me of the old days working with MS Access and dragging things on to the sheet and then adding snippets of code for each of the various actions.

I added the Netbeans IDE and Java after adding a local Microsoft SQL Database Server in which I have some 16.777+MM records containing numbers and various attributes (prime, number of bits total, total bits on, etc. It’s a hobby. I wanted to explore my database programmatically and on Windows 10 I just wasn’t that crazy about Eclipse or even Visual Basic. I got the database happening and got a Java program to build a query and fetch records. Cool!

Now what?

Part of my problem is that while I have a good understanding of the purpose of Object Oriented Programming (OOP) I’ve never really had to do much of it and I don’t really get the “flow” of things.

So, I started with a Google search of the title of this post.

I next learned a key concept and decide to write it down because I grok things most fully when I actually write them down and even explain things to myself or others.

The key concept is still a little murky but I like the distinction. Class are collections of characteristics (or attributes) of Objects. The example talked about houses and how each house was pretty much the same. Houses are the objects in the example. And just like each house has characteristics like what kind of roof, what kind of exterior, what kind of cabinets, etc. the “master list” of those characteristics is called a Class.

It said, “So there you have it. Object-oriented programming is misnamed. It should really be called “programming with classes and objects.”

Now, from my historical context as a programmer we did break up things in to objects with characteristics. For example, we had a Customer Master. And the columns associated with the Customer Master represented characteristics about the customer: name, address, state, zip, phone, etc. That’s probably still true in the data representation of Customers anywhere I’ve looked over the years. But programmatically I suppose Customers would be an object (a specific file) and the master list of customer characteristics (or columns) associated with the Customer would be the Customer Class.

Down the road, in my past life, we’d run into the problem of having different types of customers. Some information overlapped, some didn’t. Then we had to start refactoring the database and split the customers into different files, or we’d normalize the data, and have three files: a base customer file, and separate file for type a and a separate file for type b. In the type a and b files we’d only have the customer number and the special information. Everything else would stay in the main customer file.

Its probably no surprise that OOP came about when normalizing data (2nd normal form, third normal form, etc.) came about. We’d optimize the data structure to make processing faster and more efficient. Yes, it might take extra reads to fetch all the data but we didn’t have a lot of wasted space and confusion trying shove every different type of customer into a single file (unless you were an accounting software and then you generalized and called it a day and that’s still the case except where the software allows custom fields. Very common now.

So, I understand it. But how do I use it? How do I invoke, call, goto, gosub? What are the flow and execution of an Object Oriented Program? That’s what I’l try to learn next.

Tagged with: , , ,