I believe everyone develops their own programming obsessions, as long as they've
written enough code. Recently, I realized how much my obsessions have influenced me.
This influence isn't necessarily negative. In this blog, I will explore the difference
between obsessions and habits, and share my own obsessions.
Firstly, it's essential for us to understand the difference between an obsession and a
habit. Here's a definition of each in programming:
Habit:
A routine behavior that is repeated regularly and tends to occur subconsciously.
Examples in programming:
Consistent Commenting: Always writing comments for your code to explain the logic and purpose of different sections.
Using Version Control: Regularly committing code changes to a version control system like Git.
Code Formatting: Consistently using an automatic formatter to ensure code style consistency.
Unit Testing: Writing unit tests for all new code to ensure functionality and catch bugs early.
Obsession:
A strong fixation on a particular practice or detail, often driven by personal preference or experience.
Examples in programming:
Refactoring: Continuously refactoring code to improve structure and readability, even when the existing code is functional and clear.
Perfect docstring:Write docstring for every function and class, so as the data type.
Code Aesthetics: Insisting on a specific code style or aesthetic, such as always aligning code in a particular way or using a specific bracket style.
Habits are routines we follow almost automatically, making our workflow smoother. Obsessions,
however, are deeper and more intense. They reflect our personal quirks and fixations, such as
an insistence on a specific coding style or a need to refactor code to perfection.
The term "obsession" doesn't exactly have the best connotation. In everyday life, we might encounter
obsessive people who go crazy over seemingly minor things. For example, some might lose their cool
if we don't use communal chopsticks or if we don't change into pajamas when entering the house.
They can become quite hysterical about it.
When it comes to coding, it's pretty similar. A programmer might become fixated on a particular
aspect of their work. For instance, they might spend an excessive amount of time making sure every
variable name is perfectly descriptive or ensuring that their code is absolutely optimized to the
last millisecond of performance. These obsessions can sometimes seem a bit over the top, and they
might even slow down the overall progress of a project.
But here’s the thing – these coding obsessions can also have a silver lining. They often drive us
to produce cleaner, more efficient, and more maintainable code. It’s like having a double-edged
sword: it can cut both ways. On one hand, it can lead to unnecessary stress and time consumption;
on the other hand, it can push us to achieve a higher standard of quality in our work
Now let me share my own programming obsession:
I have a particular fondness for refactoring code. When I’m diving into a new field, I usually start by finding the most popular code everyone’s using. But instead of tweaking it directly, I spend a lot of time rewriting it to fit my own coding style. The original code and my style are just too different for me to work with it as-is.
During this process, I get a better understanding of how different modules interact. However, this obsession comes with significant risks. It’s very easy for me to introduce errors while refactoring. The minor issues might just cause runtime errors, which I can fix. But the major issues are the silent bugs that don't throw errors but cause the model's performance to drop below the baseline or make subsequent improvements fail entirely. Despite these risks, I just can't bring myself to use the original code.
That’s my obsession. I can’t accept using the original code, and I spend a lot of time refactoring to make it my own, even if it means facing these potential pitfalls.
Everyone has their own obsessions because everyone is unique. I love my obsessions, and I hope you embrace yours too. Wishing you all a smooth and enjoyable coding!