Terry Thibodeau's Blog

Welcome to Terry Thibodeau's Blog Sign in | Join | Help

  • Ironic...

    So I'm catching up on my tech book reading last night when I notice a bump on the lower right corner of the page. I turn the page over to find a small moth-like insect squished between the pages.

    That's the first time I've found a bug in a code book! :)

  • How Did I Get Started In Software Development?

    Called out by Sean Feldman. Here we go:

     

    How old were you when you first started in programming?

    Not counting Turtle, I think the first actual program I wrote was a MadLibs story generator in grade 7. I would have been 12 or 13. It's no Pong, but there you go.

     

    How did you get started in programming?

    I took an interest in computers with the very first one I saw in 1981 (grade 1, an Apple computer). From that point, I loved computers and always gravitated to technology in some way. I continued using computers whenever I could for school projects, etc.

    In 1986, I learned of the Commodore 64 and begged my parents to buy one. I was elated when I got it for X-mas that year! I immediately called up my geeky-est friend who also had one to rush over and begin copying every game I could from him. :)  Ahhh, Ghostbusters, Impossible Mission, BC's Quest for Tires....fun times.

    I attempted to program the Commodore by buying magazines that included "programs" you typed in. After countless pages filled with "Peek" this, "Poke" that, I would attempt to run the program that usually consisted of an controlling and asterisk floating through various other ASCII characters for about 3 seconds until the program would inevitably crash. If it wasn't a typo in the magazine's thousands of lines of Peeks and Pokes, it was typos on my part. I wouldn't call this programming, per se, but it was definitely an experience in the complexities of telling a computer what to do and how to do it.

     

    What was your first programming language?

    BASIC

     

    What was the first real program you wrote?

    I'd say it wasn't until the Computer Engineering program at NAIT in 1994 that I wrote anything that actually served any purpose. There were real-time, motor control and monitoring programs written in Assembler for the Motorola 68HC11, temperature sensor monitoring in Assember (again, using the 68HC11), and various others in Assembler and C.

    The first real Windows program was written in the second year at NAIT. It was a paint program written for Windows95 in C. There was no fancy .NET framework to do things for you. This was pure Win32 programming. You were responsible for the messaging loop and catching and handling any WM_PAINT, WM_MOUSEDOWN, WM_DESTROY, etc. messages sent by your window. Man, this was tedious programming. You can't really appreciate where development is now with .NET until you do Win32 API development. :)

     

    What languages have you used since you started programming?

    Assembler, C, C++, Pascal, VB, VB.NET, C#, Web stuff (HTML, javascript, vbscript, etc.)

     

    What was your first professional programming gig?

    When I got out of college (1996), I took a job at a lawfirm in Edmonton adding an extra 2 MB of RAM to the existing 2MB in the all of the firm's 486 SX computers (wow, the raw power was amazing!). During that time, they had just created a Windows 3.1 (yes, 3.1...lawfirms are notoriously slow to adopt new technology) installation to deploy throughout the firm. Sometimes, I had lots of time between waiting for the computers to come off of the floor to get their HUGE, 2MB RAM upgrade, so I started installing the Windows 3.1 configuration (ie. copying the C: drive structure from the network) to the upgraded PCs.

    When I pointed out all of the various configuration improvements that could be made, the manager in the Calgary office took notice and offered me the Network Administrator job (after firing the existing admin). I took the job and, over the next couple years, started creating numerous batch file utilities to change installed application configuration based on network connectivity at boot-up (downtime was common), launch programs in certain ways for various groups, etc.Creating all of these useful utilities made me feel more creative than just configuring computers, networks, and checking checkboxes in various administration applications. It was this that made me realize that I wanted to dive into programming again.

    In 1998, my brother was working at this start-up software company in Calgary (not worth mentioning the name), so I went to visit and see what the environment was like. It was all the glitz and glamour of the relaxed atmosphere complete with Foosball, pool table, Playstation, satellite TV that sealed the deal for me.*

    The first thing that I did there was create a setup/deployment application for installing one of their existing apps. I then moved to helping with the creation of a version control application (shout out to Jason L.) written in C++. This was my first exposure to object-oriented programming and I've been hooked ever since.

     

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

    In general, I think my fascination with technology made it inevitable that I would pursue it professionally on some level.

    However, there are a few things that I always wish I had attempted on a professional level.

    I've always been very musical and have played drums, guitar, bass guitar, and used to sing in a couple of bands (actual, live gigs and everything). Over the past 10 years, I've often wished that I pursued music on a professional level. Knowing then what I know now, I may have decided to be a professional musician.

    I've also recently become obsessed with construction, home renovation, etc. After getting married and having 2 kids (not necessarily in that order), I have found my quality of life priorities shifting where I feel the need to possess tangible skills like construction. I keep thinking about what I would do if / when the world economy crashes and we all switched into survival mode. Would I be able to program a house for my family to live in? :)

     

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

    Technology is so fast-paced that you can get caught up in trying to learn it all. I've found that it is easy to be critical of myself for not being able to keep up with person X or technology Y,Z that is coming out every month. My advice is to forget about what everyone else is doing or what's brand new that company A says you need to be doing and focus on constantly improving the areas that interest you the most.

    Secondly, if you truly want to be in this profession, you shouldn't be content with coasting by in the shadows. The software industry is so young compared to other engineering disciplines and it takes continual innovation and improvement by passionate, vocal individuals to shape its future.

    Failing to improve your skills because the current "senior" (often in time only, not skill) developer's ego doesn't allow for improved ideas is only hurting you. Don't let your innovation and passion be snuffed out by those who are afraid of change.

    Seek out challenge and adventure. That is, unless coasting in the shadows is what makes you happy then, do that. :)

     

    What's the most fun you've ever had programming?

    I think the past 3 or 4 years that I've immersed myself in test-driven development, design patterns, etc have been both the most fun and the most frustrating. It's tough to "unlearn" bad habits, but very rewarding when you persist and see the positive results of your new "good" habits.

     

    Who am I calling out?

    Anyone who wants to share their experience

     

    * Don't let this type of stuff fool you. This company exploited the employees terribly by paying the worst salaries I have seen and guilting them into working overtime, all-nighters, etc. They also had a habit of yelling at clients in meetings. The company is long since extinct. :D

  • ALT.NET Canada Conference - time's running out

    As one of the organizers of the ALT.NET Canada conference, I thought I should probably do the obligatory "Come on out" post.:)

    So, if you haven't heard already, we are holding the first ever ALT.NET Canada Conference in Calgary, Alberta from August 15-17, 2008! Space is limited to the first 100 applicants, so sign up now!

    You can read much more eloquent posts about the conference at the following fellow-organizer blogs:

     See you there!

  • Consolidating and Version-controlling Development Settings

    Those who know me know that I hate repetition. Reducing duplication and improving productivity is usually the driving force behind much that I do with computers (other than my day job of software development).

    After installing Visual Studio 2008 and new versions of Resharper, I realized that I was, once again, going to have to reset all of my preferences. Tired of dealing with this, I set on a mission to formulate a process to consolidate my Visual Studio, Macro, Resharper, and any other add-on settings into a single, convenient, static location so I would never have to re-create my preferences again!

    Using a few free utilities, I was able to come up with a pretty nice solution that works well for me (and, hopefully, you as well).

    Step 1 - Visual Studio Preferences Paths

    To ensure that Visual Studio saves any preference changes to our centralized settings location, we need to change Visual Studio's preferences to point to a nicer location than My Documents (man, I hate the My Documents folder). The spots that you want to change are the "Projects and Solutions" directories and "Import and Export Settings".

    I change locations to a separate partition/drive because I like to keep my operating system partition separate from my data partition. I can then freely re-install my OS without worrying about all of the data that would be overwritten in the process (this is why I don't like the My Documents, My Pictures, etc.)


    You will probably also want to include the new path to your Visual Studio Add-ins folder (in the new, centralized location)

     

    Macro Projects

    The Macro Projects have their own IDE environment whose preferences also need to be set to point to the centralized location. In the Visual Studio IDE, press ALT+F11 to open the Macro IDE. Open the Tools -> Options menu and set the Projects and Solutions locations to the same as the Visual Studio IDE paths.

    I also open up the Macro Explorer (ALT+F8) in the Visual Studio IDE and create a new Macro project. I then set it as the recording project (so my macros are also centralized and versioned). When creating your new Macro Project, ensure that the path is pointing to your centralized DevAppData directory (it should if you've properly set the Macro IDE preferences).

     

    Step 2 - Version Controlled Settings

    Import into SVN

    The next step was to ensure that I could save my settings and revert to previous versions at any time. Enter Subversion / TortoiseSVN. If you're not using Subversion as a version control system for your development, START NOW! It's fantastic. Subversion / TortoiseSVN / VisualSVN makes for zero-friction, rock-solid Visual Studio-integrated version control.

    Now that I've moved my Visual Studio settings to a new folder, I can add them to my Subversion repository using the method I previously blogged about. If you don't already have a Subversion repository, install one easily using the FREE VisualSVNServer download from VisualSVN!

     

    Step 3 - Consolidating Other Settings

    So, you've got your Visual Studio settings moved to a safe-from-reinstall location and imported into Subversion. What about all of the other supporting applications and their settings? 

    Applications usually store their settings in the install directory, the registry (yuck), or the %APPDATA% folder (if not on a network with roaming profiles, this location is usually C:\Documents and Settings\<your username>\Application Data\).

    With all of these applications storing their settings in various locations, how can we manage them all in one convenient location?? (This is the part that I really like. :) )

    Junctions

    There is a feature in the Unix file system, called symbolic links, that allows you to create multiple "pointers" to one location on the file system. It is not very well known that the NTFS file system has had similar features since NTFS v3.0 (Windows 2000, Windows XP, Windows Server 2003, and higher). The feature that we are interested in is a "Directory Junction". I like to think of a junction as a "wormhole" from one directory to another. The great thing about a junction is that a change in the junction directory's contents will show up in the original directory. As far as the OS is concerned, they are directories at different paths, but the contents come from the same location.

    There are many tools to help you create and manage junctions in Windows. The one that I like to use is Hardlink Shell Extension which allows me to manage the junction points with a context menu in Windows Explorer. Using Hardlink Shell Extension, I create "wormholes" to application settings directories from within my consolidated, version-controlled settings directory (I actually have to create the junction in reverse to play well with Subversion but I'll get to that).

     

    Playing nicely with Subversion

    Subversion doesn't like junctions in its structure (you get an error when trying to commit). To combat this, I simply copy the original setting folder that I wish to consolidate into my centralized location. Then, I make a junction from the centralized location back to the application's settings directory.

    Let's use the Visual Studio "Schemas" directory as an example. I like to make a junction to the Schemas folder in my centralized settings folder so I can easily add new .xsd files for intelli-sense, such as NHibernate schemas. Instead of searching through C:\Program Files\Microsoft Visual Studio...bla bla bla, I know I can drop new schemas in my centralized "Schemas" junction and Visual Studio will pick them up.

    1. First, copy the Schemas folder to your centralized settings location. For VS2008, you can find it at "C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas".
    2. Now, rename "C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas" to "C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas.bak" (or delete the Schemas folder. I like to make a backup, just in case).
    3. From your centralized settings folder, pick the newly copied "Schemas" folder as the junction link source

      Import into SVN

    4. Now, drop the junction at the path where Visual Studio expects to find these Schemas ("C:\Program Files\Microsoft Visual Studio 9.0\Xml")

         

     

    By looking at the "Schema" folder's properties, we can see that the junction Target is our centralized settings folder (D:\DevAppData\Studio Settings\Visual Studio 2008\Schemas).

       

     

    Conclusion

    When all is said and done, you should now have a nice, centralized, version-controlled Visual Studio (and associated application) settings location. You should never again have to waste time re-configuring your development environment preferences!!

  • Testing NHibernate object mappings in isolation (Part 2 - dependencies)

    I thought I should post an update to "Testing NHibernate object mappings in isolation" as that post didn't address dependent objects in your mapping files. For a simple mapping to a class with only fields or component object references*, the previous method works fine.

    When you start adding references to other entities in your mapping files, you must also add those mapping file references to the Configuration object. I've refactored the code from the previous post to load the mapping file resource based on the class type. Notice the test, "Should_map_Conference_class", adds its dependencies to the configuration.

    private const string mappingFileAssemblyName = "Namespace.NHibernateMappings";

    private readonly string customConfigPath = Path.Combine(Directory.GetCurrentDirectory(), @"localNHibernate.cfg.xml");

    private Configuration configuration;

     

     

    [SetUp]

    public void TestInitialize()

    {

      configuration = new Configuration()

          .Configure(customConfigPath);

    }

     

    [TearDown]

    public void TearDown()

    {

      this.configuration.BuildSessionFactory().Close();

    }

     

    [Test]

    public void Should_map_Conference_class()

    {

      AddSingleClass(typeof (Address));

      AddSingleClass(typeof (Category));

      AddSingleClass(typeof(Conference));

    }

     

    private Configuration AddSingleClass(Type persistentClassType)

    {

      Assembly assembly = Assembly.Load(mappingFileAssemblyName);

      return this.configuration.AddResource(mappingFileAssemblyName + "." + persistentClassType.Name + ".hbm.xml", assembly);

    }

    If I were using C# 3.0 on this project, I could create an extension method for the NHibernate Configuration class to allow me to do something like:

    configuration.AddSingleClass(typeof (Address), assembly)

                  .AddSingleClass(typeof(Category), assembly)

                  .AddSingleClass(typeof(Conference), assembly);

     

    * - A component is a contained object that is persisted as a value type, not an entity. See Component Mapping in the NHibernate documentation.

More Posts Next page »
Powered by Community Server (Personal Edition), by Telligent Systems