Every application gets tested.
Some applications get tested in the form of does my code compile and does the code appear to function.
Some applications get tested with Unit tests. Some developers are religious about Unit tests, TDD and code coverage to a fault. Like everything, too much is more often than not bad.
Some applications are luckily enough to get tested via a QA team. Some QA teams automate their testing, others write test cases and manually test.
Michael Feathers, who wrote: Working Effectively with Legacy Code, wrote that code not wrapped in tests is legacy code. Until you have experienced The Big Ball of Mud, I don’t think any developer truly understands the benefit of good Application Architecture and a suite of well written Unit Tests.
Having different people test is a great idea. The more people that can look at an application the more likely all the scenarios will get covered, including the ones you didn’t intend to happen.
TDD has gotten a bad rap lately. When I think of TDD I think of dogmatic developers meticulously writing tests before they write the implementation. While this is true, what has been overlooked is by writing the tests, (first or shortly after) the developer experiences the method/class in the shoes of the consumer. Design flaws and shortcomings are immediately apparent.
I argue that the size of the project is irrelevant. What is important is the lifespan of the project. The longer a project lives the more the likelihood that a developer other than the one who wrote it will work on it. Unit tests are documentation to the expectations of the application — A manual of sorts.
The Pragmatic Programmer and Code Complete
Both of these books are a must read for any software engineer. They cover common pitfalls in everyday development and they offer sound advice to avoiding common mistakes. As pointed out above. Jeff Atwood outlined the entire pragmatic programmer in a blog post.
Clean Code
This book talks about writing “Clean Code” were The Pragmatic Programmer and Code Complete is more about process and abstract concepts.
Working Effectively with Legacy Code and Refactoring
If you are stuck with a pile of legacy code (legacy code as defined as code without tests), like most of us, then Working Effectivley with Legacy Code and Refactoring are a must read.
Effective C# and More Effective C#
Both books are filled with little nuggets of knowledge for the C# developer. For example in Effective C# the author details the difference between value types and reference types. He explains the problem it is trying to solve and explains the pitfalls of other type implementations in others languages. Other nuggets include: using as and is, how to avoid #if …#end if and reasoning for implementing ToString() on your objects.
You might also consider a subscription to Safari Online. I’ve heard good things about them. On the site it says you can view up to 10 books a month.
I recently came across an application, which logged EVERYTHING. All methods had an enter and an exit trace. The lines quickly numbered into the tens of thousands. Trying to figure out where an exception was like looking for the proverbial needle in the hay stack.
With so much noise in the log file it is hard to find anything. What’s the value of logging everything when you can’t find anything when you have everything?
The best logging is when it’s targeted. If you are logging errors, then only log the errors. If you are logging traffic, then only log the traffic… etc.
I installed Windows 7 the first day the beta was available. It’s been clear sailing since, until yesterday.
Yesterday I decided to poke around the network control panel. I noticed a new feature: HomeGroups.
I thought, “Hmm, what the hell is a HomeGroup.” I clicked the link. There is a nice little wizard to set up your HomeGroup. Essentially it’s an easy way to share all your public data (photos, documents…etc).
Within a couple hours of setting up the HomeGroup my internet got laggy. I pinged yahoo.com and saw latency of up to 3 seconds. My first thought was I forgot to pay my bill and this was my provider’s way of slowly ripping the internet from my soul. Luckily this wasn’t the case. I confirmed this by using my laptop to test the connection. It was blazing fast. Its ping to yahoo.com was in the 20m second range.
Nuts, what the hell is going on? After some painful hours searching the internet, I discovered a few others having the same or similar issue. Some had success with disabling IPv6, others disabled the HomeGroup feature. None of this worked for me. I uninstalled and reinstalled the network adapter. The internet worked for about 5 minutes before returning to maddening latency. I did a system restore to a date when the internet worked, still no love. In some cases I didn’t get any internet, just the local network. It was very strange.
As luck would have it, there is an open access point nearby. When I connect to this access point, I didn’t have any problems. However when I connect to my WPA enable access point, latency went through the roof… To test this theory I turned off WPA and changed the name of the access point. IT worked! The blazing fast speed has returned! When I re-enabled the WPA, it ground to a halt again. So I can only conclude that WPA is flawed in Windows 7 beta.
I’m not sure what initiated it, like I said above, Windows 7 worked great until I went messing around with the Network Settings and HomeGroups. I can only surmise that there is a bug in WPA or HomeGroups in Windows 7 beta. If someone else figures it out let me know. The only solution I had was to remove the security from my access point and filter by MAC address. Not the ideal solution but it’s working for now.
I was introduced to programming through a dialup program called “Telix.” Telix, had a scripting language called “SALT.”
Later when the web became popular, I wanted to put a web site. So I learned HTML. From there it grew. The next was how do I connect a database to my web page – I learned PHP and MySql.
The applications started to get bigger, almost out growing PHP. I had an opportunity to learn VB.NET. Shortly after learning VB.NET I switched to C#, which I’ve been working with ever since.
All of my learning was self motivated. When I first started, the internet wasn’t this large orgy of knowledge, googling it wasn’t an option. Everything had to be figured out. Luckily when I started learning HTML, CSS, PHP and Mysql there was already a good size of web sites on the net that had posted articles. There was one forum site that was instrumental in my learning: http://sitepoint.com by far one of the best resources for web development.
When I started windows development I moved away from Sitepoint. The first book I started with was SAMs ASP.NET unleashed. It’s a great place to start, if you into web development on windows.
Happy Coding!
Companies need reports. They track investments with reports. Naturally web assets are investments and require metrics. These metrics come in the form of data analysis.
Where is data found? You guessed it the database. It’s like a fat kid finding a candy store. Stakeholders hunger for feedback on their investments.
It always starts with one report. They want to know how many people use the site. They want to know how many accounts. They want to know how many widgets have been sold… It goes on and on. And where do these reports go? You guessed it, the production database.
The symptoms are always the same. Some marketing folk complains the site is slow. The dev team checks it out. They also notice it’s slow. If they are a capable team they will quickly identify the database is the culprit. The team identifies the reports as the problem.
Here’s the dilemma. Running report on production puts two requirements at odds with each other. Web sites perform fast short queries, reports aggrate large amounts of data which can run hours and peg the CPUs. The two cannot coexist. What to do? The site must stay up to maintain the revenue stream, but without reports executives can’t steer the ship and may run aground.
Not all is lost! There is a solution, move the reports to a separate server. Periodically update the report servers with live data; usually slow periods throughout the day work the best. All is good, the site is back to its snappy self and the execs can steer the ship once again.
The charts are awesome… but dam! The sample code must have been written by a 1st year intern!
Microsoft Chart Controls
They require 3.5 SP1.
Ever wanted to clear text from all the text fields? Here how to do it.
Every “Web Control” with a Text property implements ITextControl. Armed with this bit of information, you can now search through your control collection and find the controls that implement “ITextControl.” Once a control is identified, it’s as easy as setting myControl.Text = string.Empty;.
Below is a simple set of methods I use to dynamically clear an entire form.
public static class ClearText
{
/// <summary>
/// Clears Text from Controls...ie TextBox, Label, anything that implements ITextBox
/// </summary>
/// <typeparam name="T">Collection Type, ie. ContentPlaceHolder..</typeparam>
/// <typeparam name="C">ie TextBox, Label, anything that implements ITextBox</typeparam>
/// <param name="controls"></param>
public static void Clear<T, C>(ControlCollection controls)
where C : ITextControl
where T : Control
{
IEnumerable<T> placeHolders = controls.OfType<T>();
List<T> holders = placeHolders.ToList();
foreach (T holder in holders)
{
IEnumerable<C> enumBoxes = holder.Controls.OfType<C>();
List<C> boxes = enumBoxes.ToList();
foreach (C box in boxes)
{
box.Text = string.Empty;
}
}
}
/// <summary>
/// Clears the text from control.
/// </summary>
/// <typeparam name="C"></typeparam>
/// <param name="controls">The controls.</param>
public static void ClearCollection<C>(ControlCollection controls) where C : ITextControl
{
IEnumerable<C> enumBoxes = controls.OfType<C>();
List<C> boxes = enumBoxes.ToList();
foreach (C box in boxes)
{
box.Text = string.Empty;
}
}
Simple easy to use logging class:
/// <summary>
/// Clears Text from Controls...ie TextBox, Label, anything that implements ITextBox
/// </summary>
/// <typeparam name="T">Collection Type, ie. ContentPlaceHolder..</typeparam>
/// <typeparam name="C">ie TextBox, Label, anything that implements ITextBox</typeparam>
/// <param name="controls"></param>
public static void Clear<T, C>(ControlCollection controls)
where C : ITextControl
where T : Control
{
IEnumerable<T> placeHolders = controls.OfType<T>();
List<T> holders = placeHolders.ToList();
foreach (T holder in holders)
{
IEnumerable<C> enumBoxes = holder.Controls.OfType<C>();
List<C> boxes = enumBoxes.ToList();
foreach (C box in boxes)
{
box.Text = string.Empty;
}
}
}
/// <summary>
/// Clears the text from control.
/// </summary>
/// <typeparam name="C"></typeparam>
/// <param name="controls">The controls.</param>
public static void ClearControls<C>(ControlCollection controls) where C : ITextControl
{
IEnumerable<C> enumBoxes = controls.OfType<C>();
List<C> boxes = enumBoxes.ToList();
foreach (C box in boxes)
{
box.Text = string.Empty;
}
}
Recently on a project, the design called for only horizontal lines in a table. Being a .Net guy, I busted out the Gridview. I was able to implement everything except the removal of the vertical lines. In IE I was able to remove them via CSS. However Firefox refused to remove them:

After some digging around I came across this article: Tip : Does Firefox ignore the ASP.NET GridView border property?
In short, for Firefox to remove the vertical lines, you need to set the GridView.Gridlines property to “None.”
