Skip to main content

Object Oriented Programming is Dead! Long Live Object Oriented Programming!

There have been a bunch of blog entries, with slightly different points of view,  discussing the decline of object oriented programming.  I think most of them miss the mark communicating the arc of history when it comes to programming paradigms.

At a fundamental level, as programming languages have evolved they have improved on two different dimensions:

  • Abstraction - allowing the developer to develop components at higher and higher levels of abstractions.
  • Encapsulation - allowing the developer to hide more and more details from the users of their components.
Let me give you a specific example from my C++ days.  At the time, I was using the Oracle Call Interface (OCI) - a C language API to connect to Oracle databases.  Using Perl::DBI, we used code generation to automatically generate C++ classes based on the schema metadata.  The class layout looked something like this:

This object oriented design had a few design features that I consider object oriented:
  • The complicated interface between the C library for OCI calls and the C++ code was hidden in the relationship between the connection class and the abstract table class.
  • All of the table classes had a common interface for dealing with columns, date formats and all of the other details you want to be consistent with a database interface.
  • The OCI library allowed for fetching into arrays of memory.  While this performed much better, keeping track of what memory was in use and which was not was an easy thing to get wrong and we were able to hide that from the users of the generated classes as well.  Those users don't know it, but the multiple instances representing rows were associated to a single storage instance and copies of the data were made for them if and when copies of the entity table class were created.
Newer languages, such as GoLang, allow you to define the common behavior between classes through interfaces that can be defined without any preconceived decisions made by whichever class was developed first. 

You could look at it like the following progression:
  1. C function to pointers - like void (*fun_ptr)()
  2. Arrays of pointers to functions associated to class definitions - the original C++ vtable
  3. Arrays of pointers to functions associated later binding - GoLang
The critical programming concept here is that the combination of an abstraction with encapsulation is an object.  And those are not going anywhere.  


Comments

Popular posts from this blog

Spring Boot native builds when internet downloads are blocked made simple

 No direct access to the internet If you work at a company that controls their software bill of materials, it's quite common to be blocked from directly downloading from: Maven Central Docker hub GitHub (the public parts) Getting the bits Maven Maven is first, because without it, you won't be able to compile your Spring Boot application, let alone move on to turning it into a native docker image. I will be showing changes need to work with artifactory, but you should be able to adapt it to other mirror solutions.  repositories {   maven {     name = "central"     url = "https://artifactory.example.com/central"     credentials {       username = "${project.ext.properties.artifactory_username}"       password = "${project.ext.properties.artifactory_apikey}"     }   } } With this configuration change, you should be able to download your plugins and dependencies, allowing you to compile and ...

Kotlin Notebook when you're blocked from Maven Central

 TLDR; If you are blocked getting to maven central when first using Kotlin Notebooks because of company firewalls, you can use a tool like Fiddler Tool to redirect to a different network location. Kotlin Notebooks Kotlin Notebooks are a JDK based environment that brings the Python based Jupyter Notebooks  expressiveness to IntelliJ. From the blog post announcing the plugin, it looks like this: At home, the installation of jar files looked like this: I played around with it at home, but I couldn't use it at work.  Many companies, mine included, do not allow software components to be used when downloaded directly from the internet. In my companies case, we use a product called Artifactory, which allows you to mirror the content from Maven Central while still applying policies like CVE scanning, tracking, etc. The way it should work IntelliJ, as one of the leading IDE's, generally supports this quite well.  In fact, there is a whole setting page dedicated to dealing wi...

Active vs. Passive Log4jShell remediation

 Log4jShell  All computer professionals should be aware of the Log4jShell ( CVE-2021-44228 ) and it follow on defects.  There is no shortage of opinions and lessons to be be learned: The difficulty of performing safe interpretation The problems when assumptions are not clearly documented.  I, for one, was completely shocked to find out that a logging system would actually attempt to do variable substitution in an actual message. The difficulty of finding and resolving issues with such a common library that is not provided by an OS package manager. IT'S A LOG4J CHRISTMAS One of my favorite podcasts, Security Now - episode 850 , discussed an analysis by Google regarding the depth of log4j dependencies.  From the show notes : One contributing reason is because Log4j is, more often than not, an indirect dependency. Java libraries are built by writing some code which uses functions from other Java libraries, which are built by writing some code which uses functions f...