Go From Junior to Senior Developer with What and How

by Dan Bunker - Oct. 23, 2017

As I've consulted, interviewed others and worked in a variety of companies over the years, one of the questions I was often asked by developers was "What can I do to become a senior developer?". Unfortunately, the answer to that question isn't an easy task. If not breaking the build or always completing your user stories on time meant you have arrived at senior developer status, there would be a lot more senior developers out there. I know a lot of developers that have been developing for a long time but still aren't senior developers because they haven't put in the work to really get good at development.

Experience and time spent developing are certainly part of what makes up a senior developer, but that's not the defining characteristic that makes you senior. To be senior, you have to want to be senior and have to be willing to put in the work to get there. However, there are some things you can do to help speed up the journey to senior developer. You need to have a level of curiosity that will help you build a deep understanding of knowledge with your code and the work you do. What and How should become one of your most used tools to help get there.

 

Start with What

When you are developing code you'll often find that you need to write new code or update existing code. Either way, you'll want to start by asking one of these questions.

What does the code do? for existing code.

What should the code do? for code you are about to write.

Take the following code example. Can you tell what the code is doing?


public void printSomePrimes() {
  for(int i = 1; i <= 100; i++) {
    for(int n = i; n >= 1; n--) {
      int divisibleCount = 0;
      if(i%n == 0) {
        divisibleCount++;
      }
    }

    if (divisibleCount == 2) {
      System.out.println(i);
    }
  }
}

 

If you stated that the code prints out prime numbers between 1 and 100, then you'd be right. To confirm whether the code does this or not you could write a unit test or just run the code and determine if it indeed displays prime numbers or not. Answering what the code does is your first step. Many developers stop here because they perhaps have solved the problem and move on to their next task. But senior developers wouldn't move on quite yet. They'd ask the next question in the What/How sequence.

 

Next Ask How

Now that you know what the code is doing, you next need to ask how. How consists of two parts. See the following questions:

How did I figure out what that code did?

How does the code work?

When you had to answer what the code did you had to run through a list of deductions to determine what it did. Perhaps you did this automatically without thinking about it. Asking how you figured out the code will help you hone your what skills better in the future.

 

 

Here are examples of things you can check off to better understand code as you look at it for the first time.

  • The method or function name - Most of the time developers tend to write pretty good method or function names that describe what that code block does. However, over time the code in the method can change as bugs are found or enhancements are made to the codebase. The name is a good first indicator but isn't always 100% accurate.
  • Code comments - Sometimes you'll encounter comments mingled in with the source code. Does the comment reflect what the code is doing? Why do you think the comment is there in the first place? Comments can be good and bad. Sometimes they can help you figure something out but most of the times they are outdated or are a distractor to what the code is actually doing.
  • Identify the algorithm - You can outline the algorithm of the code in plain english (or whatever spoken language) to help clarify the code meaning. For example, I could say the following about the prime number example.
  1. Loop through each integer number from 1 to 100
  2. For each number, divide the number by all numbers from the current number down to one.
  3. If the number is only divisible by itself and the number one with no remainder, then the number is prime.
  • Analyze known language constructs - If there is something inside the code you aren't familiar with, you want to single that part of code out and try and understand it. Maybe you are comfortable with for loops and if/else blocks but you don't understand recursion or ternary operators. Focus on the parts of code you are weakest at. Read some tutorials, books, write code samples or read stack overflow posts on those concepts until you feel more comfortable with them.

 

As you ask how something works, you'll often find your self going deeper and deeper until you reach familiar ground. You can eventually get down to the level where you might be asking questions like: "How does variable assignment work?", "How do for loops work?", "What is a prime number and how can I test for prime?"

Keep asking questions until you've either satisfied your curiosity or you've reached an understanding where you feel like you could teach the concept. Many developers never take the time to do this. They get by with their work but often never really fully understand what they just wrote or how it fully works. What kind of developer do you want to be?