Hey there 🔥, and welcome to another issue of the Productive Developer newsletter;
What we do as developers is:
Write code.
Maintain that code.
And each time we add features or remove one, we do some refactoring or some tidying, as Kent Beck refers to it.
To make the refactoring much more productive, there are common tools we use as developers, and the most important one is a powerful IDE; since I am an Android developer, I use Android Studio, which is more than enough since Jetbrains has many productivity hacks immediately in my IDE.
In this newsletter, I will share with some some of the hacks I use to keep my refactorings as productive as possible.
PS. I made a course about Refactoring legacy code; you can check it also for more tips about refactoring codebases that are hard to refactor.
🩸 Refactoring Menu
The first thing I use the most is the refactoring menu in my IDE; make sure to keep this around, I even have a special shortcut for it (ALT + D), since the original one is little bit long, having such a menu will enable faster automatic refactoring.
🚀 Git Management
When you are refactoring, you’ll have to commit your code, maybe squash some commits together, or do specific things with Git; for this reason, I use Lazygit to make the process faster using shortcuts and keyboard letters instead of typing commands.
Here is a video I created in the past about this excellent command line tool 👇
✅ Tests.
Repeat after me, No Refactoring is Safe without a form of Testing.
You can’t refactor without having a good suite of tests that will act as a safety net, this is by far the best productivity tip I can give;
Yet this tests has to be automatic, because if you want top refactor faster, you need to get the feedback faster for the refactorings you introduced.
So if you don’t have tests, start by writing them to cover your code with automatic tests that will help you refactor faster.
You can watch my course to see how you can cover the existing code base with tests 🙄
Refactoring heavily depends on tests to maintain the existing behavior. Therefore, it is essential to invest some time in writing those tests. Although it may seem like a time-consuming process, Trust me, it will enable you to refactor safely and quickly, which is invaluable.
💡 Tip of the week
You can choose any of the tips I gave you. Still, I recommend playing around with your IDE options of refactoring and mastering the keyboard shortcuts this week so that you can make the refactoring process as productive as possible.
📣 See you in the upcoming weeks with another Tip!
✍️ Charfaoui Younes.
✅ My preferred things this week
Here is a couple of digital content I’ve been consuming this week:
🎬 YouTube Video Dagger Hilt - Assisted Inject Hilt in Android!
👩💻 Github Repository Special Pizza Ordering App with Compose.
📑 Article Gradle: from Newbie to Strong fundamentals.
📚 Book I am still reading ATDD by Example.
You would make my day if you share this newsletter with other developers 🙏.
🤗 Here are other ways I can help you with:
📞 Work with me 1:1 - book a coaching or strategy session for 60 minutes.
🔨 Course: Refactoring Legacy Code Like a Pro: A step-by-step approach for refactoring messy codebases into a Software Masterpiece.
🎥 Check out my YouTube channel: Discover tips on Android, Software Engineering, and productivity for developers.