image result for Coding Hacks to Help developers write better code

Coding Hacks to Help developers write better code

Coding Hacks to Help developers write better code

Based on interviews of developers from top companies such as Google, Microsoft and Amazon.

Programming is hard. If it wasn’t, it wouldn’t be worth learning. But because it’s difficult to learn to code, it’s essential to pick up some useful coding hacks and strategies along the way to help you in your journey.
A good programmer does not limit himself/herself to develop code that works but always optimizes code to make it well-formatted so that it is easy to understand and comprehend by anyone else as well.

We reached out to different developers to know their best coding hack that makes their code effective. Here’s what we got to know:

image result for Coding Hacks to Help developers write better code

Kunal Purohit Fullstack Developer @Google :

“Be smart enough to ask the dumb questions”

1. For me, I noticed that I grew the most in responsibility and breadth/depth of knowledge once I let go of all efforts in trying to look smart in front of my team. When I was given complex and bigger tasks involving multiple domain entities or debugging I realized that there was no way to be productive trying to do everything myself. Even if you are on the same team for years, there will always be things you don’t know. You may find success learning things solo for smaller tasks, but for projects that have the real impact, you need to reach out to others. There is a small part of us that wants to impress others and protect our reputations, so throwing away our ego is a big ask! But in the end, I think it’s better to figure out what you don’t know ( especially if it’s basic stuff ), outline how that plays a role in your tasks, then find a person that can help you out!

2. I take this approach in all my projects, creating a one-pager of what I need to find out, detailing out the information I received, then outlining the work I need to do. In meetings, if someone is discussing a related topic I don’t fully understand I make a dedicated effort to ask for clarity during/afterward.

3. At first, you may think people will think less of you for asking about stuff you think you should already know, and maybe they do! Worst case, your reputation takes a short-term hit but you still deliver on the project in the end. Slowly, since you are understanding the basic building blocks of your team’s domain, concepts and outlines of tasks will become easier. This ties in a little bit to first principal thinking, where you are essentially creating a semantic tree of knowledge.


Souvik Das Full Stack Developer @ Microsoft :

1) Write Modular Code. Try to follow the “Separation of concern” strategy while writing code. That means try to write small methods/functions for a specific task or operation.

2) Do not use excessive comments. Better try to declare meaningful variable and method name, Hence no need to add comments. Your code should be descriptive enough.

3) Think about all edge cases while writing code to avoid runtime exceptions.

4) Try to break the big functions into smaller ones. So that it will be easy to understand for others.

5) Try to write descriptive code. Instead of writing complex ternary operators try to write the same using if-else.


Shantanu Kshire Software Engineer @Google :

1.Building Abstractions in code! Not sure whether to call this a hack; however, I think this is a highly effective coding technique.

  • Abstractions make your code much more modular and layered.
  • During any coding exercise, I start with a basic approach that solves the problem. I then proceed to take a closer look at the logic and try to build generalizations wherever possible.

2.  To optimize code: my pick for an optimization tool goes to Apache JMeter. This is an open-source software focused on load testing Enterprise and dynamic web applications. I have used JMeter to simulate heavy user traffic and analyze (Tomcat/Weblogic) server performance in my professional experience. The tool is highly customizable and a perfect fit for use cases such as –SOAP/REST Web services, Databases and generating load over TCP/UDP protocols.

3. About Testing code: I think cultivating a habit of writing tests is extremely important for Software Engineering. A rational code testing regime is a path towards building maintainable applications. I like to follow a simple rule – “Every functional source code change should accompany a unit-test”.
During coding, I often implement a Test Driven Development (TDD) process i.e.
1. Write a unit-test for a fix/feature which fails
2. Update source code with bare minimum changes to pass the test
3. Refactor code


Ankur Jat Senior Software Engineer @ Microsoft :

There are many but the few best ones are given below:
1. I make a note of code snippets whenever I encountered some best concise code snippets that helped in performance improvement.

2. I keep a cookbook of my own code snippets that gets repetitive. Like file upload code on S3, basic code setup, regex matches etc.

3. Code review. I keep doing a code review of peers and ask them to do mine. It opens up a new perspective and helps to improve the overall project health.


Akash Bhimani Software Engineering Manager @ Microsoft :

1) Write down what you want to code before you code it.

2) If you are working on others code, Make sure you left it with better quality than it was before.

3) Makes sure to improve test coverage of the code block you are working upon.

4) Maximise the use of tools to detect and standardize common errors.


Neerav Vyas Bohra Software Developer @ Amazon

1. The tools I use for optimization other than IDE are Mockito and Findbugs for testing.

2. There is no such hack for me I think thoroughly identifying current and possible future requirements along with significant time given to design make the code significantly effective.

3. So other than Unit tests which run with every build the code gets tested by QA. I usually just do basic sanity testing to ensure the main requirements are fulfilled.


Antima Pathak Developer @ Capgemini :

Best code hack -would be to include details in your code in a way if you want to use it, what all thing would you expect from the code to be doing for you..!! And then unit test it considering all the scenarios.



So these are some of the many hacks that are possible to make your code effective. Eventually, it would come down to your individual preference and environment to decide which habits you can cling on.
As many of the above developers pointed out that improvement is a continuous process so keep practicing and continue to write better code.

What are your favorite Coding hacks? Do you have any thoughts, comments or questions? Leave a comment below


Increase your code quality by getting accurate code review reports. Sign Up on our Automated Code Review Tool now for Free!

Liked what you read? Subscribe and get fresh updates.


P.S. Don’t forget to share this post

Post a Comment