The diary of a .NET Developer, working on an unlaunched startup project. Also, I live and work in Southern Oregon.

Wednesday, February 25, 2009

Lost Developer Time

I started adopting NHibernate on my current .NET project. In other words I've outgrown Linq-to-Sql.

I have been crawling through many blogs looking for a little advice on testing nhibernate mappings and implementing the Repository pattern etc, and it dawned upon me:

All the helpful blog posts and articles about NHibernate were written between 2005 and 2007.

Am I really that late to the game? The answer is of course, YES!

I took a brief look at NHibernate back in early 2006 but and I intentionally avoided it at all costs. Please understand: I used to work at a job where the only priority was is getting done fast (at the expense of quality). Being under constant pressure to finish projects fast, I naturally fell to using tools that supported this type of programming. The two things Microsoft has are Linq-to-Sql and Webforms.

These tools appear to make it life bearable,but over time you pay for it in the long run. You end up making crap code but launching it anyway, then having to deal with it while it runs in production.

Things are different now. I'm my own boss and I make all the rules. So, I declare the number one priority is quality.

I feel like this part of my development career is behind me and I'll try to avoid ever working under conditions where quality is ignored in such extreme ways.

I'm very curious to see how long I stay developing in Visual Studio Land. Although, my recent use of Resharper and NHibernate might change this attitude.

NOTE: I revised this post on 2/26/2009 at 1:33pm

Tuesday, February 24, 2009

I actually like Safari's font rendering over the "Windows Standard"

I downloaded Safari 4 Beta today. It looks like a native windows app to the point where they even changed the font rendering to use the windows style by default. I guess a lot of people complained.

I actually like the OSX style font rendering. Here is a comparison:

With OSX font style:

With Windows Standard font style:

I guess Apple is trying to make the windows users happy, but I still don't understand why everyone objected to the "nicer" fonts.

At least it is a configurable option:

Thursday, February 19, 2009

Thoughts on the SOLID and some goals

Wow, there has now been four podcasts regarding the SOLID principles and I enjoyed listening to them all. It was especially fun to here all the controversey. I was pleasantly surprised to here Uncle Bob was back on Hanselminutes.

Here is what I personally took away from the SOLID princples:
  • SOLID principles are all about decoupling your code.  
  • Decoupling your code helps you write good unit tests. 
  • Unit tests and (if you're up to it, TDD) are great ways to have quality software.  
All this has me thinking a lot about the quality of my code. (ie. testability, how decoupled it is etc) I'm am now trying to use the SOLID principles as a guideline to help me write better code.

This has been very enlightening and has pretty much changed the way I picture what good code should be.

Uncle Bob posted a Getting Started post on his blog. So here are my goals:
  • Focus on when I should be using SOLID in my own code.
  • Trying to make it up to Portland, OR for a PADNUG meeting
  • Practice, practice, practice and make a lot of mistakes.
I also am starting to read some of Robert Martin's books. I started with Clean Code, I hope to talk more about this topic later on.

Wednesday, February 18, 2009

How to follow high traffic twitter conversations

I have tried to follow a few high traffic twitterers and quickly had to stop.  I'm talking about people like @codinghorror, that update every five minutes.  Follow a few of these and your twitter page becomes overrun pretty quick.

To follow people like this, I subscribe to their updates via RSS feed, and view them in Google Reader.  

This works OK, but it's a little awkward to follow conversations.  I found a tip today from @shanselman that fixed this!

To follow @codinghorror's conversation, use and search for their nickname,  and subscribe to that page!

For example:

and you can subscribe to this RSS

Now my Google Reader has a exact conversation stream.   It works perfectly!!

Sunday, February 15, 2009

.NET Developer Stereo Types

If I told a non-windows developer that I'm a .NET developer, I'm pretty sure they would label me as "Mort programmer" , even though they have no clue who Mort is.  

This disturbs me greatly.  How can I tell people I'm a .NET developer and not be ashamed for saying so?  

I can't just say, "Hey, I'm a .NET developer, but don't worry, I'm an Einstein, so please don't think I'm a Mort." They wouldn't know what I was talking about?  (Most likely they would think I was some kind of pompous ass)  

It doesn't help that I don't personally know any .NET programmers.  The programmers I do know are all non-windows developers.

I also agree with a lot of Alt.Netters that many of Microsoft's tools promtote bad software design.  (Specifically, code that is not testable and  hard to refactor.   )

I guess I can start adopting better tools (like NHibernate and MVC framework),  but this apparent stigma of being a .NET developer has pushed me to start seriously thinking about my choice to continue being a .NET developer.

I used to develop a lot of line-of-business apps and this is why I moved to .NET 3 years ago.  Over that past year, I have spent more time building public facing websites than anything else, and I'm not sure that ASP.NET is ideal tool for this.

Before doing anything rash, I'm trying to reach out to other .NET developers and get some perspective.  But in the mean time, I can't stop thinking that going back to my open source roots is looking more attractive.

Friday, February 13, 2009

Stackoverflow and SOLID Principles

I'm still shocked at how the entire Robert Martin (aka Uncle Bob) fiasco has turned out on the stackoverflow podcast.

And, I'm not sure this episode #41 has changed anything.

I've been programming for 6 years. With each new project I work on, I strive to improve my code just a little bit more than the previous project.

I'm not saying that I only write code that follows things like the SOLID principles. I'm saying that do try to think about ideas like this (and many other ideas) while I write my code.

Maybe I heard it incorrectly, but both Joel Spolsky and Jeff Atwood still seemed to think the SOLID principles were a waste of time.

I think this was more confusing than helpful to the programming community.

The idea that there is a set of engineering principles that I can incorporate into my code is invaluable to me.

Everyone that listened to the stackoverflow podcast #38 and #41 should at least listen to the hanselminutes episode with Bob Martin, and go read about the SOLID principles, and then just think about them next time you write some code.

Tuesday, February 10, 2009

Comparison<T> and IComparable<T> vs LINQ

Sorting Before LINQ:

  • Implement IComparable<T> so you can use the default sort.
  • Add a few Comparision<T> delegates so I could sort other ways
public class DrawDown : IComparable<T> : IComparable<T>
public static Comparison<DrawDown> DateComparison = delegate(DrawDown field1, DrawDown field2) { }
public static Comparison<DrawDown> ValueComparison = delegate(DrawDown field1, DrawDown field2) { }
public int CompareTo(DrawDown other) {}

And sort like this:

var list = new List<DrawDown>();

Sorting with LINQ:

var list = new List<DrawDown>();

Basically, I use LINQ more then anything else in the .NET framework.  It really does save hours of writing boring “sort” code.

NOTE: I am working on getting better syntax highlighting in my blog.  Live Writer  is not working out at all.

Wednesday, February 4, 2009

Char to Int vs String to Int

I spent way to much time staring at this code trying to figure this out:

int number = 10;
int firstDigit = Convert.ToInt32(number.ToString()[0]);
Assert.AreEqual(1,firstDigit) //fails: firstDigit == 49

I knew it was returning the Unicode value of 1, which is 49, but I was after the integer value.  Converting a char to an int always returns the Unicode value, not the integer value.  Converting a string returns the expected result.

int number = 10;
int firstDigit = Convert.ToInt32(number.ToString()[0].ToString()); //add an extra ToString()
Assert.AreEqual(1,firstDigit) //passes

Nothing too exciting, but I was stumped for about 15 minutes trying to figure this out.  I almost started looking for a atoi() function.