The Power of the Marginal

“Work like a dog being taken for a walk, instead of an ox being yoked to the plow.” —Paul Graham, in his latest, The Power of the Marginal

I found this essay inspirational. It’s no great leap to consider SourceGear, a small software company out on the prairie, fitting Graham’s definition of marginal.

More on CodeRush/Refactor 2.0

CodeRush/Refactor is evolving into the tool I want to love, but it’s just not there yet. The templates are tremendously cool (and it’s obvious I’ve barely scratched their surface) but as a whole it’s lacking a number of Resharper features I find it hard to live without.

Some of these were previously mentioned, but this is my complete, updated wish list for CodeRush/Refactor:

  • I need keyboard shortcuts for “Move Down Call Graph” (Go To Definition) and “Move Up Call Graph” (or List References, when there’s more than one possibility). Visual Studio 2005 has only halfhearted implementations of these. For example it doesn’t take overloaded routines into account and it frequently just doesn’t find some references. Visual Studio 2003 is totally lacking the List References/Find Symbol functionality, making this a huge win there. These are what I called “usage search tools” last week. This is a killer Resharper feature that I just can’t live without.
  • I’d like a tool window showing my marker stack that allows visiting any marker with a double-click, without altering the stack. (Maybe add some right-click options and/or drag-n-drop to modify the stack. I could be persuaded that’s overkill.) This would make markers the perfect bookmark replacement, and I could forget about them altogether. As it is, I still have to use bookmarks if there’s a bunch of source locations I need to visit frequently in relatively random order.
  • I’d like additional syntax highlighting options. In particular, I like being able to give colors to variables of different scope (member, local, parameter).
  • I’d like a comprehensive list of keyboard shortcuts, including templates, navigation, embedding, etc. I know the vast majority are context sensitive, and this list would be huge, but I still want it and this is my list. :) At the very least, bring the training panel (which is awesome) up-to-date. Shift-ESC, one of my favorites, isn’t even on there! Good thing I discovered it via the training video!
  • CodeRush needs to do smart overwriting of closing parentheses: another one I got used to in Resharper. With the default options, there are some strange gymnastics required to work around the automatically inserted closing parentheses. For example, attempt to type this line:

    someStringBuilder.Append(someEnumValue.ToString());

    When you type the opening parentheses for ToString, a closing parentheses is added, so now both are in place. However, depending on the strength of your habits, you’re likely to add an extra parentheses or two. Even if you stop, you’ve now got to press End or cursor to the right before pressing enter. (Unless you have “Smart Enter” turned on, which is what I did, but that’s not the default.) Resharper recognizes that there are no more parentheses needed, and automagically overwrites them as you type. I don’t like that with CodeRush I have extra mental gymnastics to examine the parentheses situation at the end of some lines. Again, familiarity would probably make it better but I think Resharper’s solution is a good one: low impact to newbies without sacrificing power. I’m sure someone can point out that I’ve missed an option or “the right way” to type this line, but that’s exactly the point: Resharper doesn’t make me learn a new way to type code (or ship with options that do).

  • The refactor hotkey should have more consistent behavior. You can assign a keyboard shortcut to the context-sensitive refactorings, which is great. The problem is that if there’s only one available refactoring for the current context, it’s automatically performed. For someone relatively new to the product, I’d prefer to see what’s going to happen first. Maybe I’ll change my mind as I get more familiar. Nevertheless, I’d make this an option and default it to the “just pop up, don’t perform” setting to accomodate newbies.
  • I’m getting used to using CodeRush’s QuickNav, which is equivalent to Resharper’s CTRL-N (Go To Type) or CTRL-SHIFT-N (Go To File). The only thing I’d like is being able to change the search scope more easily with the keyboard. I still feel like I could get to ANY file/type quicker with Resharper because I never had to reach for the mouse. Also, Resharper’s list updates as you type, making everything feel snappier.
  • Better availability for some refactorings. Want to “safe rename” a structure? Too bad, it’s not there! You’re stuck with Visual Studio 2005’s icky implementation, or you’re totally out of luck in VS2003.
  • Resharper does background compilation, which lets you see any compile-time errors as you type and improves intellisense. I’m less of a rabid fan of this than many Resharper users, but it is cool. It’s yet another feature that’s less necessary if you work primarily in VS2005, but is killer for VS2003 users.
  • Show me unused variables and unreachable code. Resharper does this.
  • CodeRush lacks brace auto-completion, though it does auto-complete parentheses and square brackets.
  • CodeRush needs contextual help for the options dialogue. There are a ton of options, and this is most definitely a Good Thing for this type of product. As you’d expect, many of these are not self-explanatory. The only way to figure them out, right now, is to experiment.

