Wednesday, February 25, 2015

Code Paralysis

Starting that new project…or feature…or class.

One thing I get tripped up on is starting to write new code.

I think about what my class name should be. If what I'm writing is modular or abstracted enough. Or maybe it's too modular. "Should I use this here?" "Maybe I'm taking this too far." "Maybe I should start over?"

Sometimes I feel like I'm overthinking things. Because I'm afraid I'm going to do the wrong things.

And then I get stuck. I get "code paralysis".

Code paralysis

I can freeze up when writing code because I want to use the right class name or make things as reusable as possible.

However, this typically happens when I want to learn something new, but because I'm afraid of doing it wrong I stay within my comfort zone.

I would like to use Backbone.js on a new project or feature, but I'm afraid I don't understand how to separate my code properly.


Ember.js is amazingly flexible, but I'm not sure how to handle SEO for the area it'll get used on.

These are legitimate concerns. It's not that these worries don't have some bit of truth to them. It might be difficult to effectively separate my code in Backbone or how to handle SEO in a section driven by Ember.

However, there was a time I didn't understand the first thing about ExpressionEngine. Or build tools. Or Git. Or jQuery. Or HTML. And when I look back at earlier projects using these things, I realize they could be better.

A lot better.

Learning good tools by making mistakes

It's not that I intentionally used these tools badly. I just developed better practices after using them in production settings. All of these tools were worth learning even if I didn't understand them fully in the beginning.

I look at projects I worked on a year ago and wish I wrote my CSS differently. And my JavaScript differently. And my HTML differently.

I'm still learning how to write better HTML, the first language I ever learned.


...wabi-sabi is the art of finding beauty in imperfection and profundity in earthiness, of revering authenticity above all.

Wabi-Sabi: The Art Of Imperfection

There's a great King of the Hill episode where Bobby Hill enters a rose contest. His rose isn't as impressive as the other contestants', but it's authentic. His teammate points out that it has "Wabi-Sabi". Its imperfections is what makes it great.

I get so tripped up on not fully understanding something new that I avoid it altogether. I'm afraid of all the little imperfections that I'll write. The many, many imperfections.

But code I wrote yesterday has imperfections. And there's a huge payoff in taking a chance on something new. I'll write some bad code. There's no avoiding it. But learning something new will give me a bigger toolset. It'll allow me to write better, more maintainable code. It'll give me the ability to take on projects that were once intimidating.

Give something new a chance

You should still be cautious using something totally new. Don't start that new project with something you've never used at all. I don't want to encourage using that new MVC you haven't spent a day with.

But give that new thing a chance in your spare time. Learn how to use it. Ask questions on things you don't understand. Build some contrived stuff. Build some real stuff. And if you come across a project that would benefit from 80% of it, give it a shot. You'll learn how to do the other 20%.

And then you'll look by six months from now and think, "This could be better."

A lot better.