comments suggest edit

Subtext Logo Well it took a bit longer than I thought it would, but we’ve finally put the final touches to Subtext 1.0, code named “Nautilus”! One of the primary goals of this release was to make it much easier to setup and use than .TEXT, and I think we’ve accomplished that.

[Download it here]

Acknowledgements

It is a LOT of work delivering an open source product, especially given that all this work is done in our spare time. A big thanks goes out to all the contributors: those who submitted code as well as those who contributed ideas and encouragement (especially my wife who has been very understanding of my code obsession and made me a fantastic cup of tea last night as I tried to finalize the release). All of it is helpful and appreciated.

In particular I want to give much credit to the team who have put in a lot of effort lately to get this ready. Robb, I am ready for that homebrewed beer!

I also want to highlight TurboMilk, the creative folks who designed our logo.

Installation

Check out the installation guide on our project site for a walkthrough of the installation. There are also a couple screen casts if you are the more visual type.

New Features

There are many small improvements both under the hood and in the UI. Here are some of the highlights…

  • Web Based Installer - Installs the database schema and stored procedures.
  • BlogML Support - Import and export your blog data to and from other blogs that support this new standard.
  • .TEXT 0.95 Import Wizard - This is a direct database to database import.
  • Host Admin Tool - Use this to manage multiple blogs
  • Improved multi-blog support. Read the configuration docs for more details.
  • Improved Documentation - We’ve gone out of our way to improve documentation as much as possible.
  • Logging Console - The first iteration of this console displays error messages in the admin section. You can update the Log4Net.config file to change logging levels.

Interface Improvements

These were designed to spiff up the look of Subtext and remove some of the headaches in .TEXT

  • New Skins - We added some spiffy new skins for your blog delight.
  • Recent Comments Skin Control - Display recent comments on your blog (requires editing a skin if it doesn’t have the control already).
  • Multiple Comment Deletion - Rather than deleting comments one at a time, check them off and delete them in bulk.
  • Single Web.config file - There’s only one web.config file to worry about.
  • Comments disabled after N days - Where N is an integer of your chosing zero or larger.
  • Comments throttling - Specify a delay between comments as well as filter out exact duplicates. This is good for those repetitive spam bot attacks.
  • Edit Link Control - when logged in as an admin, an edit link appears next to post titles (requires editing a skin if it doesn’t have the control already).

Under the hood

This is for you developers out there. Holla!

  • Unit Tests - We added a bunch of unit tests (using MbUnit) to the codebase. We are by no means where we want to be regarding code coverage, but it is a step in the right direction.
  • NDoc - We included an NDoc file and compiled help file of the code base.
  • FxCop - We have way too many FxCop violations, but at least we know we do via our FxCop project file.
  • NAnt Build File - Build the entire solution from the command line. Choosing the “doc” target builds a compiled help file.
  • RFC3229 Delta Encoding - Potentially saves on bandwidth once clients start implementing their side of the protocol.
  • RSS GZIP Compression - Compress that baby.
  • Fixed MetaBlogAPI - Fixed a few bugs with the MetaBlogAPI implementation. You can now edit blog posts via w.Bloggar.

What’s Next?

The next version of Subtext code-named “Daedelus” will focus on delivering a Plugin framework along with a few plugins. That will be the key deliverable. You can view the Roadmap to see other planned features, but be aware that we may revise this list soon in order to keep the next release tightly focused. Deliver early and often I always say.

comments suggest edit

I have never worked as part of a shrink wrapped product team, which makes working on Subtext the closest thing to the experience. When a product team releases a product, they often stamp it with the acronym RTM, Release to Manafacturing, which is more and more becoming a misnomer as the only manafacturing being done is the manafacturing of hyperbole by the marketing team.

But I digress…

Release Party The other thing a product team does when they release is throw a release party! With an open source project with no funding, that is a bit more of a challenge. The party sort of gives double meaning to the word “release”. Shipping a product and the release party provides a release from the stress of getting the code ready for RTM.

At least that’s how I imagined it. I thought that after the release, I would feel contentment, euphoria, and relief, all without the help of a drug. Instead, I feel foreboding, anxiety, and fear.

Yes fear.

Bug in the system The fear that there we left something important out. The fear that there is yet some hidden but treacherous bug left in the code that will jump out at the wrong moment and eat the first born child of a user (or it might run format c:\ if the user is childless).

