Tag Archive for General Software Development

Seeking advice – strong names and config files

I’ll use my blog for a bit of fishing for advice and guidance on an issue that’s been bugging me.

We’ve been moving towards using strong names on all of our assemblies. The benefits are obvious, and it’s a must before we deploy to clients out in the wild.

The problem is that we have several different processes running, each with its own app.config or web.config file. These config files contain references to custom configuration sections, whether they’re application configuration, Enterprise Library extensions or whatnot. Seeing as my DLLs are signed, I have to use the fully qualified assembly name in all my references. This means that in a nightly build scenario where my version number is bumped continuously, I have to change 5-6 references in 5-6 configuration files with every build.

Doing this kind of string manipulation on a large scale scares me, since it can break, or we miss something. I’ve tried using and directives, but they require a specific version to point to as well.


I’m sure I’m not the first person to encounter this problem. What are the solutions that you use to bypass this? Scripts as part of the automated installation? Moving all configuration sections to a separate assembly whose version is static? What’s the least painful way to manage this?

Windows Services, services.msc and the “This Service is marked for deletion” error.

In my current project, we have a windows service that we are developing and debugging, which involves a lot of installing/uninstalling the service. One common problem when uninstalling a service is that while the uninstallation is successful, you still see the service listed in the Services console(services.msc). If you try to start it, stop it or uninstall it again (using installutil.exe or sc delete) you get an uninformative “This service has been marked for deletion”.

The KB article about this problem suggests you restart the computer, which is pretty much overkill. Sure, it’ll work, but you’ll never find out what caused it in the first place. Turns out it’s a pretty simple affair: just make sure you close the Services console, which apparently holds a handle of some sort to it. You don’t have to do it before you uninstall. The minute you close the console, all services marked for deletion will be deleted, and all will be well.

When doing it on a server, it’s important to make sure you’ve closed all Services consoles on all active sessions. I’ve seen this error happen when no console was open, and it was fixed by running Task Manager and killing all instances of mmc.exe. I could have logged on to the other sessions and closed it gracefully, but I was lazy. Did the trick.

Dependency Injection and a new version of RhinoMocks

I’m a relative latecomer to the unit-testing business, and only got to play with Mocking frameworks in my last project.

After testing several frameworks, we opted on RhinoMocks for emulating our classes during testing. This, coupled with a lot of IOC and dependency injection, made our rather complex, distributed system much easier to test. Code everything to interfaces, feed them in via constructors or whatnot, and you can now slip in a fake cache or project-data service and test only the issue at hand.

Now, I still have issues with IOC/Dependency Injection. While it makes testing easier, and enables replacing modules with little hassle, it really complicates the code. One of the nice things about .NET code is how straightforward it is – less plumbing code, metadata separated out to attributes, now we know that the code to our method is much cleaner and more of it actually describes the program logic. Once we start injecting dependencies, things get muddled. Now we have code that uses the various dependencies given to it, but we don’t know where it was created and what actual concrete object it actually is. When everything is interfaces, and the concrete classes themselves may actually be created dynamically with reflection at runtime, there’s no way to read the code and use the Visual Studio code-browsing tools to know what exactly is going on.

I’m not saying we should dump the IOC concepts – they certainly have their uses – but before throwing them into a project we should be aware of their higher learning curve and added complexity, and see whether our project’s scope really needs it. Not every project is a distributed system with dozens of entities talking to each other.


Did I just write all that? All I really wanted to say is that when using RhinoMocks, we were limited in mocking our Configuration Service, since it relied heavily on generic methods to return its data – couldn’t mock generic methods and had to create a concrete “fake” configuration service for use in testing. But now RhinoMocks v3 has been released, with support for mocking generic methods. I am no longer part of that project, but the guys down there say they’ve been busy pushing the new feature into their unit tests. Congrats, Ayende! This is one tool I’ll be taking with me to new projects.

Screencasts vs. Whitepapers