I’ll continue to keep an eye on CodeRush. Its got real potential, it’s definitely breaking new ground in the UI, but for me it’s not a Resharper replacement. My quick and dirty summary of the differences is this: If you spend most of your time writing lots of brand new code, CodeRush’s templates are very compelling. If you spend lots of time integrating your work with existing code, particularly code written by other people, Resharper’s analysis tools are the bigger win. Typically at my day job, I’m in the latter camp. If you’re an Eclipse zealot who is occasionally forced to work with .NET, you’re going to find Resharper strangely familiar. (I’m not, but I work with a few.)

I was surprised to see people on the DevExpress newsgroups reporting that CodeRush and Resharper can peacefully coexist. Sounds dangerous, but the possibility of having the best of both worlds is so compelling it’s worth a shot.

ReSharper vs. CodeRush: Part 1

Being as it’s the longest day of the year, I’d say I have time for a blog post! ;P

I’ve been a happy ReSharper user for almost a year now, but several recent events spurred me to investigate CodeRush:

  • The DevExpress booth was just down the aisle from Vault at TechEd, and their demos were impressive.
  • Scott Hanselman dropped by the Vault booth one afternoon and gave a passionate demonstration of why CodeRush rocks. And I do mean passionate.
  • JetBrains recently released version 2.0 of ReSharper, in which they introduce support for Visual Studio 2005, which is good. What’s not so good is that they’ve also introduced a bunch of stuff I don’t need, and the product has gotten a bit top-heavy. I basically wanted Resharper 1.5 with support for Visual Studio 2005. Instead I got unit testing (TestDriven.NET works fine already) and ASP.NET support (which is probably a God-send for many, but not much use to me in my day job working on Vault). It’s still a fine product, but for my personal use these new features weren’t worth the performance hit.

