How will you make it if you never even try?

October 13, 2010

Hello, JavascriptMVC!

Filed under: ASP.NET MVC, Javascript, JavascriptMVC, JQuery, SproutCore — charlieflowers @ 11:37 pm

I am *very* excited about the fact that the project I’m working on has just decided to use a powerful framework called JavascriptMVC.

JavascriptMVC is a framework that helps you build and maintain robust Javascript client-side applications. It gives you Models, Views and Controllers inside of Javascript. It gives you dependency management between Javascript files. It gives you unit tests that you can run in the browser, OR from a command line in a browser-simulating Javascript environment as part of your Continuous Integration build. It gives you a lot of fantastic tools for going further with your Javascript than just adding some bling to your server-driven web pages.

I mentioned in my last post that I believe SproutCore is far and away the best framework for building interactive web apps in Javascript. That’s true. However, JavascriptMVC is also an excellent choice, and I’m very much looking forward to working with it.


SproutCore Rocks, and you will be hearing about it

Filed under: ASP.NET MVC, Javascript, JQuery, SproutCore — charlieflowers @ 11:24 pm

SproutCore is an AWESOME framework for building rich internet applications in JavaScript. In a nutshell, it’s like having Cocoa inside of JavaScript (but better) … and the world is just starting to realize that is the “Right” way to be building web apps.

I have to admit, though, it sounded crazy and weird to me 2 weeks ago. But that was before I and others on my team started to be able to articulate and understand some of the problems we were running into and some opportunities for fixing them (as I described in my last post).

Look, Javascript is now a solid, reliable, powerful language for serious development. “I know,” you reply, “and that’s why I’m using JQuery and Ajax.” Right, that’s “level 1” awareness that Javascript is now a real, reliable language. At that level, your MO is to build the same server-driven web apps we’ve been building (in Rails, ASP.NET, or whatever), but to sprinkle in some JavaScript for some “bling”.

But after you do that for a while, you may find yourself staring at “level 2” awareness that Javascript is a real, reliable language. That’s when you say, “Hey, why don’t we build a full-blown dynamic GUI in JavaScript, that is in control of its own “flow”, that *can* choose to pull some data from a server, or send some data to a server, if and when it wants to. After all, JavaScript is a *real* language suitable for real development.”

This has been dubbed the “thin server architecture”. Your server sends and receives JSON, and does not *at all* involve itself with html or any presentation concerns. And your client doesn’t even have to follow a “page” model (although you’re likely to be running in a browser and want the back button to feel normal, so you might “map onto” a page model). Your client can be rich, and can pull great ideas from GUI toolkits such as Swing, AWT, Cocoa, etc.

And I really believe the best framework out there for doing this is SproutCore. It severely lacks documentation, but that doesn’t matter as much as you might think, because the source code for it is absolutely beautiful. It is elegant, succinct, and well-factored. That plus some of the excellent tutorials out there really put a tool of enormous power in your hands. Once you make an initial investment in deeply understanding SproutCore, I really believe you gain the kind of power that lets one person do the amount of work that previously required 10 people.

Check it out. Unfortunately, my current project just decided not to use it. It was just too weird to them. There were a lot of developers on the team who balked at learning something so “different”. What they couldn’t see was that the tool is so powerful that only 1 or 2 people would need to learn it, and our UI would simply become a “solved problem.” Oh well, I can understand … the world hasn’t yet caught up to the “level 2” awareness that I mentioned above, and so SproutCore seems weird.

But you wait 6-12 months, and I bet you everybody and their brother will have heard of SproutCore, and more than just the “cool kids” will be using it. It is going to leave its mark on the web development world.

October 6, 2010

Going Beyond ASP.NET MVC and JQuery

Filed under: ASP.NET MVC, C#, Javascript, JQuery, SproutCore — charlieflowers @ 11:14 pm

I’ve been having a blast for the past year building an app in ASP.NET MVC (I’ll call it “MVC” through the rest of this post) and JQuery. And I’m very fond of both.

But an interesting thing happens when you build something complex with these 2 technologies. You’re very likely to find yourself facing a conundrum regarding how far to go with Javascript.

Here’s how it happened for us…. We started out trying to keep our logic on the server as much as possible. We can utilize the full power of C# and the .NET framework there. Even our controllers are unit testable, thanks to MVC and IoC. We have mature tools and patterns for unit testing that code. We can refactor it with Resharper. Etc, etc.

But of course, the beauty of JQuery and MVC in tandem is that you can make your web apps more interactive and responsive. So of course, we did some JavaScript on the client. Matter of fact, we didn’t shy away from any UI request our business users had. “You want a grid that lists Personal References, and the ability to select one from the list and Edit it? You want to be able to add new and delete from the list? Cool, we can do that without a single postback.”

And we have done that. And it is nice. A responsive web app with some nice usability features. But here’s where the conundrum comes in.

To make it nicer, snappier, more responsive and even more usable, we’d like to add more JavaScript. And we’d like to use Javascript in more places than we do currently. Sometimes, we wonder why we’re even building HTML on the server … why not return JSON from the server, and have some Javascript code on the client generate a DOM from it? That would certainly make better usage of bandwidth.

But … the JavaScript we have is already complicated. And when you’re building a UI with Javascript, you don’t have a lot of the benefits that you’re accustomed to in other UI technologies, such as change notifications, widgets, controllers, mature unit testing capabilities that are built in to your build process, etc. So the grid for Personal References, for example, took a while to get right. We were working at a primitive level, with individual DOM elements, click events, grid rows, etc.

The key realization was this: You either need to keep the amount and complexity of your Javascript very, very limited, or you need to really jump all in and do almost all of your UI work in Javascript. Anything in-between is a no-man’s land.

If you keep the Javascript very limited (more limited than what we needed for that Personal References screen, for example), then MVC and JQuery are enough for you to keep matters well in hand. But when you approach moderate or greater complexity, you need to make a quantum jump to a very Javascript-centric approach. And when you do that, you need Javascript Framework capabilities, for things like change notifications, controllers, widgets, unit testing, etc.

At that point, you have grown beyond just ASP.NET MVC and JQuery. Of course, both of those may still play a role in your solution, but you need more. It’s at this point that you should consider things like SproutCore, Cappuccino, JavascriptMVC, etc.

Which are some of the things we’re thinking about now.

Create a free website or blog at