Perks of learning JavaScript or a new language

For 9 years, I wrote majority of my professional code in Java. I still do. For last one year I wrote lot of JavaScript. Learning new language gave me different experience and perspective. I am not expert in JS. In fact, I hesitate to call myself  average. So take any advice in the post with grain of salt.

Initial fear

I poked at JS several times. The absence of static feedback while writing code scared me. I never thought about it while writing SQL, XSLTs etc. In college, I didn’t know what eclipse is. I was happily using Turbo C Editor. I was just biased without getting my feet wet in JS.

Change the code and refresh the browser, you got your output and errors. The results are quick. After getting used to this, I don’t miss static typing, and any IDE.

How I Learned?

Some thoughts and advice

  • Learning new language introduces you  to new concepts. In this case ,I got my hands on concepts like functions, closures, lambdas, and prototypal  inheritance. It also encouraged me to try Scala.
  • Learning JS is not sufficient for web development. Know CSS and cross browser incompatibilities.It saves you lot of time.
  • Some of the best practices of coding in Java applies here too. For example, Single responsibility principle. Don’t cram all the code in single function. Learn from frameworks like Backbone. Explore the other best practices of the language.
  • Like in Java world, there are frameworks here too. For example, underscore, jquery etc can be considered as equivalent of guava or apache commons. Use them, rather than write your own utilities.
  • You can be productive in different ways. For  example, I had to develop UI  using REST api which is under development. I used node and express js to simulate the REST api, which is damn easy. I am not saying you should learn node and express just for this scenario. If you learn new language, your alternatives will grow.
  • Practice what you read. I have to tell this to myself over the years, several times. I made the mistake with other languages like Groovy, Python etc. I just read the books and didn’t write much code. Implementing a project changes everything.
  • Finally, don’t worry about whether you will be as good as your primary language. Probably you won’t. But does it matter when the journey itself is fulfilling?