Month: November 2008

More on builds

Posted by on November 25, 2008

 

Here I am updating a build script and finding myself thinking about this mornings post a LOT. If a tool like ClipX can greatly increase my productivity simply because of how much multiple copy/pasting I have to do just to use a templated assemblyinfo.cs file, then something is not right.

NAnt completely removes the Don’t from Don’t Repeat Yourself, unless you want to lose readability like I stated this morning.

Oh, and ClipX really is a great tool. I especially love the sticky plugin, as I really hate typing email addresses and don’t use my browser’s password manager/autoforms. Quick ctrl-shift-v then a and I have my entire massive email address put in.

Building’s the Foundation

Posted by on November 25, 2008

 

Let me get this off my chest. I think about Build Scripts all the time. I spent the better part of the first 6 months at my current job migrating old legacy .Net 1.1 web apps from  CVS to .Net 2.0 and Subversion. Part of that included migrating the projects from CVS to SVN, then taking the old projects and migrating those into our current directory structure for projects. After that, I had to template the config files and create build scripts that could build a local, test or production version of an app with a single command.

During the course of this, I used PowerShell, Ruby and of course, NAnt.

I found that, like many things, I was able to find some things I loved about all of them. And lots of things I hated about most of them. PowerShell, for one, has some great ideas in it. It’s truly a good idea. I love the idea of being able to leverage the .Net Framework from my scripts. It really is a good idea. But after the few scripts that I wrote in PowerShell, I don’t think that I could use it again. I found the syntax either annoying or clunky the whole time. Especially once I started writing the scripts in Ruby.

Now Ruby I have some experience in as I’ve done a bit of Rails development. Lots of the notations I like. I have some difficulty in using a dynamic language at times, most notably I find myself missing method signatures that are strongly typed. However, the annoyances are small, and mostly come in the form of me running into issues with working with the file system. I think those annoyances mostly come from me not fully understanding some of the intricacies of working with the filesystem on windows with ruby.

I find the biggest difference between the two is how easy it is to use Ruby from within a CygWin Bash shell. I’ve been a longtime linux user, and actually my first unix-like operating system that I used at home was FreeBSD. Because of FreeBSD, I was a long time user of tcsh. In fact, it was less than a year ago that I finally made the move over to bash. Either way, both of these shells provide power, ease of use and so many advantages that I can’t believe that Microsoft doesn’t have them in any of it’s shells. I mean seriously, how does anyone live without a searchable history in a command prompt?

And this brings us to NAnt. I was in love with NAnt when I first started. It was great to use, simple and it could do so much. But I started to find myself hitting situations where things would become very murky and difficult to keep track of where things were happening, especially when I tried to make things generic so they could be called in many places. For example, here is how a template file is expanded in our code:

   1: <target name="expand.template.file">
   2:     <copy file="${template.file}.template" tofile="${template.file}" overwrite="true">
   3:         <filterchain>
   4:             <replacetokens>
   5:                 ....lots of tokens...
   6:             </replacetokens>
   7:         </filterchain>
   8:     </copy>
   9: </target>

 

But where does ${template.file} get set? Why, the line before we call expand.template.file of course!

   1: <property name="template.file" value="${some.dir}\app.config"/>
   2: <call target="expand.template.file" />

 

I just find that this can be confusing, especially to newcomers who don’t know which targets act as functions. I know that you could do a search through the code and find it, but it’s just not as clean or explicit as something like:

   1: expandTemplate(filename)
   2:  
   3: def expandTemplate(filename)
   4:     ...expand in here...
   5: end

 

So I think that you can see where I’m going with this. After a while of doing this, I started to think a lot about Rake. After all, I had used it in Rails projects previously. As you can tell, I’m quite a fan of Ruby. After a while, things began to cool off. I had gotten almost all of our projects converted and I wasn’t writing build files as much anymore. But I kept on thinking about it. Recently, I’ve been writing build files again. I’ve also been reading that I’m not the only person who feels this way.

I’ve noticed a few projects that seem to be reaching for what I want. There’s Boo Build System (and yes, it is shortened to BooBS. Nice work Ayende), PSake (which JP seems to have picked up) and then there’s Rake. Rake seems to be the only one that isn’t geared towards some sort of .Net problem (not that it can’t). It turns out that though there was a lot of hype around boo a while back, I just don’t think it’s something I’m up for learning just yet. And as for PSake, I downloaded the source and nothing against James (it’s not his fault, it’s the syntax!) I barely made it through the first PS1 file before my head hurt and I remembered why I stopped writing PowerShell scripts in the first place.