I am guessing this is pretty typical of the actual experience of releasing a product. This is the real feeling one gets, which is why they resort to getting really sloshed at the release party, to quell these disturbing thoughts.

Fortunately there are a few things that allay these fears. First is the extensive testing we performed (along with the nice suite of unit tests). As with any product, there will definitely be a few bugs that get uncovered, but they aren’t likely to eat anybody’s kids.

Earth from
Space Secondly is the great team of developers from all over the world that participated in getting this first release out there. It is nice to know that when I hit the sack for some shuteye, somebody in Italy, Turkey, New Zealand, etc… is just getting around to taking a look at the code. Eyes are on the prize 24 hours a day. :)

comments suggest edit

Soccer BallThis week, I’ve had the pleasure of being pummelled in soccer not once, but twice.

As I mentioned in a previous post, I have joined another more competitive soccer league. In that post, I mentioned that we tied one of the top teams. I was wrong.

Hearing that we tied this team, the team that did win the league last season wanted to schedule a match against us (it is pre-season right now). When we took the field, they had a short guy who we joked looked like Freddy Adu. The joke was on us as this “kid” had scored two goals against Brazil for Ghana in the U-17 world cup. This team also sports a former pro who used to make a million bucks a year in Spain.

They pretty much set us in our place, thoroughly dominating the game and scoring maybe seven or eight (we lost track) goals on us. Only our goalie knows the real number, and I told him I’d rather not know.

Fortunately, there is a new semi-pro league starting and some of their players will be moving up.

Today, in my other league, we played a Jamaican team known for smoking out on the sideline. Since our game was in the afternoon, we had hoped they would have been nice and toasted by then. Again, we were wrong.

With my team missing all three of our players who are capable of playing goalie, and not having any subs, we were destroyed as they scored six goals on us. The worst part is I convinced my wife to come watch and she know thinks she might be bad luck as both games she has witnessed we lost terribly. What a humiliating week of soccer.

comments suggest edit

Just wondering, but are there any non-techie readers of this blog (besides my wife of course)? The reason I ask is that I am noticing that I am writing less and less about what’s going on in my life. In part, because I think my audience is almost entirely tech readers and google searchers.

Not that I would suddenly turn this blog into an on the Oprah couch tell-all blog if you were all non-geeks. Seriously.

comments suggest edit

Intro

When I originally announced the subtext project, I had planned to not include multi-blog support even though it was already included in the .TEXT codebase.

The primary reason I wanted to exclude this feature was to simplify the code as well as the administration of a blog. If you ever had the pleasure to install .TEXT, you would remember that there were four web.config files from which you had to choose the appropriate one.

What changed my mind, besides the pleas from several multi-blog .TEXT users, was the day I thought it would be nice to create a blog for my homeowners association. I didn’t want to have to add another installation of Subtext for each blog.

However, any multi-blog scenario would have to adhere to our goal in making Subtext simple to set up and easy to use. So for the most part, the Subtext user experience is optimized for users with a single blog. For these users, you pretty much never need to know there is support for multiple blogs.

It turns out there was a lot of duplication of effort among the four config files, so by being careful, I distilled everything into a single config file. This alone should make the process of installation much simpler.

The Details

However, for those of you who wish to install multiple blogs, I’ve written up some documentation on how it works. Subtext supports multiple blogs from the same domain as well as multiple blogs from different domains.

asp.net, subtext comments suggest edit

Fountain PenFor simple ASP.NET applications that do not employ URL Rewriting, stepping through the code that handles a request is fairly straightforward. For example, given a request for http://localhost/MyProject/Page.aspx, simply open up Page.aspx and look at the code-behind file to see what code handles this request.

But for applications such as Subtext that support dynamic URLs, it can be a bit daunting to find the code that finally responds to the request.

Common approach to URL Rewriting

Most applications that employ dynamic URLs employ a tactic called “URL Rewriting” The approach these applications typically take is some variant of this approach outlined by Scott Mitchell.

In this approach, a handler maps incoming requests for a dynamic URL to the actual ASP.NET page that handles the request. As an example,

http://localhost/CategoryName.aspx

Might be rewritten to:

http://localhost/Category.aspx?Cat=CategoryName

