# Wednesday, January 30, 2008

In my post looking forward to 2008, I mentioned that I wanted to take more time this year to learn new technologies, particularly outside of the Microsoft communities. With all of the push in .NET towards dynamic languages right now, why not look to some of the dynamic languages that have been out there being used for years?

I know what you're thinking - looks like David here decided to learn Ruby. I mean, that's what everyone is using, right? Ruby and Ruby on Rails? Nahhh, I'm actually learning Python! Probably the key factor for me was the Python Challenge. I follow MoW's Powershell blog and he's started up a series on working through the Python Challenge using Powershell. I had heard about the challenge before, but hadn't really looked into it much, but this was enough to prompt me to get over there and try it out. (I am planning on still learning Ruby, though - I'll just go through the challenges with Ruby later)

I resisted the urge to try to find an IDE for Python and just code it up in a text editor. It has forced me to get more familiar with the syntax as a result. The Python site has a great tutorial for starters as well as some good documentation on the available modules. The hardest part for me is to not write the code like I write C# or VB. For one of the challenges, you have to take a given string, a given mapping, and then translate the string to get the instructions to move to the next challenge. I wrote a basic loop over the characters in the string, converted them to their ordinal values, performed the translation, and then converted them back to characters. It worked, but it wasn't the best way to do it in Python. Python provides this great function called string.maketrans. Also, the map function is amazing. It is sort of like the List<T>.ForEach method except that it reads a lot better (though lambda expressions in C# make it a little better). I'm starting to understand the power behind the whole map/reduce idea that Google is so big on. List comprehensions are really cool, too.

Anyway, so far, I'm to the 5th challenge (with some help from Google, the Python tutorials, and the challenge forums at times) and it is pretty cool. One of the most enlightening things about going through the challenge is that, as you complete one, you can go look at submitted solutions on the wiki. It is a great way to evaluate if you solved the challenge the "right" way or not. It is a great learning experience. One way I'm trying to apply this knowledge is that I'm running the challenges in both CPython (Python that runs on C, the standard I think) and IronPython.

Another thing I've done to try to see how other development communities work is that I've installed Ubuntu 8.04 (the alpha) on my laptop. I'm now dual booting Vista x64 and Ubuntu and it is pretty nice. I have two favorite things about Ubuntu so far - the ridiculous customization that you can do with it (compiz is amazing) and the package manager. Seriously, the fact that you don't have to pull up a browser to download apps and install them is a massive plus over Windows. In fact, you can just run a simple apt-get command if you want. Don't worry, though, I'm not planning on switching from Vista anytime, soon. Ubuntu is great and I'll be keeping it on the laptop, but I still like Vista, too. Right, right, blasphemy, I know. They're both great operating systems as far as I'm concerned. One takes an entire DVD and seems like a resource hog (not as bad anymore) and the other fits on a CD and requires editing conf files, downloading "restricted" drivers, and sitting at the command line to get video and wireless working :-) Seriously, neither are perfect. It has been nice seeing both sides of the fence, though.

posted on Wednesday, January 30, 2008 8:11:42 AM (Central Standard Time, UTC-06:00)  #    Comments [1]
# Thursday, January 24, 2008

In much the same way that Colin welcomed me to the blogosphere a few years back, I now get to welcome Brian Sullivan. Check out his inaugural post and leave a comment.

posted on Thursday, January 24, 2008 12:01:46 PM (Central Standard Time, UTC-06:00)  #    Comments [1]
# Thursday, January 17, 2008

I couldn't find this information anywhere (yet), so I thought I'd share this. If you're already using the _NT_SYMBOL_PATH setting to download symbols from Microsoft and you want to download the symbols and source for the .NET Framework, you can set the environment variable up like so:

Variable name:
_NT_SYMBOL_PATH

Variable value:
srv*c:\symbols*http://referencesource.microsoft.com/symbols*http://msdl.microsoft.com/download/symbols

Replace "c:\symbols" with whatever path you want your symbols to be downloaded to. The key here is that the reference source path exists first. Otherwise, the PDBs will be downloaded with the source information stripped.

The rest of the settings should match what Shawn Burke shared in his post on the reference source release.

Hope this helps.

posted on Thursday, January 17, 2008 9:33:17 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
# Friday, January 11, 2008

I absolutely love trying out different Visual Studio color schemes. I've used John Lam's port of Vibrant for a while as well as some of Tomas Restrapo's VS themes and they're all great. After watching this VIM screencast from the Eleutian guys, I decided to give VIM another try. I'm not able to fly with it yet, but I am picking it up a lot better.

One of the things that I absolutely love about VIM as well as E-TextEditor is how it comes preloaded with some great color schemes. Not only that, but both editors are ridiculously easy to pull down new schemes from the internet. I've never really cared for editing the colors in Visual Studio, but I decided that I had to try to port Wombat over to Visual Studio. It is the theme that Aaron is using in the video and it looks great.

Here is what it looks like in VIM:

gvimwombat

Here is what my port looks like:

vswombat

As you can tell, some of the colors don't exactly match up; however, I think it keeps the overall feel and I like it. Try it out and let me know what you think. If you'd like to make some improvements, make them and then send me a copy!

Download my attempt at a Visual Studio Wombat theme (VS2005).
Download my attempt at a Visual Studio Wombat theme (VS2008).

posted on Friday, January 11, 2008 11:36:35 AM (Central Standard Time, UTC-06:00)  #    Comments [3]
# Tuesday, January 01, 2008

It's hard to believe that it is already 2008... 2007 completely flew by. I spent most of this Christmas holiday telling my family I had seen them just a few months ago when, in fact, I hadn't seen them since... last... Christmas.

So, 2008 in review.

Except for my first couple of years in college (I had never written a program until 'Hello World' in C my freshman year), 2007 has got to be the year of the most growth for me as a developer. I never really grasped unit testing/test driven development (I can't put behavior driven development in this just yet) until this year. Does that make me a master at it? Certainly not - but I do understand the need and the drive behind it now. Along with this gradual understanding of the role of tests/specifications, I have come to better appreciate concepts such as dependency injection, inversion of control and separation of concerns. I understand that they may sound like buzz words, but seriously, these practices can completely change the way you architect systems. I can't believe how far behind I've been and, even more so, how far I have to go.

In my quest to become a better developer, I'd like to share some of the blogs/feeds that I've started subscribing to in 2007 that really have helped me become stronger in my craft. J.P. Boodhoo, Jeremy Miller, Dave Laribee, Oren Eini, the reddit programming feed, and Reginald Braithwaite. Certainly some are missing (lifetime achievement awards to Scott Hanselman and Jeff Atwood anyone?), but I still wanted to share a few. I don't think it is a coincidence that a lot of these are heavily involved with ALT.NET.

Looking forward to 2008.

I'm hoping to gain experience and learning from communities outside of the Microsoft ecosystem (i.e. Ruby, Rails, Python, etc.) if for no other reason than to see what it is like. Honestly, the majority of the practices that ALT.NET is pushing have been and are huge parts of these communities. I'd also like to get more involved with one or more open source projects. Lately, I've found myself pulling more and more repositories down to my machine just to study the code and I'd like to give back.

 

Technorati Tags:
posted on Tuesday, January 01, 2008 7:55:07 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
# Thursday, December 20, 2007

This is probably a big duh for some of you out there, but if you're running the remote debugger that comes packaged with Visual Studio 2008 (you can find it at C:\program files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger) on a remote machine and you try to attach to that remote machine using Visual Studio 2005, you'll get an error. In fact, VS2005 will tell you that it can't find any servers running on the remote machine. All afternoon yesterday, I was trying to figure out how this one users' security was wrong and keeping me from attaching to a remote debugger he was running when, in fact, I just had an older version of Visual Studio trying to talk to a newer remote debugger.

*sigh*

Maybe now I can figure out what the original problem I was trying to debug was in the first place.

posted on Thursday, December 20, 2007 11:26:36 AM (Central Standard Time, UTC-06:00)  #    Comments [3]
# Wednesday, December 19, 2007

This morning, I had my annual eye appointment and I completely forgot that they might dilate my eyes. Of course, my appointment was also scheduled first thing in the morning - essentially before work. Now, I'm sitting in front of my computer and literally everything is completely blurry. I can't read anything on the screen. It doesn't matter if I get close to the screen or far away, it is all blurry.

Enter ZoomIt! I initially heard about this tool from Scott Hanselman. It is another wonderful tool from Sysinternals (i.e. the guys that make Process Explorer, Process Monitor, etc.) so you know it is pure gold. The tool's primary use is to aide in presentations, so that you can easily zoom in to a portion of the screen so that people can see it better.

Today, I'm using it to just help me read the screen at all. I'm basically touch typing and periodically checking what I've written by zooming in to see if everything looks good. It is actually working pretty well, too.

Thankfully, the blurriness isn't lasting too long. As I'm writing this post, it has already cleared up considerably. Still, ZoomIt has come to the rescue for me this morning.

posted on Wednesday, December 19, 2007 9:22:05 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
# Thursday, December 06, 2007

In case you've been under a rock recently, Visual Studio 2008 was released recently which supports a lot of functional capabilities like lambda expressions. I've been playing around with the lambda syntax in both C# and VB.NET recently and the addition to the languages is great. I did run into one thing that is still frustrating me in VB.NET, though.

Check out the below C# snippet:

TryTimes(() =>
{
   Console.WriteLine("hi there.");
   throw new Exception("haha");
   Console.WriteLine("hi there after   .");
}, 5);

This is the prototype for the usage of a function that could try an operation a certain number of times and then fail if the operation didn't succeed after N number of tries. Obviously, the above code sample will fail every time, but the idea could work alright for file I/O if you're unsure if anyone else might have locks on the file.

The above is impossible to do in VB.NET, though, because VB.NET does not support multi-line lambda expressions. The C# supports them by wrapping the expressions in curly braces, essentially making the lambda expression a block. I wanted to emulate the same thing with VB.NET, but after some fruitless web searches, I came across this MSDN forum posting on VB.NET and lambdas which then pointed to Paul Vick's post on the VB 2008 features that are still in.

I've been wanting the equivalent of anonymous delegates in VB for a long time and I thought, with lambda expressions, I might finally get them. We are a lot closer, but they still don't provide quite the benefit that they could have had we gotten multi-line lambda support. I guess those annoying line continuation characters in VB mess this all up. I think if I could change anything about VB, it would be to make those optional.

On the positive side, though, the intellisense support for VB.NET has increased substantially. For that, I am thankful.

posted on Thursday, December 06, 2007 9:56:03 AM (Central Standard Time, UTC-06:00)  #    Comments [0]
# Wednesday, November 14, 2007

I'm close to finishing up some work on one of my first true TDD projects and it has gone great for the most part. It did take a long time to get started though. The hardest part for me was fighting the urge to just open the designer and start dropping controls. Visual Studio really does guide developers towards a designer-centric approach which, after having done this for a few years, is very hard to resist. What I ended up doing was thinking about the problems that this application was going to solve and starting there. Make your tests define the problem area and move outward. The idea is that, if you can't write your tests that show what your code will do, are you even ready to write the code yet?

I was able to get my first few tests out quickly, but then I hit a block where I struggled with the structure I wanted to follow. This turned out to be good because, instead of coding something up that was substandard, I was able to fight through this struggle and come out with a better solution in the end. In doing this, I discovered a great benefit that TDD provides - you can continue coding even if you don't know all of the answers to all of the problems that your application will solve. For example, I'm still not sure what file format I'll be using in my application (or even if I'll use the file system). It really doesn't matter, though, because I was able to set up an interface and mock that dependency out in my tests and continue with the rest of my application. Had I started with the designer, I likely would have sat around until I had hashed out the file format requirements.

Once I got past my initial hang ups, I was able to fly through the rest of the code. What is even better is that I feel a huge amount of confidence in this code - code that still has no UI around it. I haven't felt this good about code quality in, well, ever.

If you're wanting to start with TDD, I'd like to recommend a few resources. First, read more code. If you aren't using it yet, go get TortoiseSVN and pull down some open source code. The Rhino.Commons repository is an excellent source of code (as well as great utilities). I can also recommend Jeremy Miller's StoryTeller code. I don't do anything with FIT tests, but the code is still a great example of WinForms code driven by tests.

Another great resource is screencasts. Watching someone write their tests first helps immensely. Evan Hoff has a great screencast on TDD. It also shows some of the power of ReSharper.

One final thought for this post is something that Bob Martin spoke about in this Channel 9 interview on programming discipline. Bob pointed out that few disciplines are as fragile as programming is. For example, if even one bit is off in your application, it has the potential to crash. One example of a profession that is also fragile is accounting. If one digit is off in the wrong spreadsheet, the CEO of a corporation can get thrown in jail. The way that the accounting profession has solved this is by entering their numbers twice - with credits and debits. If something gets entered wrong, it won't balance. When the sheets balance, there is confidence in the reported numbers. In the same way, TDD and unit tests provide the balance and confidence that applications are doing what they were intended to do.

Technorati tags: ,
posted on Wednesday, November 14, 2007 12:56:48 PM (Central Standard Time, UTC-06:00)  #    Comments [2]
# Tuesday, November 06, 2007

image

I didn't expect to see this in the next version of PowerShell - very cool. It definitely still needs some work, but I like the start. The syntax highlighting for opened script files is nice. I'd like to see some intellisense in there, but it isn't a big deal. If intellisense would slow it down much, I think I'd rather not have it anyway. I think the biggest issues I've got with it so far is the lack of options to customize fonts and colors as well as tab expansion.

I've haven't had a chance to play with anything else, but it seems nice so far.

posted on Tuesday, November 06, 2007 8:40:44 AM (Central Standard Time, UTC-06:00)  #    Comments [0]