Thursday, February 10, 2005

The VB Group began with a quick demo of the Erl() function, showing the group how line numbers and Erl() can simplify debugging inside of VB code.

Following this quick intro demo, we had some announcements:

Feb 17th – MSDN Event
Feb 21st – SQL Server UG and Mobility UG
May 14th – Atlanta Code Camp

First up at the presentation podium was Dan Bredy who showed us how VB.Net implements regular expressions.  Dan’s main focus for regular expressions was pattern matching on large blocks of text.  The group looked at the RegEx class, captures, matches, and groups.  Dan actually frequently uses regular expressions to turn text files from Project Gutenbueg into HTML documents which can be read by IE or compiled into the Microsoft Reader .lit format.  Other common uses for regular expressions inside of .Net projects include input validation on web forms (making sure phone numbers and e-mail addresses look correct) and URI path validation.  Check out the site www.regular-expressions.info for tutorials (language agnostic) and www.regexlib.com for samples and the Regulator – a tool for testing and researching regular expressions.  Regular expressions are a specialised language unto themselves and are extremely powerful when used correctly.

The next presentation was Richard Greene who demonstrated the difference between passing arguments into functions by value and by reference (article in C#).  While in general an easy to understand difference, we showed that passing objects by value didn’t necessarily protect the contents of that object.  That’s because objects are reference types – you don’t pass copies of the object.  Instead you are passing references, or pointers, to the object.  This means that and changes to that reference type object occur in the same memory space as the original object and the “copy” of the object outside of the function changes too.  We also briefly glanced at the topic of deep vs shallow copy, where a deep copy of an object makes a reference type behave like a value type.  The example of this was the String class.  The overridden assignment operators of the String class allow you to pass the object (which is by definition a reference type) to functions which define parameters as ByVal.  In this case, the String object behaves as if it were a value type.  The discussion here didn’t really cover boxing and unboxing or memory management and garbage collection – the logical next steps in any discussion of the treatment of value and reference types.  Maybe a future presentation will bring more in depth understanding to the group.  Understanding what happens under the covers and how your variables behave is essential to your development as a software engineer.

— Matt Ranlett

PS – up next time are discussions on COM Interop, the System.Web.Mail namespace, and the System.IO namespace.  Show up and learn something!

2/10/2005 10:40:02 AM (Eastern Standard Time, UTC-05:00)  #    Trackback
Tracked by:
"formula one diet pill" (formula one diet pill) [Trackback]