6 Easy Steps to Improve Your Writing Code Skills

Ramona Suciu
6 min readAug 28, 2023

--

In today’s technology driven world, the ability to write clean, efficient and maintainable code is an invaluable skill. Almost everybody can write code but only a few can go from an “hello world” text to complex systems. The main difference between programmers is their ability to design puzzle pieces in order to complete the whole. In this article we’ll explore together the main skills you should focus on in order to achieve this performance. Let’s get started!

1. Keep it Simple

Let’s be clear: when I’m talking about code simplicity I don’t mean avoiding complex problems but rather addressing those problems with clear and concise solutions. Simple code is easy to read and understand, straightforward to modify and easy to maintain. When developers can quickly grasp the purpose and functionality of a code snippet, they can easily make modifications or improvements. This readability becomes crucial especially when you are in a team as it reduces the learning curve for new members.

Here are some tips for keeping your code simple:

  • Follow Clear Naming Conventions (we will talk about this in the next paragraph).
  • Keep Functions and Classes Small. Divide complex tasks into smaller, manageable, independent methods. This not only simplifies the logic but also encourages reusability.
  • Avoid Over-Engineering. Again, planning and using design patterns is a good practice but just try to avoid implementing advanced design patterns or features that aren’t immediately necessary. This can introduce unuseful complexity.
  • Refactor Regularly. This is a very good practice so you can easily eliminate redundancies and ensure that the code remains aligned with project’s current needs.
  • Consistent Formatting. Simple trick but it can significantly improve code readability. There are tools to help you keep this consistency across the project so others can follow the rules easily.

2. Intuitive Names

You can think that your code is a piece of art and you are the MASTER! There is nothing wrong with it. But please don’t be that kind of artist who wants to create mystery in their masterpiece. We are not that kind of artists. We are programmers! And there isn’t space for “what if” in our code. This is science. You don’t wanna go to the doctor and, in the end, to guess your own diagnosis. You want him to tell you exactly what’s wrong with you. Think about this when you are writing your code. How? By choosing intuitive names for variables, functions, classes and other elements within your codebase.Intuitive names are those that convey their purpose, role or functionality, without requiring excessive mental effort from the reader.

The Benefits of using Intuitive Names:

  • Readability.
  • Reduced Cognitive Load: when names are intuitive, developers spend less time trying to understand the meaning behind variables and functions, freeing up mental capacity to focus on solving problems and implementing new features.
  • Easier Collaboration.
  • Maintenance and Debugging. Clear names can be a lifesaver in isolating issues quickly.

Strategies you can easily follow:

  1. Be Descriptive. Choose names that describe the purpose of the element. For instance, a function that calculates the average of a list could be name ‘calculateAverage’ instead of something vague like ‘doCalculation’.
  2. Avoid Ambiguity. If you have more variables related to time, differentiate them with names like ‘startTime’, ‘endTime’ instead of ‘time1’, ‘time2’.
  3. Follow Conventions. Stick to established naming conventions in your programming language or framework. This consistency makes your codebase more predictable and easier to maintain.
  4. Avoid Abbreviations. Opt for full words that provide clarity. ‘calcAvg’ might be shorter than ‘calculateAverage’ but they often obscure the meaning. It won’t take you that long to write the whole word.
  5. Reflect Data Types. Incorporate type into the name. For instance, ‘movieList’ immediately communicates that the variable holds a list of movies.
  6. Think about Scope. Names should be meaningful within the context they are used. A variable named ‘count’ might make sense within a loop, but for broader usage ‘totalCount’ could be more appropriate.
  7. Avoid letters. I think there is no point in arguing why we shouldn’t use names like ‘a’, ‘b’, ‘c’ in our code. They are saying nothing about their scope or type. You can be more creative than that. Set free the artist inside of you!

3. Follow Coding Standards

Every programming language or framework comes with a set of coding standards. Following them will keep your team on the same track. In this way, you don’t have to define your own specific rules and make sure everybody is following them. Is just better for everyone knowing that a BIG MAN once said you should use this convention instead of them seeing you as the God of the project. You can’t reinvent the wheel and this shouldn’t be your purpose. I like to think out of the box but following the rules is never a bad idea. Especially in this case.

4. Read Other’s People Code

There are a lot of us, with different minds, different styles, different approaches. That’s why I like programming. You have the freedom to paint that picture! You are in charge! I like to think of myself as a pretty good developer but there is so much more to learn in this journey like I feel there is never enough. Books and articles are a good source of inspiration but what I really like is reading other people’s code. Why? I like to see how they approached a problem, how they named a variable, how they designed an entire system. I’m not gonna lie. From time to time I’m borrowing what’s inspiring me and I never ever felt guilty about it. On the contrary, I felt this is the best way to grow. To accept that others can have better opinions, better approaches and learn from them. Trust me, you’ll see the difference. Don’t underestimate your colleagues. From interns to seniors they all have something to show up, to learn from but also they are on the same journey as you are, They also still have so much to learn. After a while you’ll be able to filter easily what’s good from everything. Just as you are doing in your daily life :) !

5. Write Comments

I know! Damn it! Again? Not you! I’m not gonna lie. I used to hate them too. I hated when others kept telling me ‘don’t forget about the comments’. I always did. But trust me, it only takes one time to spend at least 1 hour trying to understand what a damn function wanna do (written or not by you) and you’ll find the true purpose of them. You’ll never wanna go back to that road again.

Over time, software projects evolve and developers come and go. Without adequate comments, vital information about the codebase can be lost, making maintenance and updates a daunting task. Think about comments as a record of the rational decisions behind design choices, workarounds and even straightforward implementations. When revisiting code months later, you won’t have to rely on your memory, or read other people’s minds. You just have to read the comments to understand the purpose and functionality of each piece of code.

If those arguments never really touched your senses, here comes my favorite. Writing comments will make you reflect about your implementation, will make you have second thoughts, in a good way. You can find a better solution just because you thought about it twice. If not, you lost nothing.

6. Ask for Feedback

I know it’s hard to admit that your work can be improved but there is no shame in that. Knowing that you could do better, admitting that you might be wrong is a crucial step in your development. Others might not be on the same page as you are, but that’s also fine. Just ask for feedback! You might be surprised how many things we can learn from each other. A second view will never hurt your code. Will make it better.

Code review is a popular solution for that but there are projects where you are alone or the code doesn’t get to be seen by others. Doing code review is about reading other people’s code (which is a very good practice I mentioned before) and asking for code review is the short path in order to achieve job maturity.

There are so many ways to be better, to improve your skills and techniques. Start easy. Step by step. The change doesn’t need to happen tomorrow. At least not all at once. There are plenty of programmers in the world. Be the one who makes the difference. It doesn’t have to be big, you don’t need to be in front of the lights. You will be noticed! TRUST ME!

--

--