Let's talk about good and bad programming habits


#1

I was talking with one of my friend yesterday, I had trouble with some problems both in codecombat and hackerrank.

My friend just said thatIi had a bad habit of not using pseudo-code for complex problems and it makes everything very hard to read.

separating the problem in many parts will definely help solving it.

So I was wondering what do you think is a bad programming habit and what are good habits?


#2

What exactly is pseudo-code? Just proper spacing in your code? Also how is hackerrank? Never heard of it before. My cousin keeps bugging me to try out an engine and I keep telling him after I’m finished this game =P


#3

pseudo-code is separating your problem in steps
writing what you want to do with normal text in comment
Code combat already write a lot of pseudo-code to help people with the problems. But we don’t really learn to do it ourselves

For example if I want my hero to get the coin that has the most value compared to distance I could separate my problem in many steps. It might look silly for easy problem but as stuff get more complex I believe it is important to do.

The thing is when you write down code, you don’t really want to go back and write all over what was already done

1st step: # Find all the coins
some code here.

2st step # get all the coin value and divide it by the distance to get a new value:
some code here

3st step # compare the the rating to get the best coin
some code here

4st step # get the coin
etc

Hackerrank is a website that give problems and you have to solve them, each problems give you points and you get on a leaderboard. Even though I find most of the problems are quite hard.

And yeah I think doing stuff with an IDE is something important too. Codecombat is good at making you learn the language but at some points you will have to learn how to import modules and libraries and work with what was already done. Meaning you’ll have to read documentation.


#4

Ah gothca, thank you Gabriel =)


#5

I think a bad programming habit is when you be lazy and you think about doing it tomorrow, then the next day thinking about doing it the next week, then the next week thinking about doing it next month, etc, etc.

A good habit would be to try to learn some coding, and when you fail, try to do it again, make some mistakes, but not purposely, and get frustrated that it’s not working, but trying and trying again.

Also this reply is making me a hypocrite.