Monthly Archives: July 2008

ASP.NET MVC Reusability Revisited

A few weeks ago, I wrote a post about the lack of a mechanism to seperate a unit of both logic and presentation (like a UserControl in WebForms) in ASP.NET MVC.� Well, it turns out that Rob Conery had actually come up with something called a ComponentController that took care of that, and used it in his MVC Storefront application.� (Note to self: need to catch up on those videos he’s making.)�

It actually took the removal of that feature in Preview 4 to alert me that it existed.� Not to fear, though, it’s been replaced by something called RenderAction, which will allow you to call a regular old controller action from a view like so:

<% Html.RenderAction(x=>x.MyControllerAction()) %>

Isn’t that awesome?  I sure think so.  Be warned, though, this particular feature may be even more likely to be changed than the rest of the MVC framework.  It’s part of a separate assembly called Microsoft.Web.Mvc.dll.  Stuff in there won’t be in the initial RTM, but in a future release of the framework.

Phil Haack has some reservations about this violating the purity of the MVC pattern, so I think the likelihood that this will change is close to 100%.  They’re working on some other ideas, though, so hopefully the MVC team will come up with some magic that better adheres to a mindset of separation of concerns.

For the moment, though, I’m happy!  :-)

How I Got Started in Programming

I haven’t really been tagged, per se, but enough of my blogroll has participated in this meme, so I thought I’d weigh in.

How old were you when you started programming?

I was about 10, I think. Read on for the details…

How did you get started in programming?

A year or two after my dad bought us an Apple IIgs, I pulled out the BASIC book that came with the computer.  As many people did, I just started typing in the programs listed in the book.  Not everything worked on the first try, I would usually make a typo or two as I transcribed the code.  When I got to the checkbook balancing program, I tried for days to get it to work correctly, but failed.  I got so frustrated that I just put the book down and never picked it up again.  It turns out that I wouldn’t program again until I got to college.  The enjoyment I got out of the programs that I did get to work stayed with me, though.  Enough that I knew by the time I graduated from high school that I wanted to major in computer science.

What was your first language?

This seems to be just about the same for every person who answers this question:  some flavor of BASIC.� I have to say though, I think C++ (the first language I coded in at college) had more influence on the way I think about programming.  Maybe that’s why I chafed at having to use VB at my previous workplace;  C# just seems more natural.  I need them curly braces!  :-)

What was the first real program that you wrote?

I’m not exactly sure what “real” means in this case.  I’ll take it to mean, “having some actual value outside of academic exercise,” in which case the first one would have to be my senior capstone project, Shticks.  At Harding, every semester the participating seniors are split into teams and given a board game to turn into a computer game.  Our semester, it was a game called Creeper, published by Out of the Box Games.  (You may know them as the publisher of Apples to Apples.)  We used a Flash control hosted in a C# WinForm.  The game engine, AI, networking, etc. were coded in C#, and the animations and presentation logic in ActionScript.  (Yeah, I know, yikes.)

What languages have you used since you started programming?

I feel I need to distinguish languages I only used in college from language’s I’ve used in real-world projects.� In college only: C++, Perl, Java, x86 Assembly.  Real-world: C#, VB.NET, JavaScript, COBOL, VBScript, PHP, and currently learning Ruby to help out my church with a Rails-based church management system.

What was your first professional programming gig?

I got my first programming job right out of college, at a company called Data-Tronics, the in-house IT shop for Arkansas Best Freight.  I did lots of mainframe COBOL, quite a bit of classic ASP, and some VB.NET, all related to the transportation industry.  I worked there until about two months ago, with some of the nicest people I’ve ever met.

If you knew what you know now, would you have started programming?

Absolutely!  I think that I wouldn’t have taken the break between 10 and 18.  I also wouldn’t have waited as long to really tune in to the programming community, which I only did about a year and a half ago.  Before that it was just kind of a job.� One that I enjoyed, more or less, but not one that I was truly passionate about.  I have to credit Dot Net Rocks, Hanselminutes, and Jeff Atwood of codinghorror.com for being my gateway drugs, showing me that building software was something that I truly could be passionate about.

If there was one thing you learned along the way that you would tell new developers, what would it be?

Plug in to the community.  Read blogs, listen to podcasts, go to user group meetings, start your own blog.  You can get so much more out of software development than just a paycheck if you’re willing to put in just a small bit of extra effort.

What’s the most fun you’ve ever had… programming?

I have to say, making that game in college was a blast.  It was my first taste of building something of substantial size and something that other people could (theoretically) use.  Plus, making games is just fun anyway.  :-)

Tag, you’re it!

I’ve enjoyed hearing other people’s stories, so I think I ought to keep this going.  I’m going to call out:

Shreveport .NET User Group

Most of the people who read my blog know this already, but I’m in the process of starting up a .NET user group in the Shreveport/Bossier City area.  The group in Fort Smith got started just a couple months before I left, but it was something that I really enjoyed and felt had real value for developers interested in improving their craft.  When I got to Louisiana, I was surprised to find out that a city the size of Shreveport didn’t have a user group already, so I thought it was about time we did.

I got some great advice from Michael Paladino, the leader of the group in Fort Smith about sponsorships, delegating leadership, and related organizational matters.  Getting swag was actually a lot easier than I expected it to be.  Every single vendor I contacted offered to give us something. One of the first component vendors I contacted, Telerik, offered to give us a license to their CMS package Sitefinity, as well as free hosting through a pertnership with DiscountASP.net.  You can find the site at www.shreveportdnug.org.  It’s kind of bare-bones right now, I apologize.  It’ll fill out as we nail more things down logistics-wise.

The hardest part, which I still haven’t figured out yet, is finding free space to meet.  Most of the businesses that employ .NET developers in the Shreveport area rent office space from the large buildings downtown, so parking and difficult after-hours access make those a no-go.  I tried a couple of local universities, but the facilities they could provide would only hold arond 30 people max.  Not exactly a limitation I’m confortable with.  We’ve got one more school to try, but I have a bit of an inside track there because the son of the university president works for my current employer.  That means that I’m not the one in charge of calling the appropriate people, but I’m not sure it’s a very big priority for the son.  I need to ping him about it again on Monday.  There’s one facility at one of the schools that sounds perfect, but it’s $120 per use of the room, and I’d like to keep the amount we have to get from sponsors to a minimum.  If anyone else has some suggestions about where to look for space, please leave a comment!

I’ll continue to post about this as we get closer to holding our first meeting.  Wish us luck!