Posts tagged as:

ASP.NET MVC

monkey-knife-fight Platform wars are like monkey knife fights: amusing at first, but regrettable and messy in the end.

You don’t see this very often, and it’s a shame: Jacob Kaplan-Moss, co-creator of Django, the Python-based MVC web application framework, wrote a great article titled Thank You, Rails. From the article’s opening paragraph:

It’s fashionable, or perhaps inevitable, for tech communities to trash their competition…We geeks make arguing over minor technical points into a kind of art.

The most important point in his essay is a few paragraphs down. He points out that while having a competitor often lends focus to a developer community and that a rivalry can often bring about excellence among all parties concerned, it can also bring bitterness and nastiness. He wants to counter those latter things, and so he writes:

I think it’s important to recognize that we in the web development community do in fact owe Rails and the Rails community a debt of gratitude. Rails helped reframe the way we think about web development, and even those who’ve never touched Rails nevertheless are probably reaping indirect benefits right now.

So I think we should all step back from our personal preferences and plainly say thank you, Rails, for all that you’ve done to move the state of web development forward.

Rails was a wake-up call to the web development world in so many ways. In the short time – a mere five years — that it’s been around, it’s been responsible for many changes in the world of web applications:

  • Popularizing MVC amongst web developers. Yes, it had been done before, but never quite as elegantly or explained so clearly.
  • Bringing concepts like DRY and Convention Over Configuration into the developer vernacular.
  • Proving that simplicity is a feature, whether it’s from the developer’s or end user’s point of view.
  • Pointing the spotlight at the Ruby programming language.
  • Driving a movement towards web applications with both beautiful and usable interfaces.
  • Reminding us that programming should be fun.
  • Reinforcing an important idea that we often forget: community matters. (If you’ve been to a RailsConf or better still, RubyFringe and FutureRuby, which takes the Ruby/Rails community camaraderie and turns the dials up to 11, you know what I mean.)

Speaking as a Microsoft guy, I too would like to say “Thank you, Rails”. While I can’t honestly classify myself as ever having been a serious Rails developer – it’s mostly noodling on personal projects and one major cancelled project at Toronto’s worst-run startup – I come from the periphery of the Rails community, having been an unofficial evangelist and occasional court jester, as evidenced in this performance from the evening keynotes at RailsConf 2007:

I take a lot of what I’ve learned from the community-building effort that made Rails what it is today and have applied it to my work at Microsoft. From what I’ve been hearing, it seems to be helping.

It’s not just the community aspects of Rails for which both Microsoft and I owe Rails a debt of gratitude — there are the technical aspects as well. I’m sure the event-driven desktop-style development metaphor behind ASP.NET makes a lot of developers happy, but it drove me bonkers – and also to PHP (and eventually, Rails) — back in 2002. The drive to create an MVC web application framework that treated the web like a first-class citizen instead of “like the desktop, but lamer” led to the creation of my preferred Microsoft web framework, ASP.NET MVC, and I cannot begin to convey how grateful I am for that. I love ASP.NET MVC, and a good chunk of the reasons why stem from the Rails-isms that found their way into it. I think ASP.NET MVC developers would benefit from getting to know Rails and taking it out for a spin – and I think the Rails developers would also gain something from giving ASP.NET MVC a try.

I once read a saying that has stuck with me all these years: “When you slice a blade of grass, you shake the universe.” Yeah, it’s a pretty drama-queeny way of saying that everything is interconnected, but it’s true in many respects, including human endeavour, which in turn includes software development. It’s an ecosystem, and different parts of it influence each other all the time. I think that the best participants in that ecosystem learn from other parts, and acknowledge those efforts that make the ecosystem a better place in which to live.

joey-devilla-on-accordion-at-railsconf-2007

So to echo a Django guy’s sentiment, here’s a Microsoft guy saying it: Thank you, Rails.

This article also appears in Canadian Developer Connection.

{ 0 comments }

TechDays: Colin Bowern and “Introducing ASP.NET MVC”

by Joey deVilla on September 30, 2009

Colin Bowern doing his presentation at TechDays

It’s Day 2 of TechDays Toronto! and after a hearty breakfast, we’re kicking off the Developing for the Microsoft-Based Platform track – my track, and thus to my mind the best one – with Colin Bowen doing his presentation, Introducing ASP.NET MVC, which takes a look at the new web development framework, ASP.NET MVC. If you’ve done development with Rails, Django, CakePHP or Catalyst, you should find ASP.NET MVC familiar.

