BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Interviews Nico Bevacqua on Writing Modular JavaScript

Nico Bevacqua on Writing Modular JavaScript

Bookmarks
   

2. I want to talk to you a little bit about your background to let the viewers know a little bit about you, so you got your start in Dot Net and C Sharp and stuff, tell me a little bit about kind of what got you started in programming?

So when I was young, obviously started up with like Pascal and pretty much like everyone else I guess. In school rather than college, same thing, and a funny thing happened where I started playing a game called “Ultima Line” and I was playing on an official server, and this server run on an OpenSource project called RunUO, and I didn’t know at that time but I became friends with the admins in that server and the guy that they have coding for them, they havea falling out and left, so they started like giving me a little piece of code and they were like: “You know code, right?” and I was like: “Yes, sure”. I just had to change like a String from here to there, so it worked fine. Over time I start learning like just for fun and like a year later or something like that a friend of mine comes and he is like: “You know, people get paid to do C Sharp stuff”, I was like so in love with C Sharp, I couldn’t believe that, and eventually I got a job working with it.

   

3. But then at some point in your career, you kind of decided you’ve got an interesting NodeJS, obviously a lot of like you’ve written and what you spoke about at the conference touched on NodeJS, so how did you kind of decide to pick that up, what’s part that interest?

Well, couple of years ago I read a book called The Pragmatic Programmer and that’s definitely the single best book that I ever read on programming and I really recommended. One of the thoughts that the book presents to us, getting out of your comfort zone and trying to learn a new language and for me that was Node because it really interested me and I also kind of wanted to get into writing about my experiences and so I kind of forces myself to actually finish the project, so I wrote a couple of blog posts before having anything to show for it, and that forced me kind of to be like Lean about it and actually finish coding what I started. Eventually I had like the minimum viable PonyFoo and I started writing some more.

   

4. PonyFoo being your blog. So you ended up writing, the project that you wrote was your blog the engine that runs your blog currently, right? And what are some of the challenges like so moving from C Sharp to Node what are some of the things that you found challenging?

Well it was interesting because I really learn a lot more about JavaScript than I thought I knew, because like asynchronous code in all languages tends to be a bit more mysterious and in Node it is like Single Threaded so there is no thread mashing going on. At first it’s hard to like properly handle errors in your Node code but eventually you get pretty good at it. Now I obviously hate what I did originally with the blog but that was like the first thing I was ever built, now I’m redoing it a little more cleanly but it’s good enough to post blog posts.

Brian: You’ve written a lot obviously about but you don’t even got into developing, you have some OpenSource projects and a number of them that you’ve released, tell us some of the ones that you are particularly proud of and tell us a little bit about them.

Well, I really like the Asynch Library which is a Library for managing flow controls that run asynchronously, but I thought like it was too big, it was like 30k when it was compressed. It just was like utility library like LowDash, it shouldn’t been that fat. So I really wanted to have something like that in the browser but if it’s that big you probably don’t want to commit, so I build Contra which is basically the good parts of Asynch and I added a few other things, for instance in Asynch you need to, you sometimes get an Array back when you are passing an object, or you can always pass an object to declare your different tasks that you have, and in Contra you can use objects and Arrays everywhere, you get the corresponding object back or Array back in the results. And it’s nice because what I really like about Contra is how synergistic it is within itself because it has a very simple queue implementation and everything else pretty much runs on that implementation of the queue, and that is really interesting to me.

   

5. It’s cool, and so another one of the projects you started was actually a book about JavaScript Development, what’s the topic of the book in what are kind of the key focuses?

The book is called JavaScript Application Design, for now at least, it focuses on processes and architecture in your applications and in quality in general. I speak about how to put together a build process that works well for you from the very beginning of your project, you don’t really need to like have a full blown build process from the beginning but maybe being able to automate your test in your linting is a nice thing to have from the beginning, and it’s sound like it’s pointless at that point but the thing is once you set all the harness for building your applications then is released to add more tasks to your build process and it’s just make it easier to scale as your complexity grows in your application and in your processes. That helps when compared with other projects where you may decide: “Hey, we need to improve the performance here so we need to minify and concatenate and whatnot,” and by that point maybe you are 4 months into the project and you don’t have anything set up around that, so you have to hack your layouts to do an if production then use the minified one and that sort of thing, whereas if you were using a build process from the beginning you won’t have those issues, because you’ll have already baked in the solution to do that more cleanly.

Brian: That make so it’s like an incremental way of building like starting small and then eventually you get, you’ll have this whole build system set up.

And the other part of the book is mostly about writing module architectures that are easy to test, how to test them, how to write asynchronous code that works well and the different options that you have like Asynch, generators, enumerators and that sort of stuff. When I talk about Modularity I also explain how to use Browserify and the different package managers that there are like Bower and NPM. And I also talk about RequireJS, I don’t mention I don’t like it, but I present it as an option.

Brian: I mean I guess right now that’s kind of the most popular choice in terms of what people are using the most, I suppose. In your talk you spoke a lot about different build tools and things like NPM andGulp and Grunt, but then you did talk a lot about Browserify, which you mentioned earlier, and you seem to kind of really, that’s kind of seems to be someone of a passion for you now is Browserify.

I was sort of playing with Browserify a few months ago, I haven’t been using it a lot but I can say that it’s really nice because is not only allows you to run CommonJS or, CommonJS is the module format for Node, it not only allows you to run CommonJS code in the browser which is modularper se, but it also allows you to exploit all of NPM which is huge and it’s something that no other module system helps you do, like RequireJS doesn’t help you do that unless you are using some sort of transform and at that point you are like mixing 2 different module systems which kind of becomes messy. It gives you NPM, it gives you modules and it allows you to shortcut between the browser and the server if that’s something that you need to do like if you are writing libraries that need to work well in both the browser and the server, with Browserify makes it really, really easy to do that and I don’t find clear ways to do that with any other module system.

Brian: Cool, all right so that’s all the questions that I had for you today, but thanks for coming all the way from Argentina, I hope you enjoyed your time here in New York City, thanks Nico!

Yeah, love it. Thanks!

Sep 29, 2014

BT