2024-09-12 is once again Programmers Day (the 256th day of the year), so following the other years ([2023, 2022, 2021]), here I am again with three things.
By the 4th year of the dev life, some people might catch themselves doubting if they made the right choice or are fit to be a programmer.
But some things might tell you that you will do just fine.
You read the documentation (maybe even write!)
Especially nowadays with the AI hype, you catch yourself going after the documentation for something you use over and over.
While some might think they are stupid because they keep going back to read the same things, you know where the docs are and don’t mind defaulting to that over trying to stumble trying to remember how to do something.
Not only that, you may write some docs yourself. It might be as little as a how/when to use a function you made or some piece of code you spent a few minutes figuring out and instead of just leaving it there like that, you translate what you’ve learned into some helpful commentary for the next time someone might need that.
If you still don’t: don’t worry and start small, remember to say not what you’re doing, but why you’re doing something. You know the feeling of going to read some code you’ve made and not remembering why you made it like that? When you wrote, you thought it was clear as day why you did what you did… next time this happens, explain that to your future self by leaving some comments.
You double (and triple) check your work
You already know perfect code doesn’t exist. After all, every time you open some code from a month ago you get a little embarrassed of your past self.
Some people think: “My work is done when the code works”. You, on the other hand, already know that working is just the beginning. You can’t make it perfect, but at least you can make sure you won’t cringe seeing your code in the future.
It’s working? Then you might commit when it’s a tricky piece of code.
You might add and commit some tests, to make sure it will keep working.
Then you refactor a little here and there, make it clear where you can, and comment when you can’t.
You commit again, now a better piece of code, and might do even another pass.
Before making a pull request, you check one more time and only then submit the code.
If you don’t: remember that we read more code than write. Why make your life harder because “it’s already done” or “faster to just code” when you should know that it will come back to hunt you and then it won’t be fresh on your mind anymore and you’ll waste a lot more time to decipher what you did back then.
You write code for the most stupid person you know: you!
You stopped all pretense of trying to appear smart, stopped “clever code” and “code golf” code. You know you’re stupid and you learned to make code you can keep up with even after a long day.
This usually means adding comments and documentation, cleaning, refactoring over and over, and making it as clear as you possibly can… for your future self.
If you ever caught yourself in this situation, you might think you’re stupid and maybe impostor syndrome might kick in. But if you’re doing code that feels so simple… you’re in the right direction.
There are things complicated out there, but for most of the time, for most people… code isn’t the thing that should be complicated. WE complicate things a lot, business rules might be complex, but most of the time: code should be simple and direct.
If you’re not there yet, don’t worry. Remember to look at things you’ve made last month and try to figure out what the hell were you thinking back then. Do this when you’re not pressed for time and keep in mind that a time will come when you’ll need to check old code, under pressure, maybe with someone breathing down your neck, the git blame
will say it’s “your” code and you’ll have no idea what is happening… So, before that happens, try to think which type of code you would like to see: the “clever code” or the stupid simple one.
Happy Programmer’s Day!
Cover Photo by ready made: https://www.pexels.com/photo/cute-purebred-dog-resting-on-bed-near-laptop-in-apartment-4297818/
Top comments (0)