A few weeks ago, Lawrence Liu (a senior technical PM and community lead for Sharepoint at Microsoft) linked to a few screencasts for learning how to use various features in MOSS2007. In that entry, he mentioned how screecasts are more effective and efficient in training and learning to use a new piece of software. Me, I’m a bit divided about them:

1) Screencasts are great for getting a hands-on view of the system, that’s true. A picture is worth a thousand words, and a movie is worth about 30 frames per second. I know software authors that have replaced the help file completely with a small Camtasia screencast. This, of course, only works for simple programs with few use-cases.

2) As Lawrence mentions, most screencasts are way, way too long. It’s understandable – when speaking you want to be as clear and understandable as possible. Too often it turns into a slow, repetitive lecture. To illustrate: last month Microsoft Israel held a Developer Academy conference to give lectures on new Vista dev topics. I squeezed in one Office 2007 talk. Because I was too worried about being clear and understood, I ended up repeating myself. Even a completely non-technical listener who just came in to hear me speak (yes, indeed, it was my mother) said she got the point already and that I should get on with it.

My point? Too many screencasts are way too long. Jan Tielens’ SmartPart (and sons) is a wonderful web-part to use and to learn from, but the screencast takes 16 minutes to describe what the 2-page readme.txt contains.

3) Screencasts are mostly a solution to learn the how, not the why. I can use Lawrence’s screencasts to learn how to add a library to the Records Center, but I would have found that out myself with little effort. What I would really want right now is a good set of whitepapers to understand the goals of the Records Center and how to use, not abuse it in my solutions.

4) A final tip for screencasts and webcasts – when using Windows Media Player you can speed up playback without affecting the pitch. This is to mitigate slow lecturers and needless repetition. It might require downloading the video locally first. Speeding it up to 140% is usually perfectly understandable.
On my Media Player 9, it’s under View -> Enhancements -> Play Speed. Enjoy.

Outlook Calendar as your Windows Desktop

In a Channel 9 conversation, user Dr. Herbie expressed his long-standing desire to see his Outlook calendar as a desktop wallpaper. This, I admit, has never once occured to me. The nice thing about it is that it's so amazingly simple to implement.

Ever since Windows 98 and the Active Desktop, you could use HTML as the desktop wallpaper and embed anything you want in it. For the last 4 versions at least, Outlook comes with an ActiveX control that lets you display the contents of any Outlook folder in your application. Mix the two – and you have an HTML page that embeds the Outlook View Control maximized to fullscreen, defaulting to today's date, and add two simple Javascript buttons to move back and forward in the days.

A less lazy developer can make this much nicer, with a monthly date-picker and less ugly buttons. Considered as as Proof of Concept, it works with some caveats:

1) Due to the whole Eolas/ActiveX lawsuit fiasco, you need to click on the desktop once to enable interaction with the ActiveX control.

2) You can click on desktop icons, but you can't drag them around (well, without dragging them into an appointment. :). This can be fixed by resizing the control to allow some free desktop space, I suppose.


3) This keeps an instance of Outlook permanently in memory. Probably isn't a problem, but good to know.

4) As it stands, the control will mirror the view current selected in your Outlook calendar.

Here's a screenshot of my desktop right now. Thanks for the idea, Herbie!



Download the specified attachment (CalendarWallpaper.zip) and unzip into any convenient place. My Documents, for instance.

Then, Go to your desktop properties -> Desktop -> Browse and choose the unzipped file (CalendarWallpaper.htm). Et voila!

UI Usability – case studies and recommendations?

Doing work on our WinForm application, we find ourselves having to make choices – too many choices – about the UI. We don't have access to professional UI engineers, unfortunately, and we make uneducated guesses on too many issues – should we use a treeview or a filtered list? Should we use opacity in our floating toolbox windows?

 Lots of people have very strong opinions about these issues, but very few of us have anything to back them up except “In my experience…”. What I'd love to have is some sort of good web-site that has white-papers, recommendations or analysis of different common UI widgets or patterns and how they translate to end-user usability.

Does anyone know of any such resource available on the 'net?