From Joel Spolsky:
It just occured to me that the same can be said about Castle and Dynamic Proxy. We use that from everything from AoP to strongly typed parameters support.
From Joel Spolsky:
It just occured to me that the same can be said about Castle and Dynamic Proxy. We use that from everything from AoP to strongly typed parameters support.
As long as I am talking about reducing pain, here is a sample from a very secret project that I am woring on. I have a lot of parameters for the build script, and it got to be a PITA to try to manage them manually. There are several kinds of builds that I can do here, test, production, DB rebuilds, deploy, etc.
This quick (and very dirty) solution took about an hour of coding to build properly, and I just added some minor details after the intial build, enough to make it even more useful.
It is a build parameters UI for MSBuild, which basically display all the PropertyGroup elements, and apply simple heuristics for trying to figure out what the values are. For instnace, it can discover boolean values (and display check boxes), and clicking on the "..." buttons will display an Open File, Browse Folder, or Connection String dialogs, as appropriate.
As I said, it took about an hour (I wanted to leave it to my team-mates when I was at DevTeach), and it paid back in time, effort and sheer pleasure many times since.
If you are a developr and you have some pain points, fix them, it will be well worth it.
(Yes, Roy, I know that Final Builder has a prettier interface :-) )
Well, when the wheel is a square, of course:
Adi asks about my seemingly inconsistent behavior regarding when to roll your own, and when to use the stuff that is already there:
What can I say, I have a Pavlovian conditioning with regards to software, I tend to avoid software that cause me pain. Let me quote David Hayden about the CAB and SCSF:
That is quite telling. And I don't think that anyone can say that David is not very well familiar with the CAB/SCSF.
Why do I promote OSS solutions such as NHibernate, Castle?
Why did I decide to write my own Mocking Framework instead of using the standard one (at the time)?
Removing pain points will make you a better developer, period.
Oh, and I do enjoy the discussion, although I wouldn't call it a post war.
Right now Brail has no 1st class support for generating XML, like RoR's rxml. I just run into BooML, and it looks like a really great way to handle this issue. MonoRail doesn't (yet) has the notion of multiply DSLs, just standard templates and JS generation. Looks like that is the way I would go when I next need to support XML with MonoRail.
I knew there was a reason why I liked Boo so much :-)
On Castle Dev, Chris has asked the following question, how can you build the common "empty" template with Brail? NVelocity makes it very easy:
#foreach $item in $items
#each
$item
#nodata
No Data!
#end
But Brail makes it more cumbersome. There are solutions using view components, but they are too much, all too often. So, can we find an elegant solution to the problem?
As it turn out, yes (otherwise I probably wouldn't write this post :-) ). Brail is based on Boo, and Boo has extension methods... Another concept that Brail has is "Common Scripts", a set of helper methods that can be used across all the views in the application. Here is the script that I put in /Views/CommonScripts/extensions.brail:
[Boo.Lang.ExtensionAttribute]
static def IsEmpty(val as object) as bool:
if val isa System.Collections.ICollection:
return cast(System.Collections.ICollection,val).Count == 0
end
return true
end
Now you have extended all the objects in the application, so we can use it like this:
<%
for item in items:
output item
end
output "No Data" if items.IsEmpty
%>
I like that :-) The notion can be extended to more complex issues, naturally, such as ToXml extension method, etc. In fact, you can even forward calls to C# code, so that makes it even more powerful (I assume (and suggest against) that you aren't going to write a lot of code in the extensions).
So I can eat it (No Scott, I will not go to that resturant again, I know they can probably serve both, but the salad scares me). Appernatly CodePlex is adding Subversion support. What I would really like to know if it would have the same integration that the TFS backend would have as well.
At any rate, I would like to take this opportunity to apologize to the CodePlex team, I would have never believed that you would do it, way to go!
I have several ways of categorizing code. Production quality, test, demo, and utilities. When I am talking about utilities, I am talking about little programs that I use to do all sorts of small tasks. There I rarely worry about maintainability, and today there was a gem here:
public delegate Control BuildSpecialCase(TextBox textbox);
private BuildSpecialCase GetSpecialCaseControl(string name)
{
if (name.IndexOf("ConnectionString", StringComparison.InvariantCultureIgnoreCase) != -1)
{
return delegate(TextBox t)
{
Button change = new Button();
change.Click += delegate { t.Text = PromptForConnectionString(t.Text); };
change.Dock = DockStyle.Right;
change.Text = "...";
change.Width = 30;
return change;
};
}
if (name.IndexOf("File", StringComparison.InvariantCultureIgnoreCase) != -1)
{
return delegate(TextBox t)
{
Button change = new Button();
change.Click += delegate
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.Multiselect = false;
dialog.FileName = t.Text;
if (dialog.ShowDialog(this) == DialogResult.OK)
{
t.Text = dialog.FileName;
}
};
change.Dock = DockStyle.Right;
change.Text = "...";
change.Width = 30;
return change;
};
}
if (name.IndexOf("Folder", StringComparison.InvariantCultureIgnoreCase) != -1 ||
name.IndexOf("Dir", StringComparison.InvariantCultureIgnoreCase) != -1)
{
return delegate(TextBox t)
{
Button change = new Button();
change.Click += delegate
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.SelectedPath = t.Text;
if (dialog.ShowDialog(this) == DialogResult.OK)
{
t.Text = dialog.SelectedPath;
}
};
change.Dock = DockStyle.Right;
change.Text = "...";
change.Width = 30;
return change;
};
}
return null;
}
Can you figure out what is going on?
As long as we are talking about unmaintainable code, here an example from code meant for production that I just wrote:
But for that I have tests :-)
Scott Hanselman has a post titled: Is Microsoft losing the Alpha Geeks?
In general, I would think that such an organization would be a Good Thing, but it is completely irrelevant to bring the OSS issue into the discussion.
The reason that the "Alpha Geeks" are moving (moved?) from the Microsoft's stuff is very simple. Microsoft's stuff doesn't scale. It doesn't scale for development, it doesn't scale for ease of use, it doesn't scale for elegance.
Microsoft is very focused on the creation of software, but much less focused on working with software. This means that a lot of the issues that arise from working with a large code base over a long period of time have no answer from Microsoft except starting anew. Putting stuff out as OSS wouldn't change that as long as this is the overruling mindset at Microsoft.
Most of the OSS project has a very different mindset than that, but Microsoft is basically just making the source repository public, not OSSing projects. (To be rather exact, they don't work on OSS with the same mindset that other OSS project has, which is highly constrained resources).
I think that part of the problem is that MS is listening to Big customers, which may want what they are supplying, lot of wizards == cheap programmers. By doing so, they are losing the entire Long Tail, and almost by definition, the Alpha Geeks are at the head of the long tail.
This seems like an obvious way, but it is worth mentioning. I was reviewing the search phrases people use to get to my site, and I found some... extremely explicit ones. Not what you would expect on this site. Repeating the search in google brought me a to a post that had several spam comments of the more nasty side. That gave me the idea of trying:
I found a lot of those, sadly, and I was able to remove ~50 or so spam comments fairly easily. The main issue with spam is separating the chaff from grain, google made it very easy to find the bad stuff.
I actually took a camera, but I forgot to take any pictures, so I am mostly reliant on Flickr for photos. Here are a couple good ones:
Roy Osherove preaching Agile.
Beth Massi, Nick Landry and Scott Bellware - demonstrating Shared OwnershipNo future posts left, oh my!