So back at the office on Monday I uninstalled ReSharper 2.0 and installed the newly released CodeRush and ReFactor! 2.0. My impressions after a couple of days of use:

  • I really miss ReSharper’s usage search tools. Being able to move up and down the call graph with a keystroke or two is really nice, and very conspicuously absent from CodeRush. If you spend a fair amount of time reading other people’s code, this is huge. With everything else CodeRush does, I can’t fathom why this feature is missing. In Visual Studio 2005 it’s tolerable, because Visual Studio has its own (admittedly lame) implementation of this, but I’m thoroughly crippled in Visual Studio 2003, where I still do a fair amount of work. I could go back to ReSharper for this reason alone.
  • CodeRush’s stack-based “markers” (similar to VS.NET’s bookmarks) are tremendously cool. This is the way bookmarks should have been implemented. I can’t believe how often Shift-ESC (“collect” the top marker and paste) is useful.
  • I miss the extra syntax highlighting options ReSharper gave me. This sounds trivial, but I got used to fields, locals, and parameters being different colors, and it made reading code easier.
  • CodeRush’s templates are really, really powerful. They definitely have the edge over ReSharper here. This is how Visual Studio’s snippets should have been implemented.
  • The selection-based “embedding” CodeRush features (e.g. embed the current selection in a region, embed the current selection in a try…finally) just don’t work on my installation. The shortcut keys do nothing. I’m not sure why. I can’t find anybody else reporting a similar problem, so I’m assuming it’s a peculiarity of my environment. I’ve installed and uninstalled several versions of ReSharper before installing CodeRush, for example.
  • ReSharper has better documentation. I keep a single page hard copy of ReSharper shortcut keys on my desk, and there’s no CodeRush equivalent. CodeRush has a “training panel” which pops up context-sensitive shortcut key possibilities within Visual Studio, but it’s incomplete. There are a number of things I caught at TechEd demos and in DevExpress’s training videos that don’t show up in the panel. The training videos are cool, but what I really want is a comprehensive list of the keyboard shortcuts, even if it’s huge. Or at least bring the training panel up to date. With ReSharper I can also go into Visual Studio’s keyboard options and see all the assigned keboard shortcuts. It’s understandable that CodeRush didn’t go this route due to the (very cool) context-sensitive nature of its shortcuts, but it adds to the feeling of not really knowing what’s possible.
  • Not yet being used to CodeRush, some features are suprising, if not downright frustrating. For example, yesterday I hit tab several times expecting to, you know, insert tabs in the source. Instead, the first tab behaved as expected. Tabs 2 though n jumped me to various (apparently significant in some way) locations in the file I was editing. I’m sure this was me failing to understand some contextual rule, but it was maddening for a newbie. It took me a minute or two to figure out how to just insert the #$%!-ing tabs.
  • CodeRush’s complexity metrics are cool. I’m a big believer in Simpler Is Better, and having easily accessible, concrete measurements of a routine’s complexity is awesome.
  • CodeRush’s huge array of built-in shortcuts are cool (as in, they demo well), but not tremendously useful, in my experience. It’s just not that hard, for example, to type “private bool x;[enter]” rather than “vb x[enter][enter]“. Maybe I’ll feel differently after a few weeks’ use when those shortcuts are second nature.

I’ll probably stick with CodeRush until my eval expires at the end of July, to fully give it a chance. Unsuprisingly so far, I prefer the product I’ve got months of experience with.

The stuff you have

From Raymond Chen’s non-tech entry today:

I knew a guy once who claimed that you didn’t really own anything that you couldn’t carry at a dead run while firing an AK-47 over your shoulder.

For some reason this made me laugh out loud. It reminds me of the never-ending battle I have with my wife over stuff we should keep. I’m apparently significantly closer to Raymond Chen’s acquaintance on the spectrum of ownership philosophy.

Every time I find myself cleaning the house, this line from Fight Club leaps to mind:

The stuff you own ends up owning you.

Now I’m not prepared to make any insightful comments on our consumeristic society, but I do believe that you actually have to spend time on maintenance and organization of the “stuff” that you have. And you have to make a decision how much of your life you want to spend on maintenance and organization of your stuff. I sometimes joke that I was not aware, when I married my wife, that I was also committing to a lifetime storage contract for a large number of rubbermaid boxes full of mysterious, but apparently important, “stuff.”

If you “have” something, but you don’t know where it is or whether it works, do you really have it? I think not. My wife’s opinion differs. (In her defense, there is also a significant portion of the basement dedicated to old computer parts. I think there are at least 4 14-inch CRT monitors down there. But hey, they all work.)

My desire for a well-organized basement is in lock-step with my desire to have clean, well-organized code. The stuff in your basement is like a seldom-used API: if nobody’s sure where it is or how it works, and there’s no documentation, it’s virtually worthless. A basement full of mislabeled (or unlabeled) boxes is like an undocumented library written by an ex-employee 7 years ago: almost useless and taking up valuable space. Obviously code doesn’t take up space in the same way rubbermaid storage containers do, but the concepts of code cruft and basement clutter are closely related in my mind. It we’re going to keep it, let’s keep it in a state that’s useful in some way. And when we add new stuff, let’s make sure that’s also organized in such a way that we truly have it. Too much code, too poorly organized, can end up “owning you” in a very real sense.

So yes, honey. I’ll refrain from throwing out the Bed Bath and Beyond coupons we got in the mail. I’ll put them in the ever-burgeoning “to be thrown away in six months” pile.