Why JavaScript is giving me depression…

Disclaimer: This is not a serious post. It’s intended to be a little tongue-in-cheek. Before you try and start a war in the comments section for either the “JS sucks” camp or the “JS is the second coming” camp, I won’t be approving any of those comments as THIS POST ISN’T SERIOUS and I’m not speaking for either side.

For the last year I’ve been building Oystr, a collaborative problem solving platform, upon Node.JS. Prior to moving entirely into JavaScript for the full stack, I had been developing on top of .NET using C# for about 15 years. Over the last year I’ve found working with JavaScript on the server to be liberating at times compared to the .NET/C# world. But this has come at a huge cost. My initial elation with JavaScript is now beginning to turn to depression. For a while I’ve been going backwards and forwards between elation and depression so much that I started to feel kind of bi-polar. But now, I think I’m ready to call it. JavaScript is making me depressed.

I think one of the biggest annoyances is the lack of types. I know people are probably thinking “I could’ve told you that” but let me explain. It’s not so much the lack of any strong typing, it’s more what strong typing provides you… auto-complete. Man I miss proper VS.NET auto-complete. The thing I love about JavaScript is it’s duck typing. But obviously this has come at the cost of my sanity.

But really auto-complete is just a convenience. That’s not the main reason I feel depressed with JavaScript. The main reason I feel depressed when I go back to working with JavaScript, is that re-factoring just feels so much harder. I don’t have any quantitative data to back this up, it’s just a feeling. But damn it’s stressful when I want to do something simple like rename a method. I’m always worried that WebStorm will accidentally rename similarly named methods or properties. And here is the worst part… I can’t do a compile to do a simple sanity check. Sure if something compiles it doesn’t mean it works for sure, but it sure goes a long way in giving you the peace of mind that “oh, it seems to be OK…” which is a hell of a lot better than feeling “have I missed or forgotten anything?!?!?!” and never actually feeling comfortable with saying it’s all fine until you’ve done a full systems test.

This compile-time related depression (I’m calling it CTSD for Compile-Time Stress Disorder) extends beyond the fact my compiler safety net no longer exists. It’s the fact that when I started programming 22 years ago, what got me so excited as a child when I moved from BASIC to C / C++ was that I could compile my code and when it compiled / linked properly, it felt like a milestone. Programming, for me, is more than just work. I love to code, it’s part of who I am. Taking away one of the things that makes me feel like I’m getting somewhere (whether that’s actually true or not) just sucks the fun out of programming for me.

I think for the sake of my sanity and to bring joy back into my nerd life, it may be time I put down JavaScript and start looking for something not CTSD prone.

6 thoughts on “Why JavaScript is giving me depression…

  1. Nice one, Chris. I can relate to ‘CTSD’ and that vague sense of unease one gets when refactoring in js…feels more like you’ve done a dirty global search and replace rather than a proper renaming, and you find yourself fully expecting to go “oh bollocks” within the hour. Regarding duck typing, C++ is an interesting case. If you use a lot of templates, you get duck typing AND compile+link peace of mind.

    • It’s comforting to hear that I’m not the only one feeling this. 🙂

      It’s funny you mentioned C++ because I was thinking of going back to it for my back end. Although what immediately distracted me away from that line of thinking was spending a little time looking into Go and being seduced by the simplified memory management. I’ve been spending the last few weeks learning Go and I think I’m probably going to go for an adventure into that. I’m optimistic about it, but I hope it doesn’t turn into a different kind of depression…

  2. TypeScript might just be what you’re looking for. It can be a little frustrating at times when there are no typings for random libraries but if it’s a simple library it’s fairly easy to hand roll a .d.ts file.

    • Thanks for the tip Gavin. I’ve thought about TypeScript many a time but one of the deterrents for me is the lack of type checking when using duck typing. Duck typing is one of the reasons I love using JavaScript so much!

  3. Pingback: Sharing an ExpressJS / Connect / PassportJS Session with Golang – Part 1 « My Memory Sucks

  4. Pingback: Why JavaScript is giving me depression… (Part 2) | My Memory Sucks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s