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
Tuesday, February 24, 2009
I actually like Safari's font rendering over the "Windows Standard"
Thursday, February 19, 2009
Thoughts on the SOLID and some goals
- 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.
- 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.
Wednesday, February 18, 2009
How to follow high traffic twitter conversations
Sunday, February 15, 2009
.NET Developer Stereo Types
Friday, February 13, 2009
Stackoverflow and SOLID Principles
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>();
list.Sort();
//or
list.Sort(DrawDown.DateComparison);
Sorting with LINQ:
var list = new List<DrawDown>();
list.OrderBy(d=>d.Date);
//or
list.OrderBy(d=>d.Value);
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.