The .TEXT and Subtext approach {.clear}

Subtext employs a slightly different technique that it inherits from .TEXT which Scott Watermasysk wrote about a while ago. Instead of mapping incoming urls to different pages via a configuration section within web.config, it pretty much maps every request to a single page called DTP.aspx, a barebone template file.

Cracking open Subtext’s (or .TEXT’s) web.config file, you can see a section named HandlerConfiguration. It has an attribute defaultPageLocation with the value DTP.aspx.

Within that section are a set of HttpHandler nodes each with a regular expression pattern. When a request comes in, the handler with the pattern that matches the URL is invoked. Subtext adds the set of controls defined in the controls attribute of that handler and then returns a compiled instance of DTP.aspx via a call to PageParser.GetCompiledPageInstance.

Future Direction

For future versions of Subtext, we may consider changing to a model more in line with what Scott Mitchell wrote about above for a couple of reasons. The first is that the current model is not really supported.

According to the MSDN documentation on the GetCompiledPageInstance method

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

The second reason is that it is a lot more difficult for people to understand this method. We may gain a level of simplicity via the other approach without losing much in flexibility. This decision will be made when we have enough time to evaluate the differences and tradeoffs between the two methods.

Full Request Lifecycle in Subtext

If you are interested in a more detailed discussion of how Subtext handles incoming requests, please check out the recently added documentation on this subject, An In-Depth Look At The Life of a Subtext Request.

comments suggest edit

So I spend my time writing up a hopefully useful guide to Subversion on SourceForge and all this one reader from Spain (¡hola!) wants to know is where I got my theme from?

My
desktop

Click on the image above to see a full screenshot

Well let me tell you amigo. Step one is to install the uxtheme multi-patcher. I first learned about this patcher via this post by Ryan Farley. This effectively replaces the uxtheme.dll that comes with Windows with one that allows you to use other custom styles.

You can find information about the patch from here or directly download it from this link.

I was a bit hesitant to install this as I generally don’t like to mess around with system dlls, but Jon Galloway and others have told me they have not run into any problems. So if you have any problems, blame Jon.

Once you have the patch installed, you can download interesting themes from DeviantArt. The particular theme I chose is called VXP Final.

My first impression was that it was a bit cartoony. But after spending a bit of time with it, I noticed that this skin was much more original and well thought out than many of the others I’ve seen. The maker of this theme paid a lot of attention to little details, including interesting rollovers of the start menu icon etc…

code, open source comments suggest edit

Good news! SourceForge now supports using Subversion for source control!

One complaint I received from developers who read my Quickstart Guide To Open Source Development With CVS and SourceForge is the sheer amount of complexity just to get started (not that it was my fault, I was just the messenger). With Subversion, contributing to a project on SourceForge is now much simpler.

Benefits of Subversion over CVS

Subversion has several key benefits over CVS, a few of which are listed here…

  • Subversion supports WEBDAV+DeltaV which works over HTTPS so that whole process of generating an SSH key is no longer necessary.
  • Checkins are atomic (“all or nothing”). This helps keep a check-in error from causing a broken build.
  • Subversion versions file and directory renames and moves.
  • Branching and tagging are fast as they are implemented as a copy operation within the repository.

Drawbacks to Subversion

The one key drawback to Subversion has to do with the last benefit listed. This was an architectural decision by the Subversion team to simplify and speed up branching and tagging. For branching, this is not such a bad idea. A branch is simply another folder within the repository. By convention, this tends to be a folder within a top-level “branches” folder.

For tags though, this is not as ideal because Subversion does not restrict editing tags. In fact, tagging as it is done in CVS does not exist in Subversion. Tagging is merely a convention developers follow by branching (a repository copy operation) to a subfolder of the top-level “tags” folder. To enforce a tag, one would have to implement a hook script to disable edits.

Software

Before we continue with this guide, please download the following tools.

  • TortoiseSVN
    • a Windows SVN client
  • Official SVN Client (OPTIONAL: for those who prefer a command line client, though this guide will focus on using TortoiseSVN).

Checking Out a Repository

At this point, you are all set to get going. One key difference between CVS and Subversion is that Subversion does not have the concept of a “module” like CVS. In Subversion, all your code is organized into folders within a repository.

  1. Make sure you’ve been added as a developer to the project you’re going to work on. A project administrator would have to do this.
  2. In Windows Explorer go to the folder you wish to check the code out into.
  3. Right click and select the SVN Checkout command: Subversion Checkout context
