Let It Go!
This is what you, my readers, should do with any piece of needless code. Delete it. Let it go. You are not your code. Don't hang onto it.
Join the DZone community and get the full member experience.Join For Free
This morning, I sat in front of my computer, opened KanbanFlow, and started planning out my day. First thing on the list? Enable previewing the posts so that my wife or my friend Darek can review my latest text and suggest improvements. I was waiting for this moment since the very beginning of the blogging platform project. Now, finally, I'll add the possibility to make pull requests with newly added posts for easier reviews, for a better future, for a better world!
I felt excitement when clicking the Start button on the Pomodoro timer. I was just about to start the implementation. I opened Notepad++ and quickly sketched the steps for upcoming solution:
- Parametrize Git integration using
git.branchproperty so that I can deploy an instance showing the newly prepared post.
- Add a feature toggle for not showing posts with future dates. (By default, the platform hides future posts until the specified date. This way, you don't have to remember to manually push the post on selected publish date.)
- Fork the tidyjava repo and configure the fork to use
- Deploy the forked repo.
I'm ready to go. Positive energy is flowing through my body to my fingers, hitting the keyboard in all the right places. A neat, cool solution begins to emerge. Testing the newly added features was a bit of a challenge, but this only raised my excitement with the upcoming feature. A little bit of genius, two Pomodoros, and the implementation is ready to serve!
I can't wait until the five-minute break between Pomodoros is over. It's not even a break. I'm sitting there ready to deploy my newest beauty. I fork the repository, update the configuration, push everything to GitHub. I open Heroku, create a new application, link it to the new repository, and hit deploy. It works, it works!
Then, I started realizing that the great thing that I just built was not really necessary. Instead of deploying an extra instance of the platform to use the
develop branch with my blog's contents, I could just push everything to
master with future post dates. As the platform filters out future posts, they won't be visible on the home page, but can still be accessed by a direct link. It boils down to a trade: post review via pull requests versus the complexity of extra configuration and extra deployment.
A tear appears in my eye. My beauty! My child! I've just spent three fantastic, productive Pomodoros developing this feature! Maybe I'll just leave it. The end users will have a choice! More features! Yes! But...I'm a programmer. YAGNI, KISS...I can't just leave this complexity in there, just in case someone prefers double deployment, just to be able to review posts via pull request. My heartbeat goes crazy. And then I woke up.
The killer instinct. You fool! You're not your code! This is not your child! This was a mistake. Everybody makes mistakes. You've just written a needless piece of code, now you delete this crap! It looks good? So what?! No emotions, just do it! Kill it, murder, bury and forget!
And this is what you, my readers, should do with any piece of needless code. Delete it. Let it go.
The code never bothered me anyway.
Published at DZone with permission of Grzegorz Ziemoński, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.