Dumb useful tricks I have written this article as a go-to for junior developers with tips and tricks. Meanwhile, while I finish the "show-me-your-tweet" website for the content of my future blog post. If you want to know more about it or have regular updates, consider following me on Twitter .
Transitioning to an actual job can be overwhelming and difficult for a junior software developer. Far too often, companies have a vast codebase with ten or thousands lines of code, and quite often, it is hard to find what you are looking for. I have seen this first hand.
Over time, I picked up ways to navigate the codebase. It was not that easy; I had to learn from my errors. In this article, I share the tips and tricks to help you avoid the burden I went through and help you to excel at your job.
- Know how to search
- An error message is there for you to read
- Debugging is your friend
Know how to search
Searching is an integral part of software development. Searching for the appropriate information can save you a lot of time and trouble. But what do you search for in a codebase? How do you find what you are looking for?
Considering that your codebase is huge, trying to read through its entirety can take you several months or years. Thus, this should not be the answer to your problem. What will be the ideal solution is some tool that you can use to find the piece of code that you are looking for. Possibly, a file searching tool. Many of them exist, I use AstroGrep at work. It is a GUI version of grep for Linux. What it helps you to do is: to search for a piece of text through a directory.
What would you look for if you do not know what inside the code? The answer to this is simple. The application that you are developing for might include an interface with some words on it. Use those words to find a match to find the place in the code to apply your change.
Simple, isn't it? Now let's say that you are a web developer working on some websites. You could simply copy the CSS selectors from the inspector tool. From there, using your favourite text editor use Search For All for the text you copied.
All that is to say, just search for clues in the codebase to find what you need.
An error message is there for you to read
Yes! You read the title right. An error message is there for you to read. Often without reading an error, people will straight away do a Google search for the error. They did not even spend the time to understand what is the cause of the error. Yet, reading the error message helps you to understand the issue. It also helps you in formulating text search if you need to. Adopting this habit will definitely help you in becoming a better software developer.
An exception with a stack trace is one form of the error message you often receive. If you pay attention to it, you can pick up where the issue is happening and possibly the source of the problem. It's not always the case that the first line of the exception is the exact cause of the problem, therefore, if given a stack trace use it wisely.
What I discuss is simple, but paying close attention to those small details is a time-saver. Eventually, you will become self-reliant and more productive at your job.
Debugging is your friend
Code does not always make sense. There are many reasons why: Knowledge gap, the complexity of the system, the experience you have or the wrong mental model.
Instead of banging your head against the wall take a back step and construct a mental model of what the code does. Then, try a simple trick. Try debugging the application by stepping through the code and see how it works. This will help you to have a better sense of what the code is doing.
I hope that you have learned some useful tips by reading this post. And made you ready for your next adventure in your new company.
Whether you agree or not, those simple tips will help you to be a better developer in the future.