gang_of_foreheads If you’d like to learn more about ASP.NET MVC programming, the best place to get started is chapter one of the “Gang of Foreheads” book, a.k.a. Professional ASP.NET MVC 1.0, which I covered in the article The Best “Chapter One” I’ve Ever Read. This particular chapter walks you  through the construction of an entire site using ASP>NET MVC – NerdDinner.com – from start to finish.

You can get a free copy of chapter one of the Gang of Foreheads book [14 MB PDF] – er, I mean Professional ASP.NET MVC 1.0 – which is more than enough book to get you started.

Want the source code for NerdDinner.com? Not a problem – it’s an open source project on Codeplex released under the MS-PL license (and yeah, it’s Open Source Initiative-approved!).

Want to learn more about building applications using ASP.NET MVC? Watch this space!

This article also appears in Canadian Developer Connection.

{ 0 comments }

Microsoft TechDays Canada 2009: 2 days - 7 cities - 5 tracks - 40 sessions - plus more!

In planning this year’s TechDays conference, we made some significant changes to the developer tracks: they were reformulated into:

  • A “tools and techniques” track, called Developer Fundamentals and Best Practices, for which my friend and fellow Developer Evangelist John Bristowe is the track lead
  • A “technologies” track, called Developing for the Microsoft-Based Platform, which I lead.

As the track lead for the Developing for the Microsoft-Based Platform track at TechDays Canada 2009 conference, I thought I’d take the time to talk about it and praise its virtues.

Designing the Track

Each track lead has the responsibility of designing his or her track. We pored over all the sessions from TechEd North America 2009, consulted with developers or IT pros for their opinions on what topic they’d like covered and came up with a selection of 8 sessions for each track.

When choosing my sessions, I kept these philosophies in mind:

  • TechDays is about current tools, technologies and techniques. That means talking about stuff you can get your hands on and use in production right now: Visual Studio 2008, .NET 3.5, SQL Server 2008, and so on. Visual Studio 2010, .NET 4.0 and Azure are fascinating tools and tech, but they’re not yet on the market, so they’re not in TechDays. We made a few exceptions for a couple of things that are coming out right around now: version 3.0 of Silverlight and the Expression suite and Windows 7.
  • TechDays is about giving the audience the biggest bang for the buck. It’s more than simply taking the content from the TechEd North America conference (which has a steep registration fee and you have to also factor in the costs of flying to and staying in New Orleans) and bringing it close to home with local speakers and a reasonable price tag. It’s also about choosing the content that best serves an an audience that uses Microsoft tools and tech in their day-to-day work. There’s no point in rehashing presentations that the audience has already seen a dozen times before, and neither does it do any good to cover topics that are interesting but impractical. I tried to strike a balance — in choosing the sessions for my track, I kept this question in mind: What sort of things will this audience be using that they aren’t using yet?
  • TechDays is more than just throwing random information at the audience. A track needs to be more than just a collection of sessions simply thrown together. It works best if it’s a set of sessions whose topics fit together to form a cohesive whole, almost as if telling a story. While picking out the track’s sessions and arranging them, I tried to set things up in such a way to best show the possibilities that open up when you develop on the Microsoft-based platform. 

The Developing for the Microsoft-Based Platform Track

The Developing for the Microsoft-Based Platform track breaks down into four topic areas, as shown in the diagram below:

platform_track_chart

The topic areas are:

  1. Day 1 morning: Rich UIs
  2. Day 1 afternoon: Client Tech
  3. Day 2 morning: ASP.NET MVC
  4. Day 2 afternoon: Web Services

They’re explained in greater detail below.

Day 1 – Front End: User Interface and Experience

Day 1 of the Developing for the Microsoft-Based Platform is about building the front end, that layer of our applications with which the user interacts, and about giving the user the best experience possible.

The morning will be an introduction to the latest version – version 3 – of our rich interface technology Silverlight and our rich interface-building tool, Expression Blend. In the afternoon, we’ll shift the focus to building client technology by looking at the PRISM guidelines for building applications with modular Silverlight- and WPF-based front ends and the API code pack for building .NET applications that take advantage of Windows 7’s new UI features.

The tools and technologies covered on Day 1 are:

  • Silverlight 3
  • Expression Blend 3
  • WPF
  • Windows 7
  • Windows 7 API Code Pack for the .NET Framework
  • Windows Mobile

Day 1 Morning: Rich UIs

Track Introduction
Presented by Joey deVilla
9:00 a.m. – 9:15 a,m.


