The disturbances from within
Todo App written in Backbone.js and ASP.Net MVC

I’ve got a long way to go but I made it this far. Thanks to Addy Osmani for his in depth explanation of Backbone.js and other JavaScript concepts (https://github.com/addyosmani/backbone-fundamentals). Addy’s readme text was far better than most books that I have read in a long time. This man should be an author but I am thankful for his commitment toward technology and the fact that his backbone.js article is free to read. 

I’ve written my own library similar to the MVC concept in JavaScript but I was looking for a more mature library. My library was mostly made up helper functions that connected the model to the view and the model back to the data source. This has worked out well for the last year or so but required a lot of boiler plate code to handle on change events and so forth.

A while back, I came across Sproutcore and I was very interested in learning the idea behind an all in one JavaScript library but I was pushed off by the extra steps required to create a Sproutcore project. Plus for some odd reason, I’ve decided to cling to ASP.Net and C# as my backend so I was put off by learning something new like Ruby on Rails.  Then I came across Backbone.js and it intrigued me.  By the time I really got around to learning Backbone, Spine.js, JavascriptMVC and several other JS libraries popped up. I then set out to figure out which method was the preferred way and for more or less, I decided to stick with Backbone.  

Lots of tutorials, yes there are lots of tutorials and nothing that really discussed Backbone beyond the Todo app and especially nothing that discussed how to get Backbone to talk to ASP.Net.  I even went over to Peepcode and purchased one of their Backbone videos but Peepcode focuses on Ruby on Rails.

To make a long story short, Addy Osmani had a very good article about Backbone and how to add more structure using AMD.  The one piece still missing was how to get ASP.Net MVC to talk RESTful.  I found several articles out on the web but those were mostly hacks to get it appear as though the browser was making a RESTful request.  I then came across an article about Backbone and ASP.Net MVC from Bit Candies which showed exactly how to get Backbone and ASP.Net MVC to talk to each other (http://www.bitcandies.com/blog/). The Bit Candies demo used the standard Todo app and I was more interested in figuring how to take what Addy created and put it against the backend code from Bit Candies.    

Thanks to Jonahlyn Gilstrap (http://jonahlyn.heroku.com/blog/2011/12/02/backbone-drag-and-drop), I just added sorting to the Todo list.

Here is the link to the source code https://github.com/kalpers/Todo-App—Backbone.js-and-ASP.Net-MVC

Manning’s Node.js in Action by Mike Cantelon and TJ Holowaychuk

I’ve almost given up on grasping the Node.js experience. I’ve jumped from tutorial to tutorial which lead to nothing more than wishing the community could be somewhat more consistent but that is expected with a new movement like Node.  ”Node.js in Action” has breath new life into an interest toward Node.js. Just in the first chapter I was intrigued to read more.  It lays out the reasons why Node.js is different and how you can’t think about web development in the same way. Chapter 2 dives into setting up Node.js in multiple OSes including windows (I wish the chapter looked at the new node.exe from the windows environment, I’m not a big fan of cygwin as much as I use to be), discusses packages and lays out the concept about modules. Focusing on Modules early on was a big hit for me personally. Chapter 3 is all about asynchronous programming and it’s challenges. This chapter really opened up my eyes about potential issues a Node.js program might face in the what if type of scenarios.  It also brought me past the idea of just using callback functionality and to focus more on the publisher/listener concept. Chapter 4 gets into creating our first application which focuses on handling restful client requests and then touches on https.  Chapter 5 opens up with storing application data. There is more to think about regarding storing data then just using a standard DBMS database. In Node, you have to think about how to handle storing session data.  Node leaves a lot of this functionality up to the developer; however, there are several 3rd party modules that help facilitate this and this chapter explores several options.  The chapter also touches on other alternative DBMS systems that are also available for Node.js.  

I would definitely recommend this book to anyone that had an interest in Node.js. I can’t wait until Mike and TJ release the final chapters of this book.  I am really looking forward to chapters 7 and 8 that discuss Connect and Express.   

 http://www.manning.com/cantelon/

CoffeeScript on Windows

First of all, what I know about CoffeeScript (http://jashkenas.github.com/coffee-script/) can be put into a few sentences. So why CoffeeScript? My reasons are vast but in a nutshell, I believe in being as productive as one can and from what I have read about CoffeeScript that is entirely possible. CoffeeScript allows you to write less code, cleaner code, use the coding techniques of the cool kids and it compiles down to JavaScript the way it is suppose to be written.

I have spent the last few weeks off and on trying to get a viable solution to work in the windows environment. I have installed CygWin, Node.js and CoffeeScript but that solution wasn’t something I was looking for. I really didn’t want to pull up a CygWin prompt and run the CoffeeScript compiler. I really wanted a simple process that I could use right inside VS2008. After searching the web for VS plugins, I came across Chirpy. I am not sure what I did and didn’t do but for some reason everything worked except CoffeeScript. In VS2008 there wasn’t any place to change Chirpy’s configurations but I was able to get it working in VS2010. However, we are not currently using VS2010 so this was not a viable option.

Then I came across ( Link no longer exists http://mmaly.net/coffeescript-compiler/ ) that used JSDB to run the CoffeeScript compiler. This option was the same as using the CygWin command but I had a little bit of flexibly in the use of a dos batch file (my familiarity to dos vs CygWin batch files). I took Martin’s example and made a few changes of my own. The first thing I did was added the location of the dos batch file to my environment path. This allowed me to type in the Coffee command in any directory followed by the CoffeeScript file. I then edited one line inside the batch file from

\jsdb.exe -nojit compiler.js %1

to

%~dp0jsdb.exe -nojit %~dp0compiler.js %1

Using %~dp0 allowed me to retrieve the current directory that the batch file existed in and to pass in the actual location of jsdb.exe and the compiler.js file without having to change the working directory. Now all I have to do is open up a command prompt, change the directory to the location of my CoffeeScript files and run the “Coffee filename.coffee” command and wallah I have a compiled JS file.

My next task is to perform this task inside VS2008 as a command so I wont have to open up a command window. I will post this at a later time.