Full Circle - From Hating to Loving JavaScript

Monday, May 25, 2015 12:35 PM

Lately I’ve been talking at conferences more and more about JavaScript, TypeScript & client-side development technologies like Angular & Breeze. When I start the presentation, I like to ask two questions that, to me, really show where many of the developers fit in the world:

  • How many of you consider yourself strong JavaScript developers?” - Maybe 10-20% raise their hands.
  • How many of you are more like me, where you’ve been finding these cool dropdown menus in other sites, viewed source, copied and hacked your way through it… not working? Let’s add some alerts!” - At least 80-90% if not all raise their hands.

Yeah, so that’s been me for the longest time… someone who just doesn’t get JavaScript and in fact hated it as recently as two or so years ago. But talk about a turn around… I absolutely hated JavaScript but today, it is my preferred language for everything!

JavaScript is the best example of stockholm syndrome because we have gone from hating it to embracing it… simply because there has been no other option.

How Did I Get Here?

Great question! Maybe fourth-ish years ago I started to really gravitate to more client-side work as it just makes sense to me to push more of the work onto the client for scale reasons & because I believe the user gets a better experience. Silverlight was the first tech that I was sold on. But that got nixed and then we saw the rise of libraries like jQuery & KnockoutJS.

Then maybe two-ish years ago I started to work more on primarily client-side applications. I jumped on the single page application bandwagon with DurandalJS first and then Angular. Its funny because I was doing these types of apps in the late ’90’s when they didn’t have a name… but tools & frameworks we have now make it much easier to work with.

While I had been doing a bit of client-side code, this move to SPA’s really forced me to get back into real JavaScript development adopting good patterns and practices. As I got my sea legs under me I started to warm up to it. And then I started seeing this thing called Node.js and was a bit stunned when I realized it was a runtime for JavaScript on the server.

Like any typical developer, I was curious and started poking around. This opened up my eyes to a whole new world that really leads into the…

Why the Fondness for JavaScript?

Plain and simple: it’s everywhere from the stop to the bottom and beside my development stack. We’ve always had JavaScript for client-side development, but Node.js brought it to the server / desktop. And with that, you saw a HUGE ecosystem explode around developer tools.

I can’t stress that last part enough… the developer utility & tooling ecosystem has exploded thanks to Node.js! Why does this matter to me?

If you’re reading this I suspect you typically have a .NET background so I’ll make a few analogies. When you’re doing a typical ASP.NET project, what technologies are you using as far as languages go? You’re using JavaScript in the client-side part of your app, C# on the server side, your server-side tests are written in C# while your client-side tests are either in JavaScript / C# and most likely and your build process is described using XML to define MSBuild tasks.

So here’s what I started to realize. I’m not able to use JavaScript for the client-side portion of the app, JavaScript on the server via Node.js for the server-side part of the app. My tests are written using JavaScript with Node.js-based tools that run the tests both server-side & client-side parts of the app. And my build process is fully automated using a Node.js tool called Gulp with tasks described using… wait for it… yup… JavaScript!

I love the fact that it’s one language all the time, all the way up, down & sideways on the stack. No context switching between languages and tools. This was a surprise how the lack of switching languages and within projects made things so much cleaner and easier. And a cool little bonus: recently I got Node.js working on a Raspberry Pi 2 so I it even works on IoT projects… which is totally killer!

That’s the appeal to me… you can take advantage of all the skills, patterns, tools and techniques that you pick up for JavaScript and leverage it everywhere.

comments powered by Disqus