Session 1: What’s New in Silverlight 3
Presented by Cory Fowler
9:15 a.m. – 10:30 a.m.
Cory Fowler Rich internet applications just got richer! Silverlight 3 is packed with new features and improvements that your users will notice, from pixel shaders to perspective 3D to animation enhancements to bitmap APIs to HD video. We think you’ll also be impressed by the features for developers, such as the updated style model, data binding improvements, better resource handling, and a tuned-up Web services stack. In this session, we’ll explore new features of Silverlight 3 as we build a Silverlight-based application using Expression Blend 3 and Visual Studio.

Session 2: Expression Blend for Developers
Presented by Barry Gervin
10:50 a.m. = 12:05 a.m.
Barry Gervin Not a designer? Overwhelmed by Expression Blend? Not a problem! We’ll show you how to use Expression Blend to create advanced and polished user interfaces for business applications, consumer applications, multimedia projects, games or anything in between. We’ll cover features of Expression Blend from a developer’s perspective and show how it works in tandem with Visual Studio throughout the development process. You’ll learn how to create professional-looking user interfaces and visual elements – even if you don’t think of yourself as an interface designer.

Day One Afternoon: Client Tech

Session 3: Building Modular Applications Using Silverlight and WPF
Presented by Rob Burke
1:10 p.m. – 2:25 p.m.
Rob Burke How do you build extensible and maintainable line-of-business applications in Silverlight and Windows Presentation Foundation (WPF)? How do you design and code to handle real-world complexity? Composite Application Guidance (a.k.a. "PRISM") offers guidance, libraries and examples – in small, free-standing, digestible chunks – that you can use to build applications with rich user interfaces that are also easier to maintain and extend. You’ll learn how to compose complex UIs from simpler views, integrate loosely coupled components with "EventAggregator" and "Commands", develop independent modules that can be loaded dynamically, and share code between Silverlight and WPF clients.

Session 4: Optimizing Your Apps for the Windows 7 User Experience
Presented by Anthony Vranic
2:45 p.m. – 4:00 p.m.
Anthony Vranic This session will show you the Windows 7 APIs that will let your applications – and your users – get the full Windows 7 experience. Learn about new extensibility methods to surface your application’s key tasks. Discover how enhancements to the taskbar, Start Menu, thumbnails, desktop elements, the Scenic Ribbon, Federated Search and Internet Explorer 8 provide new ways for you to delight your users and help make them more productive. If you want to give your users the best Windows 7 experience, this session is for you!

Bonus Session: Taking Your Application on the Road with Windows Mobile® Software
Presented by Mark Arteaga and Anthony Bartolo
4:20 p.m. – 5:30 p.m.

Mark Arteaga and Anthony Bartolo As a developer of .NET-based applications, you can extend your desktop software to the Windows Mobile-based platform using the tools available within Visual Studio®, the Windows Mobile SDK and the .NET Compact Framework. This session will give you an overview of how Windows Mobile lets you use your existing infrastructure, business logic, and desktop code on a mobile device to innovate and help solve business problems. We’ll show you how to use the familiar Microsoft .NET Framework and .NET-based programming languages like Visual C#® development tool. You will also learn about new features in Windows Mobile 6.5 such as the Gesture APIs and the Widget Framework and how to use them appropriately. With the launch of Windows Marketplace for Mobile upon us, this session will help you take the next step for application testing and submission.

Day 2 – Back End: Programming Frameworks and Principles

On Day 2, the track moves to the back end, focusing on server-side programming tools and technologies, and even wandering into the area of technique.

The morning’s sessions concern themselves with the new option for developing web applications using ASP.NET: ASP.NET MVC, the alternative framework based on the Model-View-Controller pattern, in the same spirit of such frameworks as Ruby on Rails, Django and CakePHP. The afternoon will be about writing web services using various Microsoft technologies.

The tools, technologies and techniques covered on Day 2 are:

  • ASP.NET MVC
  • The SOLID principles of object-oriented design
  • WCF
  • REST (REpresentational State Transfer)
  • SharePoint

Day 2 Morning: ASP.NET MVC

Track Introduction
Presented by Joey deVilla
9:00 a.m. – 9:15 a,m.

Session 1: Introducing ASP.NET MVC
Presented by Colin Bowern
9:15 a.m. – 10:30 a.m. 
Colin Bowern You’ve probably heard the buzz about Model-View-Controller (MVC) web frameworks. They’re all the rage because they combine speed, simplicity, control…and fun. ASP.NET MVC is Microsoft’s MVC web framework, and in this session, we’ll talk about the MVC pattern, explain the ideas behind ASP.NET MVC and walk through the process of building an application using this new web framework. We’ll also cover several techniques to get the most out of ASP.NET MVC and deliver web applications quickly and with style.

