Sure, you can use OOP at any scale, but the question is whether you really need to or are getting any real advantage from doing so. Making objects and associate methods with abstracted interfaces makes it easier to add functionality than “a big file with functions”, but I’m guessing your line count of actual operational code is probably in the few tens which anyone could sit down and work through in a half an hour unless you’ve actually made the effort to obfuscate the code, so the time you save in extensibility is probably a wash for the extra overhead. And frankly, unless you are careful about how you apply OOP principles and document interfaces it can end up being much harder for another programmer to understand, which is fundamentally my complaint about casual and reflexive use of OOP.
There are, of course, other reasons to use OOP, particularly if you want to use abstraction to make your code reusable. As an example, I wrote a Python library to do signal processing and cohort statistics for dynamic environments from accelerometer time history data, but I used a class factory so a user could come along and inherit the base signal class and then add methods and properties to do different things with time history data from pressure transducers, thermocouples, stain gauges, et cetera and the be able to use the same cohort stat methods to generate summary statistics. In that case, it was worth the extra overhead because I can use it to handle and manipulate any time history data, and modifying the class factory (which actually has its own set of abstract interfaces) is trivial. In fact, the class factory is designed to be actually import parameters and predefined methods from an external spreadsheet (as well as the predefined classes in the module) so unless the user needs some kind of visualization or processing methods that aren’t available in the module they can actually generate a whole new class type without doing any programming at all. Unfortunately, I have not been able to wean users away from their bag o’ functions Matlab scripting and into Python, but that is another issue.
Anyway, someone who is experienced and conversant can write good OOP code probably about as fast as functional code, but a lot of OOP code is not well thought out or provides any real utility at the cost of making the project harder to understand or reuse instead of easier, which is my main gripe about ‘needing’ to use OOP. In other words, if you can’t think of a compelling benefit to use OOP design in your project, you probably either don’t need it or don’t understand OOP well enough to apply it correctly.
There is nothing about that program that is object oriented, or even functional since it is really just a single imperative statement in the main body.
I’ve been trying to find an excuse to use Julia for something because I would really like to learn it but I’m honestly hard pressed at this point to come up with any data analysis and visualization that I can’t just as easily do in Python with NumPy and SciPy, and the milliseconds I might gain in additional performance would be lost in time spent learning Julia and having to interface with existing Python libraries for functionality not directly available in Julia modules. Maybe when I start writing that astro code that has been sitting in my personal ToDo pile for the last decade…
C is a Piper Cub. C++ is a Caproni Noviplano.
Stranger