DEV Community

Seven useful programming habits

Bart Karalus on July 08, 2017

This short entry was also published on my personal website I have been reading some good books on forming habits recently. After digesting these, ...
Collapse
 
pattyguereca profile image
Patty

Any tips on where I can find programming exercises?

Collapse
 
conchakiing profile image
Anthony

Codewars.com is a cool site with a bunch of exercises

Collapse
 
pattyguereca profile image
Patty

thank you!

Collapse
 
johannesvollmer profile image
Johannes Vollmer • Edited

Code wars is a nice site, but the exercises are only little algorithms. Sadly they can't reproduce the experience made with an (even little) completed project.

Collapse
 
tyronepost profile image
Tyrone Post
Collapse
 
dev3l profile image
Justin L Beall

Avoid "future programming" -one of the strongest points here that seems counterintuitive, but is fundamentally critical.

Simple designs are future proof... complicated designs anticipating an unreal future are messy (not clean).

"Last Responsible Moment" - The key is to make decisions as late as you can responsibly wait because that is the point at which you have the most information on which to base the decision.

Collapse
 
andrespineros profile image
Andrés Felipe Piñeros • Edited

I've been here so many times that I'm actually ashamed.

First think of the Minimum Viable Product (MVP). Give functionality to yourself or your client. THEN, when things are working worry about improving them.

Trying to create a perfect design from the start is impossible, mainly for one reason: we often don't really understand what the client wants, and neither does the client. When we work on small functionalities that grow and improve over time, we give ourselves (and the client) time and experience to understand the domain of the problem and understand WHERE the software needs to be improved for real.

Collapse
 
binaryforgeltd profile image
Bart Karalus

Great input. I heave heard something like that somwhere... not sure where though. Take your time to make a decision and decide late, but then execute fast.

Collapse
 
jorinvo profile image
jorin

In line with these practical habits, I would add the habit of thinking in commits: Even if I work on non-programming projects I put the project in a git repo and I structure my work in steps doing one thing at a time, commiting and then reviewing the changes.
Doing work without committing it after feels like I haven't finished it.

Collapse
 
ohnonapples profile image
Pine Apple

I also started "writing any code from forming some test cases". Basically after I create a method in an interface, I leave it unimplemented. Then I create a test class with various test scenarios so that they all fail first! I will work on the implementation till all test cases pass.

Collapse
 
damcosset profile image
Damien Cosset

I think I share your point of view about being "in the zone". To be honest, Being in the zone as a developer doesn't look all that attractive. I always thought as "the zone" as a state of mind where you are performing at your highest level, doing things you already know.

As a developer, you might want to always reach outside your comfort zone. Not always, but a reasonable portion of your time should probably be spent stretching your comfort zone, feeling uncomfortable.

Collapse
 
val_baca profile image
Valentin Baca

"Flow" is not doing things you just already know. It's when your skill in an area is high and when the challenge is high as well.

This graph, from the wikipedia article on Flow sums it up succinctly: en.wikipedia.org/wiki/File:Challen...

What you're describing is more in the "Relaxation" section

Collapse
 
binaryforgeltd profile image
Bart Karalus

Thanks. You are right but I believe we all, devs or not, should aim to keep on stretching the comfort zone as it seems to be the best way to grow. :)

Collapse
 
julichala profile image
El Chala

I love doing desktop tests with paper and pencil for complex functionalities with lots of logic. This helps me understand and better document my code.

Collapse
 
sanguine8082 profile image
Aaron Pfalzgraf

I do this too! It's usually to try and understand what code someone else wrote is doing.

I'll take the excerpt I'm stuck on, print it out, and then draw lines between function calls, highlight areas, etc.

There really is something different about having it physically in front of you.

Collapse
 
binaryforgeltd profile image
Bart Karalus

That is great! It is sometimes good to write or draw our thoughts down on a good old piece of paper. They appear to make more sense when we can see them with our eyes. :)

Collapse
 
legolord208 profile image
jD91mZM2 • Edited

Eight useful programming habits:

  1. Always add semicolons. It's easier to automatically remove them than having to later relearn the habit to add them...
Collapse
 
changemyname profile image
Evgeny

Yea, I have bad habit. Sometimes my mind drifts away to other thoughts, when I read. If anyone has something similar, would want to know how you deal with that. Personally I end up re-reading the paragraph.

Collapse
 
lewismenelaws profile image
Lewis Menelaws

"So basically short zone bursts are great for performance but make sure you take regular stops."

Couldn't agree more. Not only this, but failing to do this could lead you into burning out for weeks.

I was once working 2 jobs, a mall job from morning to afternoon and coding from afternoon to night. I would never take breaks.

I got the project done but by the time I was 80% complete I was working only at 50% efficiency. I tired my brain out. Especially since it's staring at a screen all day.

Great write-up Bart.

Collapse
 
kinbiko profile image
Roger Guldbrandsen

Oooh! On the note of auto-saving: I do that too, and moving to IntelliJ which saves on my behalf was annoying at first. But! I found a trick: Make Cmd+s/Ctrl+s run your last test. This works regardless of programming style, but it gives you super powers if you're doing TDD! It also subconsciously validates that your files have been saved as they must be saved to be executed.

Collapse
 
cryptowalrus profile image
Just a Walrus.

Great article!
This Ctr+S habit is a real lifesaver.

Collapse
 
fergek profile image
Fernando Gekdyszman

Do not under estimate the power behind a sound-proof basement. We architects would rather say "it's a trade off" ☺

Collapse
 
ben profile image
Ben Halpern

These are all great tips.

Uncontrolled auto save

I see a co-worker using this and it seems so weird to me, but you and he seem to love it.

Collapse
 
binaryforgeltd profile image
Bart Karalus

Thanks Ben! I know it seems weird but at least it does not make any harm.

Collapse
 
kaydacode profile image
Kim Arnett 

I do this, it's also saved my bum a few times.
Sometimes I get carried away and save my browser. lolol.

Thread Thread
 
tournetorres profile image
Tourné Torres

I did that twice today. Accidentally saving my served files that I'm only occasionally demoing in the browser. It's embarrassing when you're showing a teammate a bug you're currently trying to fix.

Collapse
 
binaryforgeltd profile image
Bart Karalus • Edited

I often tend to create wrong assumptions and take them for granted while spending too much time in there. Thanks!

Collapse
 
onurbmsilva profile image
Bruno Miguel Silva • Edited

Great list! . One habit that I have is to have a notebook and a pencil to write all sort of things and sometimes to draw some quick code debbug.

Yap cmd+s is Life.

Collapse
 
marksasp95 profile image
Marco Suárez

These are great! Book name?

Collapse
 
binaryforgeltd profile image
Bart Karalus • Edited

Thanks! The book I had in mind while writing this was Stephen Covey's "The 7 Habits of Highly Effective People" and although it is definitely worth reading, it has got nothing to do with programming. :)