Session 2: SOLIDify Your Microsoft ASP.NET MVC Applications
Presented by Bruce Johnson
10:50 a.m. – 12:05 a.m.
Bruce Johnson Object-oriented programming makes it easier to manage complexity, but only if you do it right. The five SOLID principles of class design (one for each letter) help ensure that you’re writing applications that are flexible, comprehensible and maintainable, and we’ll explain and explore them in this session. We’ll start with a brittle ASP.NET MVC application that’s badly in need of refactoring and fix it by applying the SOLID principles. This session is a good follow-up for Introducing ASP.NET MVC, but it’s also good for developers of ASP.NET MVC looking to improve their code – or even if you’re not planning to use ASP.NET MVC. The SOLID principles apply to programming in any object-oriented language or framework.

Day 2 Afternoon: Web Services


Session 3: Building RESTful Services with WCF
Presented by Bruce Johnson
1:10 p.m. – 2:25 p.m.
Bruce JohnsonREST (REpresentational State Transfer) is an architectural style for building services, and it’s the architectural style of the web. It’s been popular outside the world of Microsoft development for a long time, but it’s quickly becoming the de facto standard inside as well. Windows Communication Foundation (WCF) makes it simple to build RESTful web services, which are easy to use, simple and flexible. In this session, we’ll cover the basics of REST and the show you how to build REST-based, interoperable web services that can be accessed not just by Microsoft-based web and desktop applications, but anything that can communicate via HTTP from an Ajax client to a feed readers to mobile device to applications written using other languages and frameworks such as PHP, Python/Django or Ruby/Rails.

Session 4: Developing and Consuming Services for SharePoint
Presented by Reza Alirezaei
2:45 p.m. – 4:00 p.m.
Reza Alirezaei The world gets more service-oriented every day, and with that comes the demand to integrate all kinds of services, including those from SharePoint. This session introduces SharePoint as a developer platform and provides an overview of how you can build and deploy custom services with it. The focus will be on developing ASP.NET and Windows Communication Foundation services for SharePoint as well as building a Silverlight client to consume them.

This article also appears in Canadian Developer Connection.

{ 0 comments }

Scenes from May’s Metro Toronto .NET User Group

by Joey deVilla on June 25, 2009

Better late than never! Here are a couple of pictures I shot at the Metro Toronto .NET User Group in late May, where I presented my walk-through of ASP.NET MVC, Canada’s Next Top Model View Controller.

Colin Bowern opened the session with some quick announcements about upcoming events as well as other .NET user groups in the Greater Toronto and surrounding areas:

metro_toronto_dot_net_ug_1

He then introduced me, and I got started with my presentation. I did a quick walkthrough of the basic concepts behind MVC (that is, the Model-View-Controller design pattern), after which I introduced a special guest who I brought along with me: Paul Doerwald. Paul’s a Ruby on Rails developer, and he gave the audience a quick demonstration of building a Ruby on Rails project from scratch:

metro_toronto_dot_net_ug_2

Bringing in a Rails guy to speak in front of a .NET crowd was a little unexpected, but I thought it was important to show them the inspiration behind ASP.NET MVC, whose creators acknowledge Ruby on Rails’ influence on their framework. I think that they benefited from this outside perspective, and it worked on Paul as well – he was impressed by the size of the crowd, the nice settings (the Metro Toronto .NET User Group has a nice arrangement to use the conference rooms at the Manulife office building), the extent and organization of all the .NET user groups in the Toronto area and even the male-female ratio (while the women were still vastly outnumbered by the men, the percentage of women at the User Group was still high in comparison to some open source gatherings).

Much of my presentation was a walk-through of building the basic structure of the NerdDinner application featured in the book Professional ASP.NET MVC 1.0 and online at NerdDinner.com, with plenty of additional commentary by me, explaining in further detail why things were done a certain way. I encouraged the audience to download the free chapter from the book and actually build the application themselves; after all, the best way to learn is to do.

I had a wonderful time presenting in front of the very attentive and appreciative crowd at the Metro Toronto .NET User Group and would like to thank the audience for watching, Paul for helping out and the organizers for inviting me. I’d love to do it again sometime!

As for ASP.NET MVC, watch this space for more articles and code examples!

{ 0 comments }

The Best “Chapter One” I’ve Ever Read

by Joey deVilla on June 15, 2009

This article also appears in Canadian Developer Connection.

Cover of "Professional ASP.NET MVC 1.0"

