Slaying The JavaScript Dragon
Hey folks!
The Node and JavaScript dragons have been hard to fight… Do you remember you used to look at precious stones?
That’s how Enrique’s email introduced the Friday challenge at the end of week 8 at Makers. Week 8 has been Hell Week. It was a beasting. It was hard. It was NodeJS.
I was looking forward to this week more than any other - it’s a great idea. More and more devs and companies are using Node, Rails is so opinionated as to be stifiling - so why not do another week of JavaScript dedicated to Node? Throw some CoffeeScript in there for good measure along with a seasoning of WebSockets and you’ve got a recipe for succeess.
Nope. See above. You’ve got a recipe for Hell Week.
JavaScript was a severe shock to the system for everyone. I was already relatively comfortable with the language - it wasn’t entirely new to me. But I still struggled with getting Express and Node.
I knew that JS was asynchronous - but I didn’t really know it, if you take my meaning. The difference between Sinatra and Express became apparent from the beginning. Where on Sinatra it was fairly easy to get RSpec and Capybara performing tests out of the box, with Mocha it felt like I was contantly and actively fighting against the framework. Callbacks came back unexpectedly or not at all. Tests passed - twice - when they should’ve failed.
The final straw came when we collectively couldn’t get read/write operations working consistently. I suddenly realised how spoiled I’ve been by using Ruby, RSpec et al – these are really mature pieces of software that act as you expect. I feel that Node and Express are amazing - don’t get me wrong. But I’ve found it nigh-on impossible to test them.
And if you can’t test it, then it doesn’t exist.
I’m still pressing on with Node/Express on the side, because I do really enjoy the environment to work in. I just need to slay the Mocha dragon and everything will be fine.
The Ruby refresher that was presented as the weekend work was like a beautiful sorbet - so refreshing after the hard week. As I answered the questions with simple one-liner methods I realised exactly how much I’d learned in the last eight weeks. I feel like I’ve got a firm foothold in the Ruby world.
Now on to the Mocha.