How to maintain the habit to learn coding skills

TreadmillManaging to find time to improve your coding skills is hard with all the other obligations you have to keep up with. You don’t want to burn out: you need to maintain a social life, spend time with your family and have time for a few hobbies away from the computer and get some exercise in.

When you do get some time at the computer, it’s hard to focus your attention on just one thing and learn it properly: they’re always a brighter, shinier language to learn or a project that’s cooler than your current one. If you’re to believe all that’s said about being a good programmer, you also have to know many software design patterns and how to implement them, contribute to an open source project and master complex computer science concepts to stay up to date and have a chance to keep your job.

In fact, very few people know how to do it all, and people who have extended knowledge in multiple subjects have worked at it for many years. For example, I don’t fashion myself as being a master of web programming, but I’ve been paid for the first time to develop for the web in 2004, so of course I had more time to pick up knowledge, techniques and tricks that someone that’s totally new at it.

You have to learn new things and stay up to date, but you don’t need to know everything to do good work. Learning a new language or a new framework can be done in a few months even if you don’t have a lot of free time, and you don’t need to be on the treadmill at all times: it’s OK not to want to learn a new framework every few months. But what can you do if you do want to learn that new language? Where can you find the discipline you need to improve your skills in a real and profitable way so it does not end in a disappointment?

Discipline does not matter as much as having good learning habits and strategies. Discipline is really hard to maintain: you monkey brain will always want to try out new things, and then make you feel disappointed that you abandoned your cool project. Habits, on the other hand, will help you build your skill in the long term. So, here are a few steps to help you build the right habits:

  • First, you have to commit to a main learning project that’s the one to wish you’re going to apply all these strategies to, be it a programming language/framework, a computer science concept, a coding project or even a soft skill. If you spread yourself out too thin, you won’t make enough progress for it to be interesting and useful. Choose something you care about and that you’re interested in learning: don’t choose something to focus on just because it’s popular online right now.
  • Plan out where you want to go with this project, including a rough outline and a clear stopping point. If you have a reasonable time horizon for your project, for example a few months, you can reevaluate where you want to go when time is up. If you feel you want more, you can keep going for another chunk with a new set of goals. If you don’t, you can stop guilt-free because you accomplished what you set out to do.
    For better effectiveness, you also want to plan the few next steps so you don’t have to think about it to get started. When time is short, you don’t want to waste half an hour pondering what you should do. That plan should include tasks that work for various energy levels, like finishing a tutorial, reading the next chapter of a book, listening to a course or a related podcast, or have a few features ready to code.
  • To keep making progress, you need to work at it a bit everyday on your project even if it’s something small. You’re not forbidden to work on other things, but your main project should get a bit of your time first before you work on anything else. Slow and steady wins the race: if you only go at it when you have hours of free time available or when you feel the stars are perfectly aligned, you won’t work at it often enough to make a real difference. Also, it’s easier to immerse yourself in a new concept if you keep working at it, even if it’s only a little bit each time.
  • If you’re in purely for the learning, you need to let go of the idea that the project must be 100% finished. Enjoy what you learned on that project and take it with you for the next project. Some programmers have a pet project like a TODO application or a blog that they like to implement in each new language they are learning to get the hang of it: it doesn’t mean that each of those projects have to be production-ready and bug free. And besides, even software in production is never really done anyway.

Learning is a lifelong quest for a programmer since there are always new skills to master, so you need to learn to enjoy the journey. For each new things you learn, you’ll find many more that you want to improve, so don’t forget that you’re only human and that you can’t do it all.

Sign up now to receive my latest musings about the craft of software directly in your inbox.

6 ways to code faster and with less bugs

Fast typing It can take ages to code what looks like a simple feature at first glance. Times flows while you have the impression that you made no measurable progress on that new feature and that everything is hopeless.

Outsiders will tell you that you’re only adding a checkbox or a text field and wiring stuff together, so it should not take this long. Why are you coding so slowly?

Thinking about the time it took to create a new feature as the number of lines of code you need to produce is a mistake, because the part that takes the most time is not typing code in the computer. Your keyboard shortcut skills are not going to help you with all the other things you must do to create the feature like:

  • Understanding how it needs to behave when it’s done,
  • Looking at the existing code to understand where it fits,
  • Choosing the best controls and API methods for the job,
  • Naming and documenting the variables and methods in your code,
  • Testing the feature.

Indeed, I’m not going to give you tips to type code faster or technical shortcuts since those can be found in any technical book about your language or framework of choice. Likewise, there are many great posts about keywords shortcuts and tools for your IDE of choice.