As a rule, Chapter One of most programming books seems to leave me with a vague, unsatisfied feeling. I usually finish them with either:

  • A “Hello World”-style application that provides an initial “It compiled!” rush, but little else, or
  • A “Trees dies for this?” sort of indignation, if the chapter is one of those perfunctory one with a name like “Getting Started” that provides the same information you gathered while deciding whether to buy the book.

Based on these experiences, I think I can be excused for being a bit skeptical when I read the announcement that Chapter One of Professional ASP.NET MVC 1.0, published by Wrox, was being made available for free download. Of course they’re giving it away for free, I thought, it’s the chapter that’s worth nothing!

A quick aside: If you haven’t heard of ASP.NET MVC, it’s Microsoft’s answer to the MVC-based frameworks that are all the rage these days, such as Ruby on Rails and Django. It’s not a replacement for ASP.NET, but an alternative; if you want to build applications following the REST paradigm, with fine-grained control over the flow of your application and HTML and want to do things “the web way” as opposed to a more “desktop app” way, you should seriously consider trying it out. (For more detailed pros-and-cons considerations of ASP.NET versus ASP.NET MVC, see this article in Nick Berardi’s Code Journal.)

Luckily, curiosity got the better of me and I downloaded the chapter. I got my first sign that wasn’t your garden-variety Chapter One when I looked at the file size and page count. 14 megabytes? 196 pages? Something strange was going on here. Perhaps a glitch during the download?

Once I scrolled past the cover page, the standard Wrox cover featuring the authors and their impressively receding hairlines (hence the nickname for the book, “The Gang of Foreheads”), I hit the introductory paragraph:

The best way to learn a new framework is to build something with it. This first chapter walks through how to build a small, but complete, application using ASP.NET MVC, and introduces some of the core concepts behind it.

That’s right: rather than provide some long-winded perfunctory history of the Model-View-Controller framework, the backstory of how the ASP.NET MVC framework came to be or some simple “Hello World”-style example app of little consequence and requiring less effort, the authors decided to get right down to business and show you how to build an ASP.NET MVC web app. This was a surprise – but a very welcome one!

NerdDinner screenshot

The application that you build is called “NerdDinner”, a site that lets techies declare Meetup.com-style gatherings and RSVP for them (you can see the finished product in action at NerdDinner.com). You start at ground zero,  “File –> New…”, and from there, you build the app with just enough asides to explain a few vital concepts and very few of those false detours that some tutorials lead you down. NerdDinner may be a simple app, but it covers a lot of ground:

  • From the basics of CRUD application design in an MVC web framework
  • to matters of input validation,
  • to registering, authenticating  and authorizing users
  • to integrating Ajax-enabled forms and an Ajax map
  • to the built-in unit testing features of ASP.NET MVC.

By the end of the chapter, you’ve got a nice little application that lies in the “sweet spot”. It’s small enough for you to be able to learn from quickly, yet big enough to show you the ropes behind building the important parts of a CRUD web application that’s ready for public consumption.

download_chapter_1I’ve tried out a number of ASP.NET MVC tutorials, and this one’s my hands-down favourite. It’s written by the people behind ASP.NET MVC, it covers a lot of ground, the finished app is an excellent basis for your future projects, there’s a working version online that you can use as a guide and  the code works! Even better, this single chapter that packs all this value is free-as-in-beer. I’m sure I’ve paid  for whole books that have imparted less knowledge than this single free chapter.

If you’re interested in learning about ASP.NET MVC, download Chapter 1 of Professional ASP.NET MVC 1.0 [13.8 MB PDF] and give it a try. It’s the fastest way to get both a working ASP.NET application and up to speed on Microsoft’s new web application framework. And be sure to tell me how it worked out — if you have any questions or comments, or run into any difficulty with the chapter, let me know – drop me a line via email, send me a tweet or give me a shout-out in the comments.

{ 1 comment }

“Canada’s Next Top Model View Controller” Presentation at Metro Toronto .NET User Group Next Thursday

May 21, 2009

This article also appears in Canadian Developer Connection.

If you’re going to be in the area of downtown Toronto next Thursday, May 28th, you might want to check out my presentation, Canada’s Next Top Model View Controller at the next Metro Toronto .NET User Group meeting. I’ll be talking about the ASP.NET MVC Framework, Microsoft’s answer [...]

Read the full article →

Tech Books I’m Reading Right Now

April 21, 2009

This article also appears in Canadian Developer Connection.
I’m reading a couple of tech books right now, and I plan to publish more in-depth reviews of them in the next couple of weeks. In the meantime, I thought I’d give you some quick reviews to give you a taste.
Pro ASP.NET MVC Framework by Steve Sanderson (Apress)
The [...]

Read the full article →