DEV Community

ProgrammerMoney
ProgrammerMoney

Posted on • Updated on

How to INSTANTLY write better code?

There is one trick you can start applying today and you will immediately appear like a better programmer.

And not just "appear to be" but actually be a better programmer.

The best part is - you don't even have to learn anything new.

You don't have to do anything hard.

BUT

You do need to put a little more care into this one thing (more than you usually do).

So what is this "magical thing"?

It's function and variable naming.

And before you go "oh I already know that" - no you don't.

I worked with developers who have 2-3 years of experience and this is still a problem for a lot of them.

But why is naming such a big deal?

Because code is more being read than it is being written.

And if you're either naming your variables "too cleverly" or just too lazy - then this is going to slow down the entire team.

It will even slow you down - because in 2-3 months you will have no idea what was this all about.

This is literally the easiest hack you can do that will improve your code quality overnight!

Make your variable names as specific as possible and do not be afraid of longer variable names. (you are not in school anymore where every coding example had the variable "x")

Examples of good variable names:

  • getUsersFromStripe()
  • getActiveStripeUsers()

Examples of bad variable names:

  • getUsers()
  • masterFetcherInitiate()
  • runUserDownloader()

These almost seem OK but they're not specific enough (what if you have PayPal as well?)

Hope you find this helpful.

Until next time,
Will
Change Career From Software Engineer (To Premium Writer)

Top comments (0)