Tuesday, March 18, 2008

Speaking at North Houston .NET User Group

Sorry for the late notice on this one (it sort of snuck up on me!)  I’ll be speaking at the North Houston .NET User Group (yes I said North, it’s new).  The talk is scheduled for Thursday, March 20th @ 6:30PM.  The meeting will be held at Montgomery College in The Woodlands.

I will talk about adopting agile development… the what, why, and how.  Hopefully it will be more of an interactive discussion, as there the audience can usually relate to the pain points that I talk about with traditional waterfall development.

For more details, check out their website.

Thursday, January 17, 2008

The Texas Tour of ASP.NET MVC Comes to a Close

It’s been an exciting two weeks.  I visited user groups in San Antonio, Houston, Austin, and Fort Worth, and I got to meet and connect with a lot of interested developers about the new ASP.NET MVC framework.

Two of the events were recorded, so if I ever get my hands on the recorded bits, I’ll post them here in an easily watchable format.  (Don’t hold your breath though.)

My presentation had a minimal amount of PowerPoint.  I decided to focus on real code.  And people have thanked me for it! 

I covered:

  • Basics of MVC
  • Default Routes
  • Simple Controller / Action
  • Passing data to the views
  • passing strongly typed view data
  • Custom Routes
  • new/edit form for an entity
  • writing tests for controllers
  • rhino mocks for mocking out dependencies
  • dependency injection for controllers (using Windsor)
  • ajax integration with prototype

This is a lot to tackle in my 1/1.5 hour time slot.  And I do get a lot of blank stares when I talk about mock objects and dependency injection, but I think more presentations need to present realistic code, rather than simple examples.  The feedback I’ve gotten about this has been overwhelmingly positive, and I’m really glad people liked it.

Some questions that were asked during my tour…

“Ben, you are phenominally good-looking?  Are you available?”
umm no, I’m married (and now terrified)

What is that cool zoomey tool you used?  That’s awesome!”
that is called ZoomIt, by sysinternals.

What are you using for data access on your entities?”
It’s called Castle ActiveRecord, which uses NHibernate underneath.

