I'm currently working in IT at a company that heavily relies on Databricks, primarily focusing on notebook scripts that often get pushed straight to production. Most of our pipelines are tailored for specific requests, serving either one team or a limited number of users.
Though I've grasped object-oriented programming (OOP), unit testing, and general software engineering best practices, I've noticed that much of the business logic here has been running smoothly in SQL for years. In fact, it seems like most people using Python in my company are mostly just writing scripts within notebooks—no modular, testable code to speak of.
My question is: Should I adopt OOP for everything I develop, even if I'm the sole person accessing the code? How can I determine when I truly need to implement proper classes and structure as opposed to just crafting a straightforward script?
I understand the theory of clean code, but when developing a niche pipeline for a unique use case, does it really need to be complex? Or am I just justifying laziness? I'd really appreciate insights from anyone who has navigated similar situations.
5 Answers
OOP has its place, but I’ve found that introducing it too early can complicate things unnecessarily. I usually wait until a project starts getting complex before I adopt OOP principles. For simpler scripts, sticking with procedural programming often works just fine. It's good to have experience with various approaches to know when and where to apply them effectively.
In scenarios like yours, functional programming could be a better fit than OOP. Focus on making your functions side-effect free and using immutable data structures. This helps keep your data transformations clean and reliable. OOP shines when you have complex data states to maintain, but that doesn’t seem necessary for your pipeline work.
I think OOP is just one way to structure code. Depending on the situation, other paradigms like functional programming might actually serve you better. If you find yourself copying and pasting functions, those pieces can be turned into a library. Just keep in mind that if a function needs more than five parameters, it might be time to rethink the design.
In my experience, OOP is often overhyped. I find more success by focusing on procedural, data-driven designs unless I absolutely need OOP, which I usually introduce when managing a lot of parameters or tightly coupled data. OOP is useful, but don’t force it into every piece of code; there are many ways to keep your code organized.
As a senior developer, my advice would be to not overly focus on OOP, especially in your SQL-heavy environment. It's often more beneficial to dedicate your time to unit testing or setting up automated tests. It provides better assurance that your work is correct while also giving you proof of success to show management later. OOP is beneficial in some contexts, but defining all your objects when the overhead is unnecessary might not yield much gain from it.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically