What I need while writing a great code

What I need while writing a great code
  1. A distraction free surrounding

Programming is all about logic and thinking. Thinking and distraction are enemies of each other. However, when you are at workplace, lot of things can distract you. May it be sudden meeting, urgent call on app crashes, jokes with your co-workers or your neighbor playing loud music. However this is a part of team culture and can never be completely avoided, unless you are working from home.

When I look back at my performance and the period when I am most productive, it's no wonder that most of my thinking and productive output comes after 5 PM when there are hardly any people around. Also, during first few hours at work, I am distracted and tend to do things which could be avoided to improve productivity. But hey, [Twitter](https://twitter.com/) and [Medium](https://medium.com/) are there for a reason! Another weak point is every time I have heavy meal I feel like taking naps for at least an hour. That too results in least productivity.

It's ok to get distracted at work. As long as you know the reason for distraction you can always work them out. Try to do something which required least mental burden and cognitive load. I am also a huge fan of white noise when someone is loudly playing annoying music from their headphones(!).

  1. A creative work

Every engineer dreams of shipping the code which will make the world better place. For example, we always strive to write code which will give users the best experience while using the app. However, if you are entangled in repetitive and boring task, that will not make a happiest programmer on earth.

It does not goes to say menial bug and designs fixes are unnecessary. This goes with saying I like them but they do follow at the bottom of my list of things I like to do. As the rule goes, there will always be more menial and uninteresting tasks as compared to creative and challenging problems.

It also depends on your ability to take upon the challenge. If you don't like challenges and hate to think, you will always end up taking over tasks that will put you in the comfort zone, but will take away all the fun of programming and the creativity for which you are born.

  1. Fantastic team and great co-workers

Glad to say I am fortunate so far to have worked with excellent team mates who were always willing to help me out. When I started my job 3 years back in Columbus, iOS was new to me and everything I saw raised more questions than answering them. By god's grace my mentor who is a smart fellow, would always come to my help when I would raise any (stupid) questions. At my current job the situation is more or less the same, but now with more people to surround with and to ask help from.

The prime point of team is to impart knowledge to the team member so that they don't have to go through whole system again. Which saves the time and acts as an excellent resource for camaraderie among people. I cannot count how many friends I have made by asking silly and nonsense questions when I first started.

It is really important to have a mentor - At least for few days when you freshly start your new job who is helpful, approachable, good teacher and willing to help you grow in the new roll. Is everything works out, some years down the line, you could also be an awesome mentor for someone else. The tradition goes on!

  1. Always assume your work to be mission critical

What do you think when you write a code? It just works? What if it doesn't? It's not a big deal? Well, for some people it might be. After reading a random post on Quora I made this assumption for some time.

Always assume your code is going to get used in airplanes, space station/shuttle, medical surgeries or any application where human lives are at stake. I wonder how many times that is actually going to happen in real life, but it gives you more grip on your task. You become more serious and concentrated. Your willingness to make perfect code strengthens and adds up to the quality and polish of final product. I have seen it several time for tasks which I have really good idea about or are interesting, but I am experiencing just too much inertia to start the work, finish it or writing unit tests after completion.

When the mindset sets up so that you know your sloppy work can really kill someone, you get more serious about it. No one wants to be responsible (directly or indirectly, willingly or unwillingly, it doesn't matter) for a mistake that could prove fatal for other human beings

  1. Automation
    Are there any developers who haven't done automation on their job? Automation is an art and creative ways to save your time and show off the power of programming. Unfortunately, not all things can be automated. For example writing app and task which will fix bug by itself.

However, good news is certain things which require less mental burden, are repetitive and same in nature, behavior and output can best be automated. This includes but not limited to creating schema from JSON, search and replace with RegEx and creating metrics for app performance measure.

Few months back as a wrote a shell-script to automate following tasks with single bash script execution

  1. Make a commit and push
  2. Create a Crashlytics build and distribute it to tester and project managers
  3. Create a summary of tasks accomplished in a single day and send an email to team lead and relevant project manager.

Before I wrote a script, all these tasks would take around 20 minutes of my daily time, that too wasting too much time waiting on serial tasks. After writing a script I can now run it in one go 10 minutes before I leave and let it finish the business without any further intervention.

  1. Motivation

We all need a fuel to work. I am not talking about the physical fuel which is the food. This is more like incentive to make us work even better and dedicate towards our jobs. Well, you can say wealth is the major factor which drives people to work. But that is just a requirement. People will work for money, but they will fail to give consistent performance and loyalty to team if other motivational factors are missing.

They include an appreciation from superior letting them know they're doing great work and the impact their results are making on a company as whole. Some companies has recognition boards where a member of the team can recognize the colleague for their recent achievement. I personally like the open kudos from people saying I have done a great job. Sometimes promotions, switch to superior teams and privilege to work on challenging projects also act as a token of appreciation to employees.

These factors are inherently important in driving people to give their best and transcend the company expectations. Motivations cannot always be measured in terms of monetary value. I know some companies which have great teams and product they work on can act as a heavy motivational factor.

I will stop here on the list of things I need to write a great code. It's obvious that if I keep making list it will go on forever. These are some of my top personal picks which help me to do my job better and output efficient and productive results for the team. Did I miss anything? Let me know in comments. I would love to hear what are the things you need while doing your job?

I am Twitter. You can say Hi! to @jayeshkawli