30
May 11

What ASP.NET MVC Could Learn From Rails

Most developers that are interested in bettering themselves really do want to hear both sides of the story. They want to understand the strengths of other platforms, not so they can move, but so that they can understand how to make their own framework/platform better. When you read this post, I hope you will read it with that in mind. I hope you will see this not as me criticizing your platform, or someone else’s work, but instead as me saying “here is what I think is cool about this other platform, how can your platform get in on that?”

A Tale Of Two Frameworks

There was a time when Ruby on Rails was the hottest thing on the block, and many ASP.NET developers pined for the day when we could leave behind controls and viewstate and move into the glorious world of web development. Cause what we were doing wasn’t web development, don’t kid yourself. Then ASP.NET MVC came out, and a lot of people (myself included) jumped on that bandwagon and have never looked back.

Continue reading →


25
May 11

Rails 3 Baby Steps – Part 5

Go here if you want to see an index for the entire series.

In the last entry of my Rails 3 series, we started looking at how you would implement a typical CRUD controller in Rails, but we really only explored how you would display the data from the controller. We also took a look at how you would route requests to that controller, and also how you might do some simple testing with RSpec. In this part of my Rails 3 series, we are going to take a look at the "UD" part of the CRUD controller; the update and delete actions.

Continue reading →


12
Apr 11

Building Epic Win With Backbone.js

I’ll just skip to the chase and start this post off by saying that our Windows VPS Hosting service, Epic Win Hosting has publicly launched! I know that it has been a while, and believe me, we wanted to launch it sooner. We have been in private beta, working out the kinks, but now things have come together and so now you can go check it out!

But at the end of the day, this is a technical blog and so while you might be interested in the product, I’m sure that you are at least equally interested in the technology behind it! So I want to give you a quick overview of how we used Backbone.js with ASP.NET MVC in order to build pieces of the Epic Win UI.

Architecture Overview

Before we get into Backbone, I wanted to get you a quick overview of the stack that we are using. The front end is built with ASP.NET MVC hosted on IIS, the backend uses MySQL for data, MongoDB for logging and auditing (although the more I use it, the more I want to put in it!), and RabbitMQ for messaging.

After all, Epic Win is an automation platform built on top of a few different services. So we need to store state about our user resources, and we need to invoke third party apis in a reliable way. We do this using a message queuing system that we wrote on top of RabbitMQ. Well, enough about the architecture, let’s get on with Backbone!

Front End UI With Backbone.js

When we first launched Epic Win as a private beta we built out the interface in order to create an instance. After we built the server instance interface, we decided that we needed to leverage a framework which would allow us to easily update the UI on the fly without a bunch of custom callbacks and hand written jQuery calls. I had been looking at Backbone.js for a while, and since it is both powerful and simple, I thought it would be an excellent time to leverage it.

Continue reading →


07
Apr 11

Rails 3 Baby Steps – Part 4

Go here if you want to see an index for the entire series.

In this post we are going to take a look at a typical CRUD controller in Rails. We will use a modified version of the controller generated by the command that we can in Part 3:

rails g scaffold Baby name:string age:integer

If we remember, this generated a ton of stuff for us (which can be good and bad), one of which was a controller called BabiesController. If you look in the controller you’ll see that a bunch of actions are in there. These actions were generated with important names, and one way to see that is by looking in our routes.rb file. In this file we will see that our entire controller is being wired up by one line:

resources :babies

So here we see what Rails calls a "resource route". It is a route which supports a common set of actions to support RESTful controllers. The standard actions supported are these:

  • index – Shows a list of all saved models.
  • show – Display a single read-only view of a model.
  • new – Renders a form to create a new model.
  • edit – Finds a model, then renders a form to edit it.
  • create – Where a new model is posted to be saved.
  • update – Where the edit form posts to be saved.
  • destroy – Deletes a model.

If you can, it is a good idea to use the resource routes and stick with the default naming. It’ll save a ton of typing and make thing more predictable. And don’t think that it’ll lock you down, the resource routes are completely configurable. You can add in custom routes and opt out of specific routes.

Continue reading →


31
Mar 11

Rails 3 Baby Steps – Part 3

In the last entry in my Rails 3 series we looked at hooking up a Controller and View so that we could render a page in the browser. By doing this we technically had a working Rails app, but we were missing one piece of the MVC puzzle, the model! In order to really connect the dots, we need all three pieces in place.

But before we go there, I want to hook up one more piece in our Rails 3 application…RSpec. You have probably heard in the past just how crazy Rails developers are about testing. Well, everything you have heard is true. Not only is testing a very good thing, but testing in languages that are as dynamic and flexible as Ruby are absolutely critical. While I am certainly not a TDD wizard by any measure, I do enjoy a nicely written, tested codebase.

Because in Rails we sometimes like to generate code, I would like to go ahead and get RSpec pulled in and wired up so that when we start to create our model and controllers, we get some example test code along with it.

Continue reading →