Learning to Code

Advice for New Programmers

I’ve been a programmer for just over a decade now and have always shared and taught others as I’ve learned. However, much of that information has never really been documented except in the form of videos from talks at conferences. I want to take some time to offer a few tips to those who are just starting out.

Set Goals

When you first start out in a new field, you often have no plan for where you want to end up. You are too focused on learning as much as you can to have time for setting goals. This is a big mistake. Programming is a very broad and deep field with many distractions along the way. Allow your passions to guide your goals. Write your goals down where you will see them every day. Without a goal, strategy and action will only get you closer to where you probably don’t want to be.

Beware Opportunity Costs

The field of economics teaches us about the concept of opportunity costs. An opportunity cost is the loss of potential gain from one opportunity because you were focused on pursuing a different opportunity.  We see this when, for example, we choose to pursue a specific technology or framework only to have another technology or framework beat it out and become the industry standard. We could have become a pro in the thing that is now an industry standard, but instead, we are behind the times because we chose “the wrong thing”.

The same thing applies to your everyday work. We choose to focus on “getting the job done” and not on packaging up our code for reuse. What is the opportunity cost? A loss of time the next time we have a similar task. Those opportunity costs add up fast and before long if you had just invested a bit of time here and there you could have bought yourself time to come up for air and learn that new industry standard tool.

Invest in Yourself

If you have a mediocre skill set, you are unremarkable. People want to hire remarkable people and the best thing you can do is invest in your skillset. This could be investing money in a training course or time in tackling a side project just for the purpose of learning. Regardless, the key is that you keep learning and keep growing. The second you stop doing that, you slow down your pace and start falling behind.

Many people argue that they don’t have time to invest in learning new things because they are so busy. That is a cop-out.  See the section above on opportunity costs and invest in learning how to leverage the work you’ve already done to buy yourself some time. You are a programmer.  Automation and code reuse are key.

Focus on What Doesn’t Change

Most people are always focused on where the industry is heading, what the latest technologies are and the latest frameworks that are available. However, there is a lot that doesn’t change. The foundational concepts behind programming are the same, regardless of the programming language or syntax. Understanding how to modularize and reuse your code isn’t going out of style. Mastering the common design patterns is a useful endeavor.

Learning the new things is important, but if you spend more time learning the newest tools and not the foundational principles… you aren’t going to pick up the new things as quickly.

Work from your Strengths

Everyone has things they do well and things that they don’t. Often, your strengths will align with your passions. Learn early on what you like and what you are good at. If you want, create a Venn diagram to see where the two overlap. This is where you want to go deep. Learn as much as you can and become as awesome as you can in those areas. These are the skills that make you marketable. These are the things you will be excited about, do well and have your clients (or boss) raving about. Learning new things for the purpose of rounding out your skillset is important too, but never neglect your strengths.

Shorten Your Feedback Loops

Any time you write code, you want to keep your feedback loop as short as possible. For example, when I first started coding, I would use FTP to upload my files after each change. The process was to edit a file, save the file, upload the file, check the browser to see if the change worked. Then, I started doing local development. The process was then to edit a file, save the file and then check the browser. The time-consuming step of uploading the file was now gone. I had made my feedback loop shorter. I knew quicker if the change I made had worked or not.

The basic concepts of programming are the same across all languages. However, Java is a compiled language and you have to wait for the code to “build” before you can run it. On the other hand, you can code JavaScript in your browser and watch it run the second you press enter. Which do you think you would learn the fastest?

Keep it Simple

Once you learn how to architect software solutions, leverage object-oriented programming or work with dependency injection containers you are going to see opportunities to use these new skills everywhere. Don’t! Just because you are holding a hammer, it doesn’t mean that everything is a nail. Never introduce complexity into a system just so you can use your new hammer.

On that note, I will close by recommending a book that I think all new developers should read: Code Simplicity. There are no code examples, so it is a good read regardless of what programming language you are learning. The focus of this book is to help you avoid complexity, and thus much difficulty as your code progresses over time.

Conclusion

Those are just a few of the things I’ve learned along the way and think are important. The most important things you will learn in this field have nothing to do with the syntax of a programming language or the latest tool. Technology is constantly changing. The challenge is identifying and acting on those things that will really make a long-term difference.

If you are a seasoned software developer, what bits of advice would you offer a new developer?

3 thoughts on “Advice for New Programmers”

  1. Hey Micah,

    Thank you for writing thoughtfully. The article is helpful.

    > We choose to focus on “getting the job done” and not on packaging up our code for reuse.

    I’m curious on how/where you store re-usable bits of code. Could you throw some light on that please?

    1. Absolutely!

      The key for me is taking code that serves a specific purpose and turning it not only into something reusable but something that is both easy to maintain and easy to use in the future.

      Creating a separate repository for that code on GitHub allows me to maintain it separately. I also use semantic versioning (https://semver.org/) to make it easy to define what version of my code is being used on what projects. I use Composer (https://getcomposer.org/) as a dependency manager for all of my PHP code. Composer makes it easy to pull in a specific version of my code into a project or update an older project to use the latest version of the code. For example, here is a list of the reusable modules I’ve created: https://packagist.org/?q=wpscholar

      So now, if I need to make WordPress posts expire, I can just run composer require wpscholar/wp-post-expiration and add one line of code to tell WordPress what post types need this functionality: add_post_type_support( 'post', 'expiration' );. Without this module, I’d be rewriting a bunch code from scratch everytime I need it. Maybe I would copy it from another project, but after you copy it a few times and fix a bug in the code on one site and not the others it gets hard to keep up with what code is the “correct” code, whether a project is running the “good” code and where you should copy from. Tools like Composer take away this hassle and save a lot of time.

Leave a Reply

Your email address will not be published. Required fields are marked *