That leaves me with Rake. And it seems like I’m not the only one. The only difference is that I would absolutely love to see a Gem built with some custom .Net tasks for rake. This is something that I’ve been seriously contemplating putting some time into, but haven’t fully explored yet. Most notably, I would like to take the syntax of:

   1: require 'lib/nunittask'
   2:  
   3: Rake::NUnit.new do |nunit|
   4:   nunit.library = "foo.dll"
   5: end

 

And replace it with something along the lines of:

   1: require 'lib/nunittask'
   2:  
   3: nunit :test, :library => 'foo.dll', :depends => [:load_properties, :compile]

 

I get the feeling that this could be wrapped up in a function which could use Hash which could hide away the nastiness of Rake::Task.new do |task| block and take these scripts to an entirely new level. I’m not entirely sure how the naming would work, but I’m sure it would.

After writing this, I think I’m going to start taking a much closer look. Has anyone heard of anything like this in the works/already released?

It’s not supposed to be inflammatory or controversial

Posted by on November 19, 2008

 

I tend to be an opinionated individual. As such, when I present (or defend) my opinions, I tend to go out of my way to push my opinion as the correct one. I may go as far as to insinuate that others are wrong. This tends to get mixed feelings from a lot of people. Some people just think I’m asserting myself. Others think I’m a know it all. Others just think I’m a plain jerk. There maybe some truth in all three.

Sometimes it just ends up that things work one way for me, and another way for someone else (See my last post). There’s nothing I can do when it comes to that. People are different. Just because something is wrong for me, doesn’t mean it’s wrong for everyone.

I do however, realize that sometimes I’m wrong. Consider this my open invitation to all you (nonexistent) readers out there. If you think I’m wrong, incorrect or just plain out to lunch. Please call me out. Don’t just tell me I’m wrong though. If you can’t back yourself up, then don’t bother. Tell me why I’m wrong. Make me defend myself, or it’s just not worth it.

If there’s one thing I’ve found in my time on the internet, it’s that if you assert yourself enough and just act like you’re right, people will listen to you. Most people don’t have the will to stand up to someone who thinks they’re right.

I hope you do.

If programmers are typists first, then I’d better get a Typing Tutor

Posted by on November 18, 2008

 

This afternoon I found that Jeff Atwood has once again made another post that left me shaking my head. Kind of like a car wreck, I just couldn’t look away. This evening, Jimmy Bogard posted a response. I have to say that I agree with Jimmy wholeheartedly.

The only exception to this rule as I see it is that you can’t be a hunt and peck typist. I don’t care how much code you write, if you have to watch your hands fingers while you’re writing code, you probably could benefit from a round or two of QWERTY Warriors. I’ve worked with hunt and peck typists and it can be infuriating to pair program with them, but I’m admittedly brash and impatient. It’s something that I’ve actually been working on.

Anyhow, I’m a C# coder. C# isn’t exactly known for it’s brevity, and neither are some of my class and method names. However, we developers are a crafty bunch. If there’s a way for us to do things quicker, better or faster, you can rest assured that someone has attempted to solve the problem with some sort of little app or program. Tools like Intellisense, Keyboard Shortcuts and especially ReSharper are all ways to help us reduce the time and number of keystrokes required to do things. In fact, I’d say that 90% of the code I write, I don’t even type entire words. I write I type u-s-ctrl-space and I have userService. I don’t care if you type 84 wpm or 20 wpm: 4 keystrokes is always faster to type than 11.

Also, I don’t see too many typing tests that emulate  string Username { get { return username; } } or for (int i = 0; i < 10; i++) very well. But even that is nearly a moot point. A tool like ReSharper can add a read only property in just a few keystrokes, and with its live templates the for loop almost writes itself. Coding and the associated thinking and planning involved aside, we should be the users of tools first and typists a distant second.

Basically, what I’m saying is that if you’re a C# coder (isn’t StackOverflow written in C#?) and you are writing code in a manner that requires you to be a typist first and a programmer second, you’re doing it wrong. You’re either writing some pretty crazy legacy code (who here hasn’t written a function with a couple hundred lines in it?) or you’re the victim of a problem that’s already been solved.

History has already shown that Jeff is quite happy being a victim.

The Obligatory Developer Rig Post

Posted by on November 15, 2008

 

Seems like everyone has done one of these posts. I’ve spent the better part of the last week rebuilding my workstation and my test/backup workstation. We had a power surge and my aging test/backup station just wouldn’t start up anymore. So I decided to get a new workstation and bump my current one down the line.