menu
  4. This will bring up the following checkout dialog. You will need to know the url of the project’s repository. This should simply be https://{project unix name}.svn.sourceforge.net/svnroot/{project unix name}. The URL to the project’s trunk is typically located at https://{project unix name}.svn.sourceforge.net/svnroot/{project unix name}/trunk. Note that the url is “https” and not “http”.

    For example, the URL to the Subtext repository is https://subtext.svn.sourceforge.net/svnroot/subtext. However, it is not a good idea to check out the top level repository folder (believe me). That will download every file in every tag and branch. Instead, you should enter the URL to the trunk. For Subtext, you would enter https://subtext.svn.sourceforge.net/svnroot/subtext/trunk

    TortoiseSVN Checkout
Dialog

  5. TortoiseSVN will prompt you for your SourceForge username and password. You can optionally check a box to have it save your credentials so that you do not need to enter them every time.
  6. At this point, I received an invalid certificate dialog. Hopefully this will be fixed soon as it is not generally a good habit to accept an invalid certificate. Invalid Certificate
Dialog
  7. Wait patiently as files are retrieved from the repository and copied to your local machine.

Now Write Some Code

Note that you only have to checkout the repository once. Afterwards you can run the update command to get changes committed by other developers. It’s a good idea to do this before and after you make any changes.

TortoiseSVN Update Context
Menu

Commiting Changes {.clear}

After you’ve changed some files, their icons be marked with an orange arrow. To commit your changes, right click and select the Commit command. Please make sure to enter an informative comment.

TortoiseSVN Commit Context
Menu

To commit multiple changes, right click on the root folder and select Commit. You’llget a list of all changed files. You can check the ones you wish to commit and commit them in bulk.

Adding Files

If you add a new file to the project, you’ll need to add it to Subversion and then commit it. To add a file, simply right click on it and select “TortoiseSVN | Add”.

TortoiseSVN Add File Context
Menu

Know when to ignore {.clear}

TortoiseSVN is not integrated with Visual Studio.NET. Thus it doesn’t know that there are some files you do not want to add to Subversion such as *.suo, *.pdb and maybe the bin and obj folders. There are a couple ways to tell Subversion to ignore certain files.

The way Subversion handles ignored files is different from CVS. In CVS ignore settings are repository wide. For Subversion, the ignore list is a folder by folder setting. Thus ignoring a file within a folder does not necessarily apply that setting to its subfolders.

The quick way to add a specific file or file extension to the ignore list for a folder is to right click on the file and select TortoiseSVN | Add To Ignore List.

TortoiseSVN Add To Ignore List Context
Menu

Since this ignore list only applies to the specific folder (and not to subdirectories), another approach is to setting an ignore list for the project is to right click the root folder and select the normal Windows Properties dialog. You will notice a Subversion tab in the dialog.

Subversion Property
Dialog

This dialog allows you to specify various Subversion properties (meta-data) including one called svn:ignore. Select the svn:ignore property (or if it is not in the drop down, just type it in there). Underneath the drop down, you can type in wildcards for the file extensions to ignore. If you wish to set each sub-folder with the same svn:ignore values, then check the recursive checkbox before clicking Apply or OK.

Submitting Patches as a Non-Developer {.clear}

If you do not have developer access, you can still submit patches to a project. In most SourceForge project sites, there is a “Patch” section where patches can be submitted. In order to learn how to submit and apply patches, read the following article Using a Windows version of GNU Patch.exe with CVS and Diff Files.

For More Information

Conclusion

Again, I hope this gets you on your feet when joining an open source project on SourceForge. By supporting Subversion, SourceForge has removed some of the complexity in getting involved. Subtext will be migrating to Subversion at some point in time. When we do so, I will be sure to update this document with any lessons learned.

comments suggest edit

Last FM plugin

Way back in the day I worked on a website called MyLaunch which later changed its name to Launch before being bought by Yahoo where it now lives.

One of the features it boasted was collaborative filtering using what was then called Firefly technology. The problem was that users had to go in and rate a bunch of songs and artists before you would get any meaningful results.

