Scott Hanselman

The Five Second Rule - Does it Apply Internationally?

October 15, '07 Comments [141] Posted in Musings
Sponsored By

SkittlesFiveSecondRule There's a good article in the Washington Post from July that was on a repeat on the Radio this morning about the Five Second Rule. There's even some research on it and a WikiWorld comic.

"The five-second rule. If you've never heard of it, ask any sixth-grader. "It means that if you drop something on the ground, you can still eat it if you pick it up in five seconds," says Kiara Hopkins, 11."

I'm not sure when this started, but I've always known this. I think my two-year-old knows this, although it may be the five-day-rule for him. 

"It's not just for children: In a 2003 survey conducted at the University of Illinois, 70 percent of women and 56 percent of men had knowledge of the rule."

I'm shocked it's not 100%. There's also the interesting "Line of Sight Corollary to the Five Second Rule" which allows you to extend the Five Second Rule as long as you held the dropped object in your line of sight the entire time. "Who knows what could have happened while I wasn't looking?"

Additionally, things like M&Ms and Skittles candies have a hard-shell or 'armor' that allow for an more liberal interpretation of the Rule. Wet things, on the other hand, like cake or fruit, might only be allowed two seconds, or none at all.

Because I have a fairly international (non-US) bunch of readers here, I'd like to ask you:

  • Dear International Reader, is the Five Second Rule a global (read: all humans) phenomenon? Does it cross cultures?
  • More interestingly, what do you call it in your native language?

Discuss.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Catching RedBits differences in .NET 2.0 and .NET 2.0SP1

October 15, '07 Comments [6] Posted in ASP.NET | Learning .NET | Microsoft | Programming
Sponsored By

When you install .NET 3.5 on your system, while the .NET CLR is the same and runs the same, there's some additional Properties and Methods that were added to the Base Class Libraries in order to make some 3.5 features like LINQ work as well as fix a few customer issues.

Daniel Moth has a very nice diagram explaining what "RedBits" and "GreenBits" mean.

"When we say red bits, those are Framework bits that exist in RTM today i.e. NetFx v2.0 and NetFx v3.0...When we say green bits, we mean brand new assemblies with brand new types in them. These are simply adding to the .NET Framework (not changing or removing) just like Fx 3.0 was simply adding to v2.0 without changing existing assemblies and without changing the CLR engine."

Krzysztof has a blog post about these new (kinda obscure) APIs and fortunately a nice FxCop Rule you can drop into your C:\Program Files\Microsoft Visual Studio 9.0\Team Tools\Static Analysis Tools\FxCop\Rules folder and you'll get a nice warning if you bump into one of these APIs. To be clear, they are not something you'll bump into in your regular life, but it's possible. Dan Moseley blogged about this from the MSBUILD point of view.

The situation you might get into would be that you'd develop on a Visual Studoi 2008 system with .NET 3.5 and targeted .NE T Framework 2.0 (but you have 2.0 SP1 with these new 2.0 methods), then you deploy to an older system that has only .NET 2.0 RTM (not Service Pack'ed). At this point you might get a MethodMissingException because that older system might not have the new method or property. Of course, you could just install the latest 2.0, but if you don't want to, then don't use the new methods/types/properties. Hence the optional FxCop Rule.

1473897382_374fc28d10_o

Krzysztof send me a text file with the list of new Properties and Methods and I wrote a little program to generate an HTML file that shows the additions (many are new overloads) and links them to MSDN help. I couldn't get to the exact method overloads so do make sure the parameters line up when you're reading the help.

http://www.hanselman.com/blog/content/binary/RedBitsChangesv2.html

NOTE: This is a different list from the original diff I did between 3.5 and 2.0. The original list was the differences between all of 2.0 and 3.5 and this list is JUST the BCL. Just the core.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

If your method can't do what it's name promises it can, throw

October 15, '07 Comments [19] Posted in ASP.NET | Learning .NET | Microsoft | Programming
Sponsored By

Patrick Cauldwell has a good list of Programming Guiding Principles he calls This I Believe: The Developer Edition. I've blogged about them before.

I got an email today that went something like this:

I have an interface called IStorageConnection and one of its methods is Save(...). The storage connection object available to user is configured through configuration files. The storage could be either the FileSystem or the Database. In that case, how is the consumer of the IstorageConnection interface going to know that exceptions to expect? If using the FileSystem, you can expect an IOException. If using the Database, you can expect a SQLException. Given this case, how can the customer get away from handling the base Exception and only handle specific exceptions. Also, keep in mind that other storage connections objects can be deployed and plugged into the system in the future.

This reminded me of a favorite rule of Patrick's that use a lot as well.

Simply stated, we say "If your method can't do what it's name promises it can, throw."

If your method is called "Save" and it can't Save, then throw. If it's called DoSomething and it can't DoSomething, throw. The idea is that the method name is a verb and a contract. It's promising to do its best and if it can't do it, it's very likely exceptional.

In this gentleman's example, I figure if you've got a pluggable storage interface underneath, I'd suggest creating a generic "StorageException," and put the actual exception in the InnerException property. However, the point is that it didn't work. Whether the consumer of the Exception cares more than that is a secondary issue.

What are your rules for when to throw and Exception? And please, don't say Exceptions are evil and that HResults should rule the day. Surely the Great .NET Exception Panic of 2001 is over, right? ;)

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Retrospective: Halo 3 Fights Diabetes

October 13, '07 Comments [4] Posted in Diabetes | Gaming
Sponsored By

It was epic. Truly epic. Thfe stuff you tell, if not your grandchildren, your middle-aged nerdy neighbor about. We had a great time at Cinetopia and raised a lot of money for the American Diabetes Association.

You can make a tax-deductible donation today!

Big Thanks to Everyone involved:

  • Jason Mauer and Microsoft Portland for the Xboxes, the Halo 3 games, organization, logistics and his tireless work and two 42" plasmas.
  • Rich Claussen for all things business, negotiations, and convincing Cinetopia we had a good idea.
  • Greg Hughes for his press-contacting expertise and for spreading the word in creative ways in the Oregonian, the Willamette Week and on KXL radio.
  • The SAO for their sponsorship and for all their help the evening of the event!
  • John Poore, Michael Willits, Jennifer Bernstein and everyone at Robert Half Technology for their sponsorship and their commitment to the community!
  • Wendy Fatz and Rodger DeGeorge from CompView for believing in the dream and loaning us two projectors.
  • Lee Williamson and PADNUG for the Food and Drinks!
  • Aivea for their sponsorship and generous donation!
  • Rudyard and the team at Cinetopia, a locally-owned rockin' sweet luxury theatre, for shutting down 2 of their 8 Super-HD screens!

And lastly, to everyone who donated and everyone who was powned or dispensed pownage all evening long!

CIMG7547 CIMG7542 

CIMG7523 CIMG7519 

CIMG7518 CIMG7517

CIMG7516 CIMG7511

Let's do it again soon!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 84 - Concurency Programming with .NET Parallel Framework Extensions

October 12, '07 Comments [4] Posted in ASP.NET | LINQ | Microsoft | Podcast | Programming
Sponsored By

image My eighty-fourth podcast is up. Scott chats on the Microsoft campus with Stephen Toub, a Microsoft Developer working on a team coming up with new ways to make concurrency programming easier with .NET. We get pretty deep and pretty philosophical about concurrency, threading, and parallelism. Also check out an older Channel 9 Video (just released) on the topic as well.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

If you have trouble downloading, or your download is slow, do try the torrent with µtorrent or another BitTorrent Downloader.

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.