As developers it is crucial to keep learning all the time. Otherwise, you might get caught up in your day-to-day work and stagnate. The cure? Learn something and apply it in your workflow! Here are three tips I wish I could've given myself sooner:
Are you still avoiding this? Still using
nano in your terminal? Learn some vim stuff and you will surprise yourself. Looking back, you will find yourself using little vim shortcuts all the time. You don't have to forsake your usual editor to do this either! Learning at least a little bit of this stuff will pay a time dividend for you in the future.
My suggestion: enable vim mode in your editor of choice.
For VSCode, I'm a big fan of amVim
Here are a few things to master
- Learn the difference between the two modes (command and insert). Then, work on mastering cursor navigation in command mode. The
hjklkeys are paramount. Other low hanging fruit commands are
b(back by word).
- Once you can move around, learn some of the ways to enter "insert" mode. For example, the
c(change) command. I also find myself using
Ocommands a bunch.
- Now try combining or chaining vim commands and your world will start to open up. When your cursor is anywhere in a word, run
ciw(change in word) and you'll start to see the vim magic
When you enable vim mode in your editor of choice, you augment the way you think about navigating code. Little changes over time produce big results.
Configure your Damn Editor
Some of you might be thinking "well no shit". All too often though, I see folks coding in the dark because they didn't take the time to configure their editor. A little time spent will save you tons in the future. I'm not talking about color schemes or line height (although that's nice too), I'm talking about making it more functional for what you do. Are you using Tailwind CSS? Get the Tailwind CSS Intellisense extension. Are you using PHP? Configure PHP CS Fixer to automatically format PHP files when you hit save. Need other ideas for improving editor productivity?
- Configure your editor to format files on save -- PHP, JS, anything
- Make or use the keyboard shortcut for running your test suite
- Integrate documentation (or shortcuts to it) for your favorite frameworks and tools
- Add shortcuts for common actions, like adding a Trailing Semicolon
Reevaluating your editor setup and configuration from time to time can boost productivity! Always be thinking of how you could automate and improve.
Try TDD... Just Try It
Most developers could use a little slowing down, myself included. Remember that "it works" isn't the final form of a piece of code. It's just the beginning! Ever deploy to production, only to realize you missed one small thing? Now you've just doubled your effort to deploy. Having a bias for moving quickly can be beneficial, but if you don't know when to slow down it is energy wasted.
What is the best way to know which details to focus on and slow down for? Test Driven Development (TDD). Controversial as it may be, it is a wonderful tool when used correctly. Make an actual attempt to practice TDD and the most important details will expose themselves. Ask yourself, "what is this code accomplishing?" Write a test that checks that. With this new test in hand, you've given yourself a recipe for the code you're about to write. Test and repeat, and you'll amaze yourself with what you can build. Do you have to write everything this way? No! Consider TDD a tool, not as a religion. If you need to spike out some code before you can figure out the test, that's okay too. Write the test after though, because you can't learn anything without challenging yourself.
As you get better at testing, so does your mindset. When I started writing tests (TLD - Test Last Development), it was difficult to imagine how to test for some pieces of code. Practice! Force yourself to write a few tests first. It will be difficult at the beginning. With time though, you will find yourself thinking about code in the frame of tests, not the other way around. I avoided testing in my early career, but it is one of the main causes of growth in my workflow over the past few years.
When you practice writing tested code, you also open yourself (and your code) to greater opportunity. Want to automate your QA and deployment process? Good luck doing that without tests to run. I'll be here deploying -- in the middle of the day, on fridays, or even on holidays without breaking a sweat. All due to tests.
What has made you grow as a developer? What are you trying to improve this year? Send me a tweet and let's talk about it!