Blog - Microsoft .NET, ASP.NET, AJAX and more

Behavior Driven Development (BDD) with Cucumber and ASP.NET MVC

by Damien White 6/10/2010 6:18:40 PM

cucumber_logo So as I’m sure you have guessed by my last bunch of posts, I’ve been hooked on Ruby and Rails development.  The more I use it, the more I love it.  I felt I was loving it a bit too much, so decided to divert my attention back to ASP.NET MVC for a while.  While developing with Rails, I was practicing BDD with Cucumber.   I felt that Cucumber scenarios (written Gherkin) were far more useful for the majority of my testing on a web application.  Sure unit tests are worthwhile for bits of code, but I’ve found that they don’t always make sense when testing a web application (like Steve Sanderson has mentioned).  Some may argue that these tests are brittle, but honestly, I feel it defines my application better and it definitely tests the actual interactions better.  I’m fully on board for unit tests for complex processes, but the majority of web work just isn’t that complex.

I’m not going to go fully into what BDD is here, but my goal was to use a similar process when developing ASP.NET MVC applications as I did in Rails.  With Rails, it’s simple, Rails, Cucumber, Pickle, ActiveRecord, Factory Girl, Webrat, etc. work perfectly together.   In the .NET world, there are options, but nothing that really fit together as nicely.  I started with just wanting to test my basic application (menus, breadcrumbs, etc) and didn’t venture into model work yet, so I figured it would be as simple and efficient as it is in Rails.  Not so much.  I tweeted about this exact thing a while ago.  More...

Shout it kick it on DotNetKicks.com Bookmark and Share

My Affair with Ruby on Rails

by Damien White 3/25/2010 10:18:00 PM

As I’m sure most of you know, I’m a hardcore C#/.NET guy.  The majority of my work as been on the web, and I’ve been using ASP.NET since the earliest betas.  ASP.NET’s profound effect on web development is still going strong to this day.  For me, the first choice for web application development has been ASP.NET.  Well, I decided to venture out a bit recently. 

WHAT?

Believe me, I feel a little “dirty” cheating on ASP.NET MVC with a mistress named Ruby but I have to tell you, Rails is incredible.  Let the record show I am still one of Microsoft’s and .NET’s biggest fans, and I still love C#.  That said, I am one of those developers who just flat out loves learning.  I am so passionate about development, it consumes me (just ask my wife).  So one day last year, I decided to broaden my horizons and look at Rails.  I attribute my development metamorphosis to Manning Publications and the “Pop Quiz” they ran last fall.  Their daily questions got me looking beyond the .NET realm into other areas a bit outside my comfort zone.  Being outside your comfort zone allows you as a developer to see things in a totally different light.  It’s real good to mix things up a bit, and it makes you an all around better developer.  In fact Peter Bromberg recently tweeted “I think one should learn everything they can. Then, you'll be in a better position to decide what you want to use.”  I couldn’t agree more.  More...

Shout it kick it on DotNetKicks.com Bookmark and Share

How To: Adding MVC items to an ASP.NET Web Application

by Damien White 5/20/2009 9:30:10 AM

HTML Code I’ve been experimenting with using ASP.NET MVC inside a standard ASP.NET Web Application (Web Forms).  I really like what’s been released with MVC 1.0 and can see places where existing apps would benefit from the features.  Plus, having just finished Professional ASP.NET MVC 1.0 from Wrox (see my book review), I couldn’t wait to start using it. 

The last chapter of the book, Chapter 12, entitled “Best of Both Worlds: Web Forms and MVC Together,” discusses configuring an ASP.NET Web Application to support the new ASP.NET MVC features.  Note that adding Web Forms to an ASP.NET MVC project template is much easier (meaning no configuration/reference changes), since ASP.NET MVC is built on top of the ASP.NET Framework.  Anyway, after referencing the required libraries, creating the necessary directories, and updating the web.config, you’ll find that templates for the MVC items (e.g. Controllers, Views), are missing as options.  More...

Shout it kick it on DotNetKicks.com Bookmark and Share

Book Review - Wrox Professional ASP.NET MVC 1.0

by Damien White 5/17/2009 12:01:58 PM

Professional ASP.NET MVC 1.0Working primarily on web applications, I’ve focused most of my time on ASP.NET Web Forms since the very early betas.  Web Forms were truly a great revolution in the web world.  Once I saw the functionality when it first came out (when I was using ::shudder::  “classic” ASP), I couldn’t wait to start using it.  I began right away with ASP+, as it was called back in 2000, abandoning Visual Interdev and ASP, yippee.  The release of Version 1.0 came out January 16, 2002, changing the way we work with the web.

Flash-forward 7 years (9 from the early betas), and the programming world has changed.  With things like TDD (Test Driven Development), AJAX, JSON, jQuery, etc, and the complexity of web applications growing, sometimes Web Forms would get in the way.  To be fair, the Web Form framework is very robust and tries to be helpful, but sometimes we developers like to shoot ourselves in the foot.  One example that I’m sure many of you have experienced is trying to interface with a server-rendered element on the page.  Performing something like a document.getElementById(‘UserName’) in JavaScript doesn’t exactly work as expected when the ID of your textbox is now something along the lines of “ctl00_mainContent_LoginCtrl_UserName,” does it?  On this particular topic, ASP.NET 4.0 has a solution for this problem, but that isn’t the focus of this post.  The Client Id problem, is just one example of the framework “getting in your way.”  This is one of the many reasons behind the advent of ASP.NET MVC.  Having just finished Professional ASP.NET MVC 1.0 from Wrox, I’m a convert. More...

Shout it kick it on DotNetKicks.com Bookmark and Share
Tags: , ,
Categories: .NET | ASP.NET | MVC | Review
Actions: E-mail | Permalink | Comments (5) | Comment RSSRSS comment feed