Alexander Beletsky's development blog

My profession is engineering

.NET Developer in JavaScript World

This is a subscript of lighting talk I did on #odessajs conference that took place 13 April in Odessa.

The story

Thinking about the things going on inside and around me I realized - I don’t do .NET development more than 1.5 years for now. It’s not the first time I was thinking about that, but now it has a bit different perspective.

WTH?

I work in E-conomic company and about 2 years ago we decided to build new product.

Till that time we’ve learned hard few things: plain jQuery applications is mess, building new shinny product on out-dated infrastructure is bad idea.

So, we’ve started with front-end by choosing Backbone.js as our foundation, later on we’ve decided to switch our API server from .NET to Node.js.

It appears we got full JavaScript stack on that product and I involved in JavaScript more and more each day.

I thought I know JavaScript

That time I mistakenly thought, I can do JS programming. Sure, I understood jQuery selectors, concept of callback and even why we need ‘var me = this;’ trick in code.

But the reality was a bit different. Now, listening to podcasts and reading some blogs, I understood that I’ve been to ‘classic’ trap on C#/Java developer switching to JavaScript. Languages and frameworks requires time to learn.

Long hard way of learning

I had to spend the time to learn new stuff. I would say the best source of information was the code written by my colleagues. We have great team, so initially I were just reviewing the code following some patterns. I also spent time of peering famous OS projects like underscore and Backbone.js.

JavaScript Good Parts, opened my eyes on few important things as well.

There are 3 aspects that changed my mind on JavaScript.

JavaScript is dynamic language

Let’s be clear. If someone in 2003 tell me I’m going to program dynamic language and will be happy about, I would never believe that. I was programming C++ and truly believed in types. Types as I was thinking is only way to tackle complexity of software.

Even though, I still think about some advantages of static vs. dynamic languages, my opinion has changed radically.

Dynamic languages are great. I feel I more solve problems rather than designing types (or usually hierarchy of types). Consider that, instead of thinking about the name for next “ProxyAbstractFactoryManager” I’m writing functions that do stuff.

Frictionless development

I was compiling applications for whole my life. Just to run some simple thing I need to compile and link. It’s usually not a problem at all, but depends on project infrastructure it can take a lot of time. Sooner or later you start to hate builds.

With JavaScript application, you simply should run it. It starting fast so the gap between “write the line of code” and “check the results” became very small.

Instead of heavyweight IDE’s I became Sublime Text 2 user. After years in VS you simply could not understand how to write code without IntellySense. But practice shows it’s really possible.

Node.js

To be honest with you, I was very skeptical regarding Node.js initially. But again, practice showed different results. It’s been proved that Node.js is very suitable for our product. We are running API server on Node.js and it performs really nice.

Later I started to learn what Node.js platform offers and I was really surprised with it’s abilities.

CommonJS style of writing code started to make sense. Namespacing problem is solved, so you can build big applications there.

I have to add that Node.js is a significant Open Source player. Everything you get by npm is open source, you can check the sources if anything unclear. Most of Node.js modules are hosted in github, so even if you experience issues you can fix it.


Conclusions

JavaScript is awesome. I like the experience of JavaScript programming so far. Whatever you do, front-end or back-end you stay in one “language context”. I would not call a huge problem, but usually context switching from one language to another can take something.

Picking up technology for next side-project or quick hack I’m selecting JavaScript.