So here are some ways to optimize all the other stuff so you can deliver faster:

  • Make sure you understand what the feature should do properly before you start coding, including those hairy corner cases that you must handle. Things can change, but you’re going to lose a lot more time if you code something and have to start over: aim to do things right the first time.
  • Plan out the big picture of how you are going to implement the feature and what are going to be the names of the most important classes and methods. This is the hardest tip in this article to stick to, but you’re going to be a better coder if you make it an habit to read the existing code to get a better idea of what to do and plan for the most probable pitfalls before writing the first line of code.
  • Break down what you need to do in tiny wins instead of trying to take it in all at once. Doing just one small method at the time and incrementally adding more code as you go on is easier to manage than trying to do everything you’ll ever need in one shot. Ideally, you should always be able to run the application even if the feature is not complete. Don’t be afraid to leave TODOs in the parts of the code that are not done yet so you’ll remember what you wanted to do when you come back to finish it.
  • Make sure that each tiny part is well-formatted, with good names and properly documented. It’s easier to do while you’re writing the method instead of waiting to do it all in the end, and chances are that once you’ve moved on you’re not really going to fix it. This will make it easier for you to use the method and change it as needed since it’s already nice and clean.
  • Keep a piece of paper or a notepad beside you as you code to jolt down things that comes to mind as you work. While you code, you’re going to think about things like test cases, that bit of CSS you need to adjust and how to implement other parts of the feature. You can take a quick note without breaking the flow of what you’re doing and go back to the current task. That way, you don’t need to keep all those things in your head (think GTD) and you’re not going to forget them all if you get interrupted.
  • Don’t hesitate to look for examples of code when you don’t know how to do, but avoid copy-pasting. Rewrite those examples using your own variable names and standards, and take ownership of it by understanding it as well as code you wrote yourself so you can fix it if something goes wrong. Also, if you have bugs and don’t understand what’s going on at first glance, use all the tools at your disposal like reading the docs for the API methods you’re using, using the debugger and inspecting the code of your page to make sure it’s behaving as you expected. There’s no need to try to be tough, examples and tools are there for a reason.

All those techniques will also help you with writing code that has less bugs since you’ll know where you are going. Coding more deliberately will help you make the best of your coding time and deliver better features.

Why should I learn a new programming language?

Column of books and young man with laptopLearning new languages and frameworks is something that every programmer needs to do sooner or later. You don’t always have the choice of which technology you are working on, and outdated technology is often replaced by something more modern. Even if you don’t have to do it, learning a new language is worthwhile to add new tools to your toolbox. Every language and framework has its strengths and different ways to think about things, which is valuable to know even if you have only a passing knowledge of it.

On the other hand, learning a new framework because it’s the flavor of the month is not a very effective use of your time. For example, JavaScript frameworks changes very fast and there are many of them: you may wish to learn a few to get a feel for it, but you don’t need to go too deep if you’re not using them since they’ll probably change by the time you get around to using them anyway. This is the strategy I used when I learned about SignalR or when I choose a framework for my side project. When you start a new project and need to choose which tools and framework to use, you can start with the knowledge you already have and learn more as needed for the project.

At my day job, we’re building software for large organizations, so the .NET framework is the tool of choice. So, my latest learning project was getting started with Ruby on Rails since it’s a framework that’s popular with small business and they have a different way of looking at things. Also, it is dynamically typed instead of statically typed so it is different enough to be interesting to learn.

To get started fast with a new language, my favorite way to go is to follow a good tutorial and build the sample application exactly as described. You must follow the conventions and standards from the framework or language instead of going with your own opinion. The goal here is to learn something new and see how people with experience with the language write and structure their code: do not try to repeat the same old way of doing things you already know in another language. For Ruby on Rails, I followed the excellent tutorial by Michael Hartl at

The point is to learn the language of course, but following a tutorial will also teach you about new tools. In the Ruby on Rails tutorial, the examples use Bootstrap as a front-end framework. I’ve come across it a few times, but I did not take the time to learn more about it before. Using it while doing the tutorial taught me about yet another framework that could come in handy with some project. I also learned a few neat CSS tricks from the examples that I did not know about. Make sure you understand what you are doing and keep your eyes open to get the most out of your learning time.

In conclusion, learning about new languages will broaden your horizons and make you a better developer in the long run, every if you don’t use every single one of those language in a “real” project. So pick any language and start hacking!