5 Simple Tips to Become a Better Programmer

Written by brunobrito | Published 2022/06/03
Tech Story Tags: webdev | testing | git | productivity | github | web-development | software-development | software-engineering

TLDRUnit Testing and Code Review are the best ways to keep your code stable. Pair programming is an ideal tool to share knowledge in a team. Git and Git version control is often underestimated: being proficient with Git makes you more proficient with the power to make you proficient. Keep it simple: Planning for the unlikely makes code unnecessarily complex. Don't try to foresee your project's requirements two years from now - too many things can (and will) change! You would waste time on an overly complex solution that proves to be different than you thought.via the TL;DR App

1. Unit Testing

Why? Every programmer has experienced something like this: you change a bit of code in one corner, and in a (seemingly) unrelated corner, something breaks! The bitter truth is: that both new and changed code will inevitably contain bugs. Use automated tests to help you keep your old code stable.

You can also go one step further and write tests before your actual code. This can give you a whole new perspective on how to approach problems!

2. Code Review

Why? Code that is only ever seen by a single programmer in your team is dangerous code: if that person gets sick or leaves your team, no one knows how this piece of your software really works. Additionally, no matter how great and experienced that developer is: it might be that he overlooked something, implementing only the second-best solution.

These problems can easily be avoided by always having team members approve each other's code. It's both a quality control as well as a means to create collective ownership of your project's code.

If pair programming (see below) is already an integral part of your workflow, you might not need additional code reviews!

3. Pair Programming

Why? Pair programming is an ideal tool to share knowledge in a team. Having a junior and a senior developer sitting side-by-side is the best way for the junior to learn. And since teaching is a great way to sharpen your own skills, even the senior can benefit.

Make sure that each person gets in front of the keyboard on a rotating basis. It shouldn't become an "I teach, you listen" event.

4. Keep it Simple

Why? Planning for the unlikely makes code unnecessarily complex. Don't try to foresee your project's requirements two years from now - too many things can (and will) change! You would waste time on an overly complex solution for a problem that proves to be different than you thought.

Keeping it simple shouldn't be confused with "quick and dirty". You still have to work thoroughly and carefully!

5. Design Patterns

Why? At its core, most programming problems belong to one of only a few general categories. These general problems have already been solved thousands of times - and are well-documented in a couple of "design patterns". Step back from the problem in front of you. You'll be able to apply proven best practices instead of reinventing the wheel.

Applying design patterns shouldn't become a religion. Sometimes, all that's really necessary are a few lines of simple code...

[Bonus!] 6. Version Control with Git

Why? Git and version control are often underestimated: being proficient with Git has the power to make you a better programmer - and help you build a better codebase!

Git is about more than just "commit, push, pull". Take its many "undo" features and you'll quickly understand how helpful it can be!


Also published here.


Written by brunobrito | Bruno works at Tower, the popular Git desktop client for Mac and Windows that helps 100k developers around the world.
Published by HackerNoon on 2022/06/03