Because of circumstances, I decided I was going to put it together myself. So Friday night after work I went down and picked up everything. Just like Jeff Atwood, I like my workstations to be powerful, but quiet, and a quiet PC starts with the case.

Previously, I’ve been a HUGE fan of the Antec Sonata. I own 3 different Sonata cases of both the Sonata I and Sonata II variety.  My main requirement was that the fans in the case were 12cm with a decent airflow. I’m also not a fan of the flashy cases with lights and windows and the like. Eventually, I decided on the Antec P182. Here it is just barely unboxed.

IMG_0848_cropped

And the inside:

IMG_0851_cropped

You can’t really see it here, but on the other side of the case is about a half inch of space to run all of your cables so you don’t have to put them in the middle of the case and block airflow.

As for the components, I was actually quite surprised with how small of a box they all fit in.

IMG_0846

For the motherboard, I chose the EVGA 780i motherboard. I guess the biggest draw for me was the 6 SATA ports and dual gigabit networking. Honestly, after years of using AMD processors, I found almost all of the Intel motherboards to be vastly overpriced. It may have made a difference that I won’t buy any motherboard that is not an NVidia chipset.

For my processor, I chose the Intel Core 2 Q6600 Quad Core processor. Compared to other processors it seems to have one of the best price to performance ratios out there.

IMG_0868

As stated earlier, I prefer my PCs to be as quiet as possible. This stems from back in my university days when I used to have 2 PCs in my room with me.  This is no longer the case, but the need for quiet PCs has stuck with me. My first preference for CPU heatsink was the Scythe Ninja 2. I had one for a previous computer and loved how quiet it was, coupled with the excellent cooling  it provided.

However, the store near my house happened to be all out of them at the time I went to pick it up, and I didn’t want to have to go across the city to get one, so after reading some reviews I ended up choosing the Thermalright Ultra-120 eXtreme. It doesn’t come with a fan, but I have a few 12cm fans kicking around the house, so I wasn’t too worried. However, after getting things all set up, I ended up not even putting a fan on. That’s right. I now have passive cpu cooling, and I couldn’t be happier.

IMG_0860

Considering the catastrophic hardware failure I suffered to put me in this predicament, I’ve decided to begin doing some virtualization. As such, I decided that I needed RAM. Lots of RAM. In fact, I decided to get 8GB of Corsair XMS2 DHX ram.

IMG_0869

And since I’m going to be virtualizing, I wanted to get as much performance out of my drives as possible. I’m also really weird about losing ANY data that I have. So I decided I wanted a RAID 0 for performance, and a RAID 1 for redundancy. So I got 4 Seagate 7200.11 500 GB hard drives, and put them in a RAID 0+1 configuration.

IMG_0871

Finally, since I’ve recently been playing games a bit more often, I decided to splurge and get a video card beyond what I really need. I settled on the EVGA GTX 260 Core 216 Superclocked Edition. I kind of think that to go along with my brother’s thoughts that the longer your Starbucks order is, the bigger a jerk you are, the longer your video card name is, the bigger geek you are. So I guess I’m a pretty big one.

IMG_0874

And to tie it all together, the power supply. I ended up choosing the OCZ GameXStream 700W power supply. I decided that with all the stuff I had in there, I was going to need a fairly large power supply, so I chose this one. Added bonus: its fan is a 12cm fan. Yes, I’m that picky about my cooling.

IMG_0853

Here is the motherboard with the CPU, Heatsink and RAM mounted:

IMG_0870

And finally, here is the entire computer put together:

IMG_0876

As you can see, the cables are run behind the back wall of the case. Here is a better view, my socks included:

IMG_0875

I spent a lot of time trying to make the cabling as good as possible. I’m a notoriously bad cabler, so I was actually quite impressed with the job that I did here. I just know someone who does this for a living is cringing as I say that too.

In the end since I had so much memory, I ended up putting on Vista Ultimate 64bit. So far it has been blazingly fast and stable. I’ve ultimately been very impressed with it. I haven’t yet had any time to write any code on this new machine, but I’m greatly looking forward to it. I’ll let you know how it goes.

Also, I would like to say that if you live in Calgary, Edmonton or Winnipeg and you have any hardware needs, use Memory Express. I’ve been using them almost exclusively since around 2000 and am always impressed. I’ve only had one bad experience when someone was too busy showing a co-worker pictures of girls on facebook to really pay attention to the fact that he was helping me. Once in 8 years, and it wasn’t even that bad. On the other hand, every time I try another store, I wonder why I did it. Take that as you will.

Anyway, if you are a computer person and you’ve never put together your own computer, I greatly recommend you try.