DEV Community

Cover image for The best way to get better at writing code is...
Jake Lundberg
Jake Lundberg Subscriber

Posted on

The best way to get better at writing code is...

How can I learn to write better code?

What's the best way to get better at coding?

Over the years, I've heard lots of developers ask questions like these. And it's understandable...the world of software development is a big place. It's easy to get lost and not know where to go next or what you should be doing to get better. But don't worry! The answer is surprisingly simple. You want to know how to get better at writing code?

Write more code!

Yep, it's really that simple. Just like so many things in the world, to get better you simply need to do more of it.

Want to get better at running? Run more!

Want to get better at pushups? Drop down and do some pushups!

Want to get better at public speaking? Speak in public more!

You can buy the best equipment. You can read all the best books. You can watch all the best videos. But at the end of the day, the best way to get better at all of these, is simply to do it more.

Experience is often the best teacher.

While tutorials and courses have their place, nothing beats hands-on experience. Here's why:

  1. Critical Thinking and Problem Solving: When you write code without following a tutorial, you're forced to think for yourself. You have to solve problems on your own. This develops crucial skills that you'll need throughout your career.

  2. Learning from Mistakes: We often learn the most when we make mistakes. By writing code on your own, without someone else telling you exactly what to do, you'll encounter errors and challenges that will teach you valuable lessons.

  3. Encountering Real-World Problems: As you code more, you'll run into all kinds of problems and learn to solve them. The next time you encounter similar issues, the solutions will (hopefully) be easier to implement.

  4. Pattern Recognition: With experience, you'll start to see patterns and anticipate needs before you encounter them, making you a more efficient and effective coder.

A Word of Advice

Now, at this point I should probably express that practice is going to get you pretty far. It will teach you to write better code...especially if you are working with others, and continuing to learn new things as you do. But there is more to building a career as a software developer than only writing code. Much like running is only a part of living a healthy life. Don't make the mistake of neglecting the other parts as you move forward.

Suggestions from Lessons Learned

With that said, please allow me to offer a few additional suggestions to improve your coding skills. All of these I'm sure you will have learned yourself as you practice, but looking back on my own career, these are just a few things that would have helped a lot.

  1. Save your code: Over my career, I've written a LOT of code. Unfortunately, early on, I wrote a lot of random stuff just to learn something and then deleted it. But later, as I wanted to share my knowledge (both for interviewing and teaching), I no longer had those things to use as examples or reference. I look back and wish I had saved so much of what I wrote. So my first piece of advice is don't make the same mistake I did. Save your code. You'll be glad you did!

  2. Commit Small and Often: If you've ever gotten "in the zone" or reached that sweet sweet "flow" state while coding and then looked up after a while to find that you've changed dozens of files, made hundreds of thousands of changes, and didn't make any commits along the way, you probably already know why this is valuable. This allows you to track your progress and revert changes if needed. Even if an approach doesn't work out entirely, you might be able to salvage useful parts of your code.

  3. Don't Be Afraid to Break Things: Be bold in your coding experiments. The worst that can happen is that you'll learn something new. Remember, in a properly managed development environment, it's hard to cause irreparable damage.

That's It

Improving your coding skills is a journey, not a destination. By writing more code, and not being afraid to make mistakes, you'll steadily become a better developer. Remember, every expert was once a beginner, and the key to their success was consistent practice and a willingness to learn from their experiences.

So, the next time you find yourself wondering how to improve your coding skills, remember this simple advice: write more code. Your future self will thank you for the experience and knowledge you gain along the way!

Thanks for letting me share, and I can't wait to see what you build! Happy Hacking!

Top comments (1)

Collapse
 
ben profile image
Ben Halpern

Great advice

Some comments may only be visible to logged-in visitors. Sign in to view all comments. Some comments have been hidden by the post's author - find out more