Can I use ASP.NET validators?”
—Well not really.  The validators have viewstate, which won’t work.  Your validation definitely belongs in the Model, so you could just do server-side if you want.  If you want clientside validation, you could accomplish a similar result by using marker css classes and some clever javascript  (think <input type=”text” class=”required” name=”address1” /><span class=”error_message”>This is required</span>

If we use this on IIS6, will performance suffer?”
— Probably.  On IIS 5/6 you have to send all requests through ASP.NET, which can be slower.  I’m not an expert in this area, so definitely do your research before making any rash decisions.  When we have Windows Server 2008 and IIS7, expect vast improvements.

Do you know Justice Gray?”
—Sure do.  I’m a bona-fide potential friend of Justice Gray, and even have the certificate to prove it.  It’s serial number marked 00000000000003.  I carry it with me at all times for just such a question.

Can you use co-exist with webforms?”
—Yes!  If you hit a page with the .aspx extension, the PageHandlerFactory will pick it up and you will be in WebForms Land.  If you instead hit a route, you’ll be in MVC Land.  Learn to know the difference and you’ll be fine.

Isn’t it dangerous to output strings directly like that?”
—Yes it is.  Read my post about html encoding your values.

Your hair is impeccable?  What kind of gel do you use?”
— It’s called Fructis something-or-other… and it’s awesome!

So Microsoft has two methods of developing web applications?  Which should I choose?”
—If you like the rich eventing model and the ability to save state and mimick a smart client ui, then choose web forms.  If you value clean html, urls, separation of concerns, and testability, then choose MVC.  I will be choosing MVC more often than not from here on out.

When will it be released”
—Gawsh, I don’t know?  Fall 2008?  As soon as I know I’ll post it here.

(admittedly, a couple of those questions were not asked — I’ll let you guess which ones)

You can download the code and the presentation here:

File Attachment: save the world with asp.net mvc.zip (1612 KB)

I’d like to thank the user group leaders for having me speak, it was certainly a pleasure.  Where will the next tour be?

Wednesday, January 09, 2008

Be careful outputting strings in ASP.NET MVC

During my presentation at Alamo Coders last night, someon mentioned that it is unsafe to output user-entered strings like this:

<h2><%= college.Name %></h2>

The reason is, of course, that the user could be malicious and enter in a string such as this:

“<script>alert(‘I am evil’);</script>”

And it would evaluated on the page and all of your users would get an alert box.  This is leaving your door wide-open to clever attacks known as Cross Site Scripting and is very dangerous.

Instead, we should escape these strings so that they aren’t rendered as HTML or javascript, but rather textual characters.  That means that < will be translated to &lt; and so on.

To do that, the Html helpers that ship with the framework give you an Encode method, letting you do something like:

<h2><%= Html.Encode(college.Name) %></h2>

But the syntax is a bit cumbersome for every outputted value on a page.  I prefer the way Rails handles it… like this:

<h2><%= h(college.Name) %></h2>

And it turns out that you can add this extension method somewhere and be done with it:

public static string h(this ViewPage page, string input)
{
     return new HtmlHelper(page.ViewContext).Encode(input);
}
And that’s it!  Just remember to take this precaution, or you’ll regret it later.
Sunday, December 30, 2007

ASP.NET MVC Tour of Texas

Want to see what the hype is all about with the new ASP.NET MVC Framework?

I’ll be touring Texas speaking about it.  If you live in Texas, come check out my talk “ASP.NET MVC – Save the Developer, Save the World.”

Here’s the confirmed schedule:

  • January 8th – Alamo Coders (San Antonio)
  • January 10th – HDNUG (Houston)
  • January 14th – ADNUG (Austin)
  • January 15th – FWDNUG (Fort Worth)

We’ll take a look at the new framework, the design goals, and dig into some code.

Hope to see you there!

 

Tuesday, September 25, 2007

Adopting Agile Slides

Agile Houston tonight was a pretty good turn out. There were over 30 people, so it was a good number to get people talking.  If you came, I’d love to hear your feedback in the comments!

I was able to talk to a number of agile folks from Houston and it’s really cool to see this type of enthusiasm at a local level.

You can download the slides here.

(Matt recorded the whole thing, so if I can get the audio bits I’ll post those as well).

Adopting Agile @ Agile Houston Tonight

I’m speaking on Adopting Agile at the Agile Houston meeting tonight.  The meeting will be held at PROS Revenue Management downtown on Main street.  Check out the agile houston website for more details.

Hope to see you there!

Sunday, September 16, 2007

Speaking at AgileHouston Next Week

I am going to be speaking on Adopting Agile to our local Agile Houston user group.  Our last presenter, Robert Martin was excellent, and the speaker following me (who I shall not yet name for fear of jinxing it) is going to be stellar as well.  Maybe if I sandwich myself between great people I can be great by proxy.  We’ll see.

Anyway we’re not yet sure of the venue (might not be at UH this time), so keep an eye out on the agile houston website for details.  The date will either be September 24th or 25th, but I thought I would announce it now to give ample notice to those of you who are in Houston but don’t subscribe to the Agile Houston calendar.

My talk will cover some of the foundational principles that are deemed “agile” and why they are valuable.  We’ll also talk about the best way to go about introducing agile at a solo level, a team level, and a company level.  I’d like it to go off as a sort of dialog to get everyone sharing experiences and opinions.

Come check it out next week!

Wednesday, August 15, 2007

See you at Houston Tech Fest

If you're going to HoustonTechFest, then be sure to check out my presentations:
  • Advanced CSS and Javascript
  • ORM with NHibernate
It's all going down August 25th at the University of Houston.  See you there!

Friday, June 15, 2007

HDNUG Last Night

Last night I gave a talk to the largets crowd I have ever spoken in front of.  There were over 100 people in the room and they were a great audience.  I received lots of devoted attention and people were eager to participate.  I was quite nervous in the beginning, but once I got into the material I think it came across very well.

I spoke about why to use CSS and what we can do to overcome some of the pitfalls.  I also explained why we don’t want to be using tables for layout. 

I moved from there to some javascript techniques and a little bit of ajax.  From what I got from that portion, it could have probably warranted more time, but there was just so much to cover.

The files that I used during the demo are available for download here:

File Attachment: AdvancedCSSAndJavascript.zip (1140 KB)

 

I received a number of questions about the tools I was using during the demo.  The text editor I was using was e.  You can download it at www.e-texteditor.com.  The application launcher that I use is launchy.  It is available at www.launchy.net.  Finally the Keyboard shortcut window, called Key Jedi is available here.

If you attended the presentation, I would love to hear your feedback in the comments.  Thanks for coming!

Update:  The links that I wanted to show (but couldn't) during the presentation are: