10 Programming Practices Fresh Developers Should Adopt

A few simple and best habits you should be using

Amrit Pal Singh
Level Up Coding

--

Photo by Fotis Fotopoulos on Unsplash

When I was a fresh graduate I was not aware of the many good practices that make you a great developer and improve your efficiency. I learned them the hard way.

Later in my career, I hired freshers and worked with them. In the beginning, most of them are naive and you spend a lot of time reviewing their work and training them. It takes them 2–3 months to bring them up to speed.

I came up with this list of concepts and practices that would be helpful for the newbies:

DRY — Do not Repeat Yourself

This principle is one of the most basic ones a programmer should know and always be mindful of.

If you are writing a code that you know you have written before, you should stop and think. Think about how you repurpose the code you have already written.

This might seem a little difficult in the beginning but when you are relooking at or redesigning your code it will be easy.

Good Variable/Function Names

Fresh graduates have a habit of casually naming the variables and functions like a, b, i, j, or fun1. They get this from their study days. And I have seen the other extreme as well, they give long names to their variables and functions that look like a sentence.

Writing a good variable name or especially a function name is an art that you master over time. Every time you think the name is not right, spend some time on it to find a great name.

Readable code and Meaningful Comments

We all know how comments make code reading and understanding easy. It is often recommended to write a lot of comments in the code. This can become hectic.

I prefer writing code that is easy to read and understand and writing comments for the most complex parts of the code. Most of the simple functions and methods generally don’t need comments if the code is well written.

Follow the conventions and guidelines

Programming languages have their conventions in terms of how to write code. On top of this teams decide their conventions and guidelines. For a new programmer, it is hard to understand the significance of conventions and guidelines.

It takes a little while to get the importance of guidelines. A newbie should follow the guidelines, read the code written by seniors, and adapt to that.

Rewrite/Restructure your code when you learn a better way

Code is not forever. Whenever you realize the code you have written can be improved or requires a restructure, don’t hesitate to rewrite/restructure.

A few times you need to rewrite/restructure due to a requirement or for scaling reasons. While there are other scenarios as well, you might foresee issues or you might want to make it more robust for the future.

This is a good activity to do when there is slack.

Function/Class should do one thing and should be short

As naive developers, we all write long functions that do more than one thing. Many teams have a guideline that restricts the number of lines a function can have.

The rule of the thumb is “A function/Class should do one thing and do it well”.

Open-closed principle

The Open-closed principle of SOLID rules states

“Software components should be open for extension and closed for modification”

This means any component in the software should be extendable without making a code change in the component itself.

Though this rule applies to any component in the software, it is one of the most important aspects of developing libraries that you use in your code or if you want to open-source them.

Every time you need to make an extension of a component, you don’t have to change the code. This saves you the effort of testing and deploying the component.

Design Patterns

While designing a solution for the task at hand, there is a good chance that more people have this problem and there is a well-thought solution available. In most cases, you might have to tailor the solution to your needs.

Learning design patterns can give you a new perspective on the problem or a quick way to a solution.

Learn Frameworks

Most of the freshers know a programming language or two. It’s seldom to see a fresher who has used frameworks.

Most of the languages have more than a few popular frameworks that force the developer to write the code according to the languages’ conventions. They bring consistency to the way developers write the code.

Understand the Business

When we write code we forget the bigger picture. Developers often are so emerged in the problem at hand that they overlook the business side of it.

Developers tend to pay more attention to the technical aspect of things. This is not bad at all, this is their job. But understanding the business side can bring a new perspective to look at the problem.

Conclusion

These are a few things I think a fresh developer should focus on. There are numerous other aspects that are important too.

What are your tips for fresh computer science graduates? Please write in the comments.

Like to experience Medium yourself? Consider supporting me and other writers by signing up for a membership. Membership is only $5 per month, it supports us, writers, at no extra cost. If you do so, I receive a portion of the fee, and it won’t cost you more. Thank you!

--

--

Cloud Software Engineer | Product Development | I write about Tech and Travel | Profile https://bit.ly/3dNxaiK | Golang Web Dev Course - https://bit.ly/go-gin