Don’t bank on motivation. It’s inherently a bad idea.

Looking for motivation is similar to addiction IMHO. You won’t get started till you get that hit. Motivation is like a resistant virus, the same motivation won’t work every day. You will need something new each day. A particular thing about motivation is -

You will get motivation when you least expect it.

You ask, what’s the alternative. I say “Discipline”.

Discipline keeps you on target without getting deviated. Discipline tells you to “Just Do It” every single time, anywhere, anytime. Discipline is reliable, discipline is the “Motivation”. Not just discipline, self-discipline. Your mentor won’t be with you all the time, you need to train your mind to discipline itself.

Till next time.

First blog of the year

It’s just unbelievable, I didn’t wrote a blog in such a long time. Focus isn’t on blogging but not to stagnate.

There must be something happening, must be learning new technology? must be creating some app or service through code? Well that definitely was happening, I didn’t shared it. Next blog I will be describing all the good and cool stuff I have been working on. I am hopping to write a blog fortnightly for sure.

Intentionally wanted this to be short blog, just to make a promise to write more.

Lately i have been making mistakes during my job and lot of them are logical, silly and easily detectable. But what is that happening? I don’t have ADD/ADHD(Attention deficit/hyperactivity disorder). Contrast is, i didn’t had these mistakes earlier.So I started slacking off on competitive websites during weekends.

Benefits

Performance started to improve as if I specifically don’t need to think about silly mistakes. In order words brain muscles got weak since I left my brain gym and now it’s pumped up. And it’s also true that overworking is good habit. Being in practice of finding all the test-cases for a problem let us think more profoundly.

Another benefit observed from this fallback is about procrastination. Now I procrastinate lot less, it’s because during competitive programming contest you just can’t stand because you aren’t in mood. It’s simple GET YOUR SHIT DONE attitude. Another benefit is to think fast through the problem. Thinking process becomes lag free, better concentration and got more work done is less time.

Brain gyms

There are lot of platforms like Topcoder, ICPC, Codeforce, HackerRank etc. But I personally prefer “HackerRank”(not sponsored). HackerRank got a good list of well curated problem. Problem language is mature and doesn’t look like total sci-fi. Site generates good amount of discussion on problem and is active for most part of the month and year. They have problem from different domains and not just algorithms and time complexity. It’s over all comp-sci problem which helps in over all development.

“So keep calm and code-on”.

Cheers

Good-bye i,j,k … variables. Good-bye soul-less variable names. There are lot of code conventions on the web but all their focus is formatting of the program which helps avoiding bugs. There is another aspect of code convention, that is having pragmatic variable names in your program/code.

My focus is to avoid bugs in code through a sane approach of naming variables. Variable can be the common confusion point of your program, especially if you want it to be read by your colleagues and maintainers. One’s program must be like a story and variables must be the characters of the story. One definitely doesn’t want characters to have non-sense names, right? Every program must a unique story and avoid plagiarism whenever needed.

BLAME GAME

Competitive programming gave us a habit of short & funny variable names. Everyone cared about time complexity. That’s not all I never got evaluated for beauty of my program at my academia too. Code must run and produce desired effect, isn’t that the deal?

TRUTH

Blame game is shame, period.

More reasons, pragmatic variables makes code maintainable and doesn’t let bleed my(or others) eyes. Though it may take some time to arrive at thumb rule but it’s worth the pain. Your co-workers will really appreciate these variables, also they enhance your vocabulary(pun intended).

Thumb Rules

  • Function - [Adverb] + Verb
  • variable - [Adjective] + Noun
  • Global variables - ALL CAPS NOUN
  • Avoid borrowed/duplicate variables

So next time you go for generic names like (var_a, var_b, bad_var, i, j,…) for variables, do yourself a favor, pinch yourself or take cold showers.

Always follow good practices.

Writing code can be scary especially in a collaborative environment and when you have to avoid techical debts.

But first what is technical debt?

Have a look at gif below and imagine you are coding instead of driving

In simple words : code you wrote isn’t maintable, hard to understand and does not follow code conventions of others.

So the first rule for writing code is understanding who is going to maintain it, who is going to add further code to it. And even that doesn’t matter, writing good code should be a habit and shouldn’t be broken at any cost.

Solution to bad code

  • Follow code conventions.
  • For eg. while writing python follow pep8 conventions and while writing js code follow jslint conventions

  • How granular or modular code should be?
  • For eg. There should be separate function for separate task. It may depend on number lines of code for that function.

  • How often comments should appear and on what severity?

THE TRUTH

One can’t write perfect code in one go. Refactoring, pruning is the key. May be you need to burn all your sphagetti code and it would definitely pay off.

More concrete steps

  • Bad habits doesn’t go easily. So there is pair programming for that. Pair programming reduces effort on new learning and makes new learning easy and fast. Key to good coding is good discussion. Look at the code written already and discuss about it and rewrite if needed.

  • DESIGN : Technical debts can also be attributed to wrong code designs. Design is not just about visual art, it is also the architecture of code. Fitting code is no joke.
    • Agility comes from good code design.
  • REFACTOR : Refactoring code brings new features to the application in current development, so refactor more and often.

Technical debt is like karma, gonna kick you soon or later.

That’s enough of water-cooler side talk. Keep avoiding technical debts.

Notes

Thanks Shyam Sundar for reading the draft.