I've written an add-in for Visual Studio called Ora. You can read more about it via that link but here's some background to it.
It's designed to replace a common use of regions - though I'd call it a common abuse of regions - so it's called Ora, which means a bunch of things in various languages, but can mean region in Latin.
Regions are a feature of C# that generate some controversy, inevitably known as the region wars. Sample posts:
- C# Regions Considered Harmful
- C# Regions Suck
- Just say No! to C# Regions
- C# Regions... When to use them?
I think regions mostly suck, at least in the way they are commonly used. They're a form of comment, so they should come with the same warning as comments:
Do not redundantly replicate in a comment any information that is clearly stated in the code itself.
With this advice in mind, and applying it consistently to regions as well, it would make little sense to put a region called Private Static Methods around all your private static methods - it's already perfectly obvious what they are. It says so completely unambiguously in the code. But of course, one day someone will decide that one of the methods should be public - at which point they either have to remember to physically move the method out of that region, or else the region is no longer correct (which is the ultimate fate of all redundant comments).
So it's almost distressing to see advice like this being handed out:
I've seen class templates, intended to be used by anyone who is starting a new class, which come ready stocked with over a dozen regions called Private Fields, Static Public Properties, and so on. Suddenly, instead of writing elegant self-descriptive code, you're filling in a tax form. And when you've captured a simple concept in a class with only a few members, it will contain a dozen empty regions, just in case someone one day wants to put things in it that don't belong in it.
The only justification I know of for this is that it helps anyone reading the code to navigate it. But as a solution, regions are utterly unworkable, so let's state the actual problem clearly:
A reader of the code needs to see a simple overview of a class, in which the members have been grouped in various helpful ways, so they can navigate to a member in the source code by clicking on its name in the overview.
So what they need is something that automatically builds such an overview on the fly, directly from the code under the cursor. This is the purpose of Ora, my add-in for Visual Studio.
4 comments:
This looks great, but setup.exe is failing with this message on Vista for me:
Font 'Palatino Linotype' does not support style 'Regular'.
Is there a way to install it without using the installer?
Oh man, how annoying. I didn't realise changing the font on the label would actually stop it running. I'll fix it as soon as I can.
The problem with the font still exists (I created a discussion on Codeplex).
When will you fix this or how can we use it without the installer? I really want to use it :).
Resharper has a window that looks the same, but ofter switching to CodeRush,I was missing it.
Hi, I've since fixed the installer problem.
Post a Comment