It would have been nice if there were some way for the site to simply listen in on what you were listening to and make recommendations based on your actual habits. That’s what Last.FM does.

There are two components to Last.FM, a plug-in that sends information to the Last.FM web services about the music you are listening to. This requires a plug-in to your favorite audio program. I installed the iTunes plugin.

The second component is a player that delivers a customized radio station with selections based on your tastes. I haven’t used this but Jon Galloway writes about a C# player that is a worthwhile replacement for the lame player offered by Last.FM. Jon recently open sourced the codebase started by another developer, Eric Willis, with his permission.

Give it a twirl. You can see what amazing taste in music I have by checking out my Last.FM profile page.

comments suggest edit

If you are like me, you “learned” source control in a very informal manner. Perhaps you learned via what we used to call the “Commodore Shuffle” back in the day (what is the modern term for this?) in which you clicked around and figured it out by trying to use it.

Heck, with Visual Studio integration, Visual Source Safe is pretty easy to learn. When you double click a file to edit it, VSS kicks in and asks you to check it out. That effectively puts that file under lock and key and nobody else can edit that sucker until you check it back in.

For several years, I thought this process defined source control (also called version control). Up until working professionally, I had never even heard of source control. My college computer science courses never covered it. Why should they? Everything we wrote for class was pretty much throwaway code.

Fortunately Eric Sink comes along and enlightens the masses with his series on Source Control called Source Control HOWTO. If there are better or equivalent series on this topic, let me know in the comments.

This is the guide I wished I had when first starting out. If you think you know source control, but have never created a branch in your life, have never worked with an optimistic locking version control system, then you owe it to yourself to read this series and gain an understanding of these topics, whether you end up using them or not.

comments suggest edit

Power mast Just had a short power outtage at home, which sucks because I work here. I was taking a short break downstairs reading when the lights suddenly turned off. I had that feeling that must go through the head of the lone security guy just before Sidney Bristow busts his head with her fist.

Fortunately no commandos busted down the door to my place. The unfortunate part is that my computer was upstairs doing its computing thing. *Poof!* Data lost. It seems like we have these outtages every other month or so, which is too much for my liking.

Anyways, on to my point. Does anyone have any good recommendations for UPS systems for personal use? I would like to stay around the $50 range, but if you know of one that can signal the computer to go into hibernation, I might be open to spending more.

comments suggest edit

Mix 06 Well I am ready to mix it up at the Mix 06 conference. This will be my first conference of the year and my coworker Jon Galloway will also be in attendance.

I do have one big concern. The conference is in Las Vegas. This is like a kid sitting in a class lecture held in a candy store. I have already registered, so at least there’s no risk of me trying to double my registration fees at the craps table.

While there I will see if I can pencil in BillG for a conversation about supporting web standards with the next generation of Microsoft tools for the web.

Anybody have any inexpensive hotel recommendations?

comments suggest edit

The local newspaper sports a comic strip that enjoys every opportunity to mock the modern university’s emphasis on diversity. The strip holds diversity accountable for lowered standards and educational quality. However it ignores the danger of a lack of diversity, namely that a student might not be exposed to new ideas that challenge pre-existing assumptions that would improve the student’s overall education.

Tunnel Vision Likewise, any institution that does not cultivate diverse viewpoints risks being caught in institutional tunnel vision. At times, spending too much time and energy duplicating the efforts of others due to simple ignorance. I sometimes see hints of this within the .NET developer community.

Copping a Borgitude

Over the past several years, there have been a proliferation of developers who have what I call the “Microsoft” mindset, also known as “Microsoftitis” or “Borgitude”. This conditioned is characterized by a general tendency to hold up the Microsoft way of doing things as the holy bible of software development.

Please note that this is not a blanket criticism of the Microsoft way of doing things. For the most part, Microsoft does a bang up job of developing software and their development platform is fantastic. However, not everything they preach is gospel. What works for Microsoft isn’t always going to work as a one-size fits all solution for everyone else. And at times, Microsoft has shown itself capable of completely ignoring prior art.

Test Driven Development

What really got me thinking about this is a while ago was Microsoft’s blunder with their approach to TDDin Team System, here summarized by Sam Gentile.

This is not to say that TDD is gospel either. But in adopting TDD as part of Team System, Microsoft sets the stage to shape how many developers with Microsoftitis will first encounter and view TDD. Rather than abiding by their traditional “Embrace and Extend” philosophy, they decided to “Ignore and Do It Our Way” which will leave many with a skewed view of TDD and its benefits.

This is unfortunate because TDD has a rich history and a lot of prior art spearheaded by the Java and Smalltalk communities. The fact that the source of these practices are not Microsoft should not dissuade a developer with Borgitude from giving them a fair shake. There is a lot to learn from these other communities, and a lot to lose by not expanding one’s experience.

Source Control

Another classic example is source control. To many developers with Microsoftitis (and I was this way for a long time) source control is Visual Source Safe (derisively called Visual Source Crap by its detractors). Other means of version control are unknown to such developers.

Visual Source Safe has its place. For fairly small teams within the same network, it does a decent enough job. But for developers who have a very low tolerance of repository corruption, larger teams, or distributed teams, VSS is not an ideal solution.

The most common reason given for sticking with VSS is that it is free. This is ironic because it isn’t technically free. It merely comes bundled with whichever MSDN subscription your company happened to buy. However the real cost isn’t that subscription fee, it is the lost productivity by being forced to adhere to the pessimistic locking checkout/checkin model of VSS. For large teams this is extremely restrictive. And when VSS corrupts your data (if it hasn’t yet, just wait. You’re sitting on a ticking time bomb) add the cost of downtime and developer time to bring it back. That is the real cost of VSS.

For distributed teams, VSS performs terribly and is basically unusable unless you purchase SourceOffsite made by a VSS competitor.

What really burns my hide is that one of the reasons given for changing the web project model in ASP.NET 2.0 is that large teams complained of lock contention on the project file. This isn’t a problem with the existing web project model, this is a problem with pessimistic locking on a large project! This has led to many complaining about the new project model.

If the real argument for sticking with VSS is that it is free, one should consider Subversion which is orders of magnitude better.

I suspect that the real reason many stick with it is because they are used to it. Many have never actually taken a class or read a tutorial on version control, so the ramp up time for a new system seems daunting.

On one hand, there is nothing wrong with that. If it is really working for you, why change? On othe other hand, VB6 worked for a lot of developers, but there is only so long you can ignore the advantages to moving to VB.NET or C#.

Development Idioms

If Microsoft provides a component, many developers will never evaluate alternatives. This makes sense for many reasons such as dependency avoidance. Who has the time to evaluate other options when one is already built in? Even so, one should have at least some small exposure to other solutions. Especially when they too are free.

For example, in ASP.NET 1.1 it makes good sense to use the built in Tracing mechanism for logging. It is very configurable and extensible and generally meets the needs of most developers. However many developers find it to be extremely slooow and discovered that Log4Net is an even better solution for their needs. By breaking out of Microsoftitis they discover a mature logging framework that meets their functional needs and performance needs.

The fact that it is in essence a port of the java community’s Log4j does not detract from its usefulness. Log4j has been around a long time and that maturity is apparent as they have solved a lot of problems that other roll-your-own logging frameworks are just now discovering.

The Remedy

If you are a .NET developer I am by no means advocating that you switch to Java (though you may want to spend some time programming in Java, Ruby, Python, etc…). I firmly believe that in a language to language comparison, C# is a much better language to write software in than Java.

However, the language syntax itself is not the whole of the development experience. Many of the features we are just oohing and ahhing about in VS.NET 2005 have been in Java IDEs such as IDEA and Eclipse for a long time now. It seems that we are rediscovering the many things that Java and SmallTalk developers take for granted.

So what I am advocating is to diversify your development reading, toolbox and experience. For example, instead of complaining about how expensive Team System is, consider that by using Trac, MbUnit (or NUnit) and Subversion, you have many of the tools that TS provides, but for free. You don’t have to be beholden to the Microsoft way.

Instead of only reading Microsoft Press, read a book on Java or Ruby. Read up on MVC and other architectural styles and decide for yourself whether or not it makes sense to use it on your next ASP.NET project. Read up on REST as an alternate to SOAP and understand the differences and the advantages and disadvantages of each.

Most of all, consider working on an open source project. In the comments to my post on Open Source, Joe Brinkman says it well when he describes the benefits of being involved in an open source project.

In my office, the closest I ever came to some of the best and brightest in the development community was seeing someone speaking onstage or reading their book/blog. Since working on an OS project, I have had the opportunity to trade ideas with some of the best .Net developers in the world.

comments suggest edit

I was reviewing some code when I ran into code that fit this pattern all over the place (simplified to make a point).

string format = “/comments/{0}/{1}.aspx#”;

string url = String.Format(CultureInfo.InvariantCulture, format + entity.Id, entity.ParentID, entity.Date.ToString(“yyyy/MM/dd”, CultureInfo.InvariantCulture));

There are a couple things I want you to notice here. The first is concatenation of the entity id to the end of the format string.

format + entity.Id

Second, notice format string passed into the ToString method of the the entity.Date.

entity.Date.ToString(“yyyy/MM/dd”, CultureInfo.InvariantCulture)

Ok I lied. There is a third thing I want you to notice - the fact that CultureInfo.InvariantCulture has to be specified twice.

My guess is the author of this code was in a hurry and didn’t realize the full power of format strings that can be passed to the String.Format method. It is possible to get all the formatting information in a single string. Here is how I rewrote this.

string format = “/comments/{0:yyyy/MM/dd}/{1}.aspx#{2}”;

string url = String.Format(CultureInfo.InvariantCulture, format, entity.Date, entity.ParentId, entity.Id);

In this rewritten code, I took advantage of the fact that the String.Format method allows you to specify formatting information within the place holders like so.

{0:yyyy/MM/dd}

In this way, the code does not need to call the ToString method of the DateTime instance. The formatting is all in a single format string and that is one less CultureInfo.InvariantCulture you need to type.

This helps make the code more readable and more flexible. The string format for this url is all in a single string.

A useful reference for string formats that I keep at my fingertips is the following blog post by Steve Tibbett. If you use format strings, you will find this reference invaluable.

comments suggest edit

Candy Hearts Read this interesting post by security expert Bruce Schneier on how Valentine’s day is the day when cheating spouses are most likely to trip up.

The gist of the story is that it is the one holiday that pressures people to do something romantic for a spouse or lover. For a cheating spouse, this is a problem as he or she has both.

I can just see the pathetic excuses now.

Ummm yeah, I bought the lacy panties for myself, but tossed them out because they didn’t fit.

comments suggest edit

Multi-Touch UI By now just about everybody is ooh-ing and aww-ing over this demonstration video showing multiple users on a single touch and pressure sensitive graphical user interface.

And rightfully so. This thing is amazing! Who wouldn’t want to be able to organize their photos in the manner they do in the demo? They’ve created a particularly intuitive means for navigating photos, maps, floating lava lamp blobs that is a huge step forward in usability.

Is it Ergonomic?

But there was one small issue that popped in the back of my mind. One other detail that would need to be addressed by such an interface. Is it ergonomic?

For software developers, who typically sit at a computer 8 or more hours a day, the ergonomics of a system are extremely important. Ideally monitors are placed so that the top is a couple of inches above eye level. Your head actually has a significant amount of mass (even more if you have a forehead like mine) so it should remain for the most part balanced on your neck to prevent strain.

What would eight hours a day looking down at a tilted screen do to a person’s body? Either we would develop very strong neck and shoulder muscles like our governator, or we would suffer from shoulder and neck pains along with headaches.

I am not sure what the solution is, but I hope they address it because I definitely would want such a device. Perhaps one option is a dual screen approach where a user could alternate by looking at a non-tactile screen at eye level that mirrors what the user is doing on the touch screen, allowing the user to alternate between screens. Having the touch screen at eye level would only introduce upper arm and shoulder pain. Ever try holding your arms straight in front of you for hours at a time? It is painful. Whatever the solution, I bet they will come up with something better than anything I have proposed.

The Lesson

The lesson here is that great design is hard and there is no perfect design. When trying to design anything, such as a new UI, a compensation plan, etc… You have to consider and try to anticipate unintended consequences.

comments suggest edit

Soccer Ball I’ve joined a group of soccer players attempting to form a team to get into a 30 and over league that hosts games on much nicer fields. These are the fields with that really nice high quality artificial turf, a huge difference over the pock-marked dirt/grass fields of my current league. The play in this league is also at a much higher level than my current league and they are very particular about which teams they let in. They judge teams on ability, sportsmanship, and organization.

