Thursday, February 26, 2009

So finish something already!

Now most of the better programmers love to code. Most Professional programmers love a challenge. So, to play to these twin desires, a lot of us have hard drives littered with the five-to-fifteen minute test bed projects that we create as we tackle a programming challenge.

This post is not about those projects.

This post is about the three quarters written Pente game that has been languishing on your hard drive for three years or the redesign to your website that you can never seem to quite finish or cool little app that just needs that last bit of spit and polish before you can release it to the world. These are the projects this post is about.

And why are they not done? The challenge to create them in the first place was exciting! Why is the bloom gone from the rose?

I think that this is a critical flaw in the personality of most programmers (Myself included). We love the challenge at the start. The puzzle that needs solving. We may spend hours or days working out how to do a single coding trick that we needed at the time. We sweat blood trying to breath a form of life into our creations.

Then when we get to the equivalent of getting our creations through Junior High, we look down on our creations and say we'll finish it later. We've got this other idea that we want to work on right now. And, so the cycle repeats itself, over and over again.

But, why do we abandon our nearly completed creations? Some say that it is because the creation process is done and now we need to polish and primp our creation so that it is truly finished and this is not nearly as fun as the process of creation. That may be true, but are we just big adolescents then, chasing after a series of "Oh shinny!" objects, that once we catch them are not nearly as fulfilling as we thought? Or are we intellectually lazy and when we get to the parts we do not find as fun we wander off in search of new challenges?

Could it be how we are trained to code in the first place?

From the moment we start we are bombarded with code snippets on how to do this or that. Homework assignments are fragments that do this or that function, never a complete application. If we are ever given an assignment to write a complete application, it is a class long project and is given such grading weight that we are almost forced to understand that "A complete application is so hard, we need to make it a very substantial part of your grade".

I do not know the answer to my question for myself, let alone everyone else. But, I can tell you that the last little bit of getting finished software out the door is about as fun to me as doing the dishes after a fine meal. but, just like those dishes, if you do you work and finish what you start then it gets easier the next time. After a few iterations, you will find yourself cranking our completed projects like copies out a Xerox machine. And if you think the high from solving a problem is great, then you will love the feeling of having your software being used the world over.

So, have you finished something today?

Friday, February 20, 2009

When will I ever learn ....

I think that if the song Blowin' in The Wind was written today, it would have included in the lyrics:

How many times must man loose his code
Before he uses source control?

The answer, my friend, is blowin' in the wind
The answer is blowin' in the wind


Now I am a true fanatic when it comes to source control at work, but the moment I walk through the door at home, it all seems to leave me and I "just want to get it done" and not worry about source control.

Well, once again that laissez–faire attitude towards source control has bitten me again. No, nothing catistrophic, just that somehow I've lost 75% of the AI code I was writing for Switcheroo.

Arrrrrrrrgggggggggggg!

Maybe now I'll start using source control at home? A thousand times burned, forever shy?

Do not count on it, I just want to get it done.

Sunday, February 8, 2009

Fancy fonts in XAML (Silverlight and WPF)

Outline, Shadow, Embossed and Engraved text in XAML.

Here are a few quick and easy ways to spice of your text in XAML.

To use these tricks, you need to have the ability to exactly place the text. For that you need to use a Canvas Layout control.


<UserControl x:Class="SilverlightApplication2.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="320" Height="200">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Margin="3">
<Canvas Width="800" Height="60">
<TextBlock FontSize="36"
Canvas.Top="2" Canvas.Left="10">Outline</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="2" Canvas.Left="12">Outline</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="4" Canvas.Left="10">Outline</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="4" Canvas.Left="12">Outline</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="3" Canvas.Left="11"
Foreground="White">Outline</TextBlock>
</Canvas>
</Button>
<Button Grid.Column="0" Grid.Row="1" Margin="3">
<Canvas Width="800" Height="60">
<TextBlock FontSize="36"
Canvas.Top="5" Canvas.Left="4"
Foreground="Black">Shadow</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="3" Canvas.Left="2"
Foreground="Gray">Shadow</TextBlock>
</Canvas>
</Button>
<Button Grid.Column="1" Grid.Row="0" Margin="3">
<Canvas Width="800" Height="60">
<TextBlock FontSize="36"
Canvas.Top="3" Canvas.Left="0"
Foreground="Gray">Engrave</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="5" Canvas.Left="2"
Foreground="White">Engrave</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="4" Canvas.Left="1"
Foreground="Black">Engrave</TextBlock>
</Canvas>
</Button>
<Button Grid.Column="1" Grid.Row="1" Margin="3">
<Canvas Width="800" Height="60">
<TextBlock FontSize="36"
Canvas.Top="5" Canvas.Left="3"
Foreground="Gray">Emboss</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="2" Canvas.Left="2"
Foreground="White">Emboss</TextBlock>
<TextBlock FontSize="36"
Canvas.Top="4" Canvas.Left="4"
Foreground="Black">Emboss</TextBlock>
</Canvas>
</Button>
</Grid>
</UserControl>

Sunday, February 1, 2009

My Five Minutes of Fame

Well, I've had my five minutes of fame. I submitted my Silverlight Tic Tac Toe project to the silverlight.net site. They posted it to their site on Tuesday.

Since then, the statistics on my blog have went crazy. I was seeing a net traffic load of about 15 hits per day (Yes, I know that is a pathetically low number, but since I've only been blogging for a few months, I thought that was a good start). But, since Tuesday I've averaged 150 hits per day.

The one thing that had disappointed me was the lack of comments from my visitors. Well, with over 800 hits on my Tic Tac Toe post, I only got two comments. Sigh. I guess I was just expecting too much.

The one thing the stats told me before I posted my Silverlight Tic Tac Toe game, was what people were interested enough in to seek me out. I learned that Counts in a substring, shuffling and Latin squares are by far the most popular things I'd blogged about. Now all my stats point to Silverlight.net.

Who knows what tomorrow may bring. I may finish that old magazine game, Switcheroo (The endgame AI is giving me fits!) or I may post some more "Old style" coding articles. What would you rather see more of?

*** And maybe a blatant call for comments will work :-) ***