Kevin Trethewey

Software Developer, Technologist, Connoisseur of things that go 'bing'.

  • Home
  • Contact
  • Links
  • About

In the beginning there was the object...

Published Wednesday, April 12, 2006 5:11 PM

Generics:  A  Bedtime  Story

In  the  beginning  there  was  the  object,  and  it  was  given  unto  the  Programmers  that  they  might  have  dominion  over  the  Code.  The  Programmers  loved  and  nurtured  the  object,  putting  it  to  good  use,  and  they  created  many,  many  objects.  But  the  objects  had  no  way  of  being  collected  together  and  the  Programmers  had  difficulty  finding  effective  ways  to  use  all  the  objects  that  they  had  accumulated.  Seeing  the  tribulations  of  the  Programmers  and  his  creations,  our  Lord  in  Redmond,  Anders  be  his  name,  created  System.Collections,  and  all  the  objects  happily  gathered  together  in  groups.  The  Programmers  discovered  they  could  iterate  over  the  collections  and  enumerate  through  the  objects,  and  they  were  pleased.  But  as  time  wore  on  the  Programmers  found  the  objects  restrictive  and  derived  new  objects  from  them,  and  soon  countless  new  types  of  objects  had  evolved  that  could  do  all  manner  of  wondrous  things.  The  Programmers  found  that  certain  types  of  objects  only  gambolled  happily  in  the  Runtime  when  gathered  together  with  their  own  kind,  for  only  in  this  way  could  they  be  useful.  They  also  discovered  that  when  an  object  of  the  wrong  type  accidentally  found  its  way  into  a  collection  it  didn’t  belong  in,  the  Runtime  would  choke  and  die  the  Death  Of  A  Thousand  Exceptions.  The  Programmers  wailed  and  pulled  their  hair  and  gnashed  their  teeth.  They  were  forced  to  derive  new  strongly typed  collections  from  the  CollectionBase  for  each  new  object  they  created  in  order  to  maintain  order  in  the  Code,  and  from  this  arose  the  evil  of  Carpal  Tunnel  Syndrome.  Some  Programmers  created  collections  which  enforced  order  through  the  dark  sorcery  of  Reflection,  but  this  made  the  Runtime  constipated  and  slow  and  hungry  for  the  Sacred  RAM,  which  raised  the  ire  of  the  Users  who  coveted  the  RAM.  The  Great  Anders  took  pity  on  the  Programmers  when  he  saw  their  despair  and  gave  unto  them  the  gift  of  Generics  to  enforce  type  safety  without  bringing  a  pox  upon  the  Runtime.  The  Programmers  and  the  Users  were  happy  and  the  Code  was  fast  and  clean  and  glorious  to  look  upon.  Anders  looked  down  upon  his  work  and  saw  that  it  was  good.


That was the introduction to a presentation that a good friend and colleague of mine* penned for his talk on C# generics. He thinks it is “lame”, I strongly disagree.

* He drops gems like this on a regular basis, if someone out there has connections with a publisher they should get in contact with him – the results would be a best seller!

Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!
by Kevin Trethewey
Filed under: Fun Stuff, .NET, Useful Advice

Comments

No Comments

Go

Tags

  • .NET
  • Admin
  • ALT.NET
  • Community
  • Dotnet.org.za
  • eBooks
  • Fonts
  • Free Stuff
  • Fun Stuff
  • Google
  • Links
  • Microsoft
  • Personal OffTopic
  • Quotes
  • Red Five Labs
  • Robotics
  • Software Development
  • South Africa
  • SQL
  • Useful Advice
  • Utilities
  • Video
  • Virtual Post-It
  • Vista
  • VSTS Tips
  • WebDev
  • Wiki

Navigation

  • Home
  • Careers
  • Downloads
  • Support

Archives

  • May 2008 (1)
  • October 2007 (1)
  • July 2007 (1)
  • June 2007 (2)
  • May 2007 (1)
  • February 2007 (2)
  • January 2007 (2)
  • December 2006 (3)
  • November 2006 (9)
  • October 2006 (10)
  • September 2006 (3)
  • August 2006 (2)
  • July 2006 (6)
  • June 2006 (7)
  • May 2006 (9)
  • April 2006 (4)
  • March 2006 (14)
  • February 2006 (2)
  • January 2006 (5)
  • December 2005 (5)
  • November 2005 (7)
  • October 2005 (4)
  • September 2005 (10)
  • August 2005 (3)
  • July 2005 (5)
  • June 2005 (8)
  • May 2005 (11)
  • April 2005 (10)
  • March 2005 (7)
  • February 2005 (11)
  • January 2005 (12)
  • December 2004 (5)
  • November 2004 (2)
  • October 2004 (3)
  • September 2004 (10)
  • August 2004 (13)
  • July 2004 (6)
  • June 2004 (7)
  • May 2004 (24)
  • April 2004 (20)
  • March 2004 (21)
  • February 2004 (19)

Syndication

  • RSS
  • Atom
  • Comments RSS
Powered by Community Server (Commercial Edition), by Telligent Systems