Last night we played one of their top teams, if not the top. This team included an ex-Sweden national team player and an ex-MLS/National Team player. Had I known I would have asked for autographs. ;)

For one of their warm-ups, these guys we’re in tight circles of five conducting a one-touch five man weave. The interesting part was that it was one-touch in the air. The ball didn’t touch the ground. Meanwhile we looked like the Bad News Bears with our mismatched jerseys. This was one of several friendlies so that the league could evaluate us, so we don’t have uniforms yet.

In any case, we struck first with a goal and ended up with a one to one tie. A very respectable showing, but between me and you, and I would never admit this normally, but they were a much better team. It was obvious they’ve played together for a long time. It is amazing what a well organized, well coordinated team can do. Just like software teams!

Not only that, every last one of them was fit like Lance Armstrong. This was one of the few games I subbed myself out from time to time to get a breather. Usually you have to drag me kicking and screaming off the field.

In any case, we just got the word that we have been accepted into the league. Woohoo! Hopefully we won’t run into any brawls in this league.

comments suggest edit

Toy Soldier With Bazooka No, this isn’t a revisionist history account attempting to insert the role of software in the Crusades. Today we take a look at Religious Wars in software. Sometimes also referred to as “Flame Wars” and “Holy Wars”.

A religious war is a very passionate conflict or argument in which each side is absolutely convinced of the objective truth of his or her own position on a matter of personal preference. These are typically very heated arguments over very trivial matters in which the only truth is that there is no objectively correct answer. These arguments would make an outsider wonder if we should all be locked up in straight jackets.

Spaces or Tabs

One good example, and I hesitate to even mention it, is the topic of using spaces or tabs for indenting code. True software developers know there is only one right answer and they’ll defend the truth of that answer till they are blue in the fingers, making sure to spread the “One True Indenting Style“ to every forum in every nook and cranny of cyberspace. Obviously I know what the real answer is and that answer is…

Kinda puts the “anal” in anal retentive obsessive compulsive doesn’t it?

Private Member Prefix

Sometimes we lob grenades over a single character or two. Make sure to prefix private member variables with an underscore or be burned at the stake in one camp. Use an m_ prefix or be flayed alive by another camp. Don’t use an underscore at all in yet another camp or be drawn and quartered. I’ve seriously thought of joining the camp that wants to prefix member variables like so:

string HEYThisIsAPrivateMemberVariable___someVariable;

How is that for being explicit? Of course the true code warrior will notice I didn’t explicitely mark the member as private and already has a sniper laser scope aimed at my head.

Holy War Phoenix

The real beauty of religious wars is that they never go away. Sure they’ll sometimes flame out a bit and lie smoldering just under the radar. But wait long enough and they’ll spring back to life in full force. Just look at the Edit and Continue debate in Atwood’s blog.

Another example of a holy war that never seems to die is the VB.NET vs C# debate. This is an interesting one because VB.NET and C# are really good buddies who like to have a pint at the pub together every now and then. They don’t have a beef with each other. It’s certain camps that use these languages who like to beat each other with flames and misinterpreted arguments that thrust these languages into an all out religious war.

Crusaders

At the forefront of these religious wars are the crusaders. I won’t link or call out any in particular lest my blog become the next battleground for the faithful holy warriors. But you recognize them when you see them. They can be found in the trenches of the newsgroups, blog comment sections, and in their own blogs, fighting for the cause with a single minded determination.

They rarely give an inch to the oppositions viewpoint, lest they come across as weak. You are either with them, or against them.

Well Known Religious Wars

No discourse on religious wars would be complete without a list. This list is by no means complete, but simply a list of well known holy wars in software that I can recall. Please contribute others in the comments and I will keep this updated.

  1. Spaces vs Tabs for indenting code
  2. Curly braces on their own line or not
  3. Private Member Prefixes…or not
  4. private keyword or just omitting it
  5. Managed Languages vs Unmanaged
  6. Edit and Continue or Not Edit and Continue
  7. BDUF vs Iterative Design
  8. Interpreted and dynamic languages vs Compiled
  9. VB.NET vs C#
  10. Java vs .NET
  11. vi vs emacs
  12. Windows vs Linux
  13. Tastes Great vs Less Filling

Got any others?