|
LATEST POSTS
Friday, October 12, 2007
Holiday in the Bahamas today but not in Canada. Which means I'm working while my daughter plays XBox behind me. So I'm going to vent my frustration on #regions. Maybe it's my alternative upbringing but I'm not a huge fan of #regions in Visual Studio. And here is one example why: As-is, this is pretty useless to me. My first order of action when I see this is Ctrl+M, then Ctrl+L to expand the entire thing which is another step I need to do to get my work done. "But Coding Hillbilly," you say, "doesn't it help to organize your code?" NAY, I say, NAY! If you are looking through a piece of code and see a method or property belonging to the Raccoon class, how do you go about looking for it? Do you analyze whether it is a property or method, then search for the class in Solution Explorer, then epxand the corresponding region and scroll through it? Of course not, you press Ctrl+B to zero in on it with ReSharper (and I'm pretty sure Visual Studio has a semi-functional alternative). The point is, you couldn't care less where the method is in the code. There are better ways to find methods. Ctrl+B, Ctrl+Alt+B, Alt+F7, Ctrl+Shift+F, Ctrl+F12, even skipping through the methods using Alt+Up and Alt+Down. In fact, I would argue that separating them into #regions like this actually makes it harder to scan through code because of the cases where some regions are expanded and others aren't. Using ReSharper also exacerbates this problem. A common refactoring scenario is Extract to Method (Ctrl+Alt+M, if memory serves). And ReSharper isn't going to bother searching through #regions to figure out where the method should be placed (nor should it). Ditto for when I start using method names that don't exist, then Alt+Enter my way through some NotImplementedException goodness. The #regions just get in my way. I've also been in places that are so dogmatic about them, there are actually empty #regions because the coding standard says you *have* to have one for private methods, even if you don't have any. And don't get me started on nested #regions. Admittedly, they do have their place. Prior to .NET 2.0, it was nice having the designer code hidden from view. Ditto for when you implement trivial interfaces that you rarely want to look at again. IConvertible, for example. So I suppose the real point is, don't overuse them. You aren't organizing anything by compartmentalizing properties and methods in this way. If you're one of those compulsive types, write some sort of add-in that alphabetizes the members or organizes them by how long they are or something. Just don't dump them into #regions. Kyle the Regional
Wednesday, September 19, 2007
After a year and a half as the sole developer on a content management project, where my programming was limited to writing utilities to assist with data loads and *shudder* writing OScript, it is freakin' fanTAStic being on a real development team again. And an agile(ish) one at that. It's great being able to discuss nice meaty problems like how to layer your application or how best to deal psychologically with the frustration that is the VSTS merge tool. Now this being my first real agile experience (or at least the first one that's been officially called that), I'm not totally familiar with the conventions. But it seems to me that agile shops could benefit from a role that I'll call The Littlest Hobo, for lack of a better term. That is, someone who goes from project to project, lending a hand where pain points exist.
Maybe tomorrow, he'll wanna settle down.
But until tomorrow, he'll just keep codin' on
Many projects may have something like this in some regard. I imagine the scrum master plays this role for higher level impediments but I'm thinking at a more detailed level. Someone whose sole job is to pair with a developer for a morning on a task, then review code on a different project in the afternoon. The next day, he or she would examine the build process of a third project and see if it could be improved (and it always can). Another time, perhaps he or she could mentor someone on ReSharper shortcuts while they code. Essentially, I'm thinking of someone working outside of a single project who can provide an outsider's perspective during the development process. And it doesn't necessarily need to be one person's full-time job. It could be a role that is passed around among senior developers every week. It doesn't even need to be a role that is fulfilled every week either. If you have a small group, maybe one person takes it for a week, and then it stays unfilled for a couple of weeks.
The impetus for this idea was an upcoming code review. Few people will deny the benefits of a code review in theory but in practice, I've been on both sides of the review and very often, there is no "ideal" time for a code review. Often, one or both of the reviewer and the reviewee are none too pleased to be ripped away from their work even if we recognize that it is something that needs to be done. It's difficult to coordinate a review time that isn't "crunch" time on one project, let alone two (presuming the reviewer is on a separate project). That's where The Littlest Hobo could help out. This person's schedule could be almost set in stone save for the specific projects and people involved. E.g. Tuesday morning: Pair with someone. Tuesday afternoon: Review code on some project. Wednesday morning: Increase code coverage for some project. Thursday afternoon: Code review. Monday morning would be reserved for filling in the blanks where it says "some project" or "someone". Personally, I think it would be a helluva fun role. Not full-time, mind you, but once every couple of months it would be a nice break from the ol' day-to-day, doncha know. And for you nostalgic Canucks who are already singing it in their heads, here's the theme song. Kyle the Nomadic
Wednesday, August 01, 2007
Test time, kiddies!
Assume that in the image below, we are looking at a class in Visual Studio with the default font and color scheme (except using Consolas as the default font). Also assume that ReSharper 3.0 is installed.
Locate at least three things wrong with the formatting on this screen.

First correct answer wins the opportunity to tell me how the &*%$ to fix it. Hint 1: Re-installing ReSharper has no effect. Hint 2: Changing the font/color setting for Tracepoint - Mapped (Enabled) will, for whatever reason, affect the same change in the variable "mockery" in the image above.
Kyle the Bemused
** Update **
Stop with all the responses already. It's embarrassing. You'll inflate my already-ballooning ego.
The three bits of freaked out formatting are:
- The mockery variable is formatted as if it is a breakpoint. However, after testing various settings, it is, in fact, formatted as a Tracepoint. Yeah, I didn't know what a tracepoint was either.
- Line 14 is not highlighted as a breakpoint.
- Line 15 is missing the closing semi-colon and the IDE has not picked this up as an error
There are two possible solutions. The first is to uninstall Visual Studio Team Edition for Database Professionals (p.k.a. DataDude). The more correct one is to install the latest service pack for Visual Studio, of which I had none.
Friday, June 08, 2007
While I will profess my undying love of ReSharper, I do have a bit of an annoyance with its auto-closing delimiters (as explained here). I've talked before on my love of white space but it comes with a price. Whenever I type the opening parenthesis of a method, ReSharper helpfully adds the closing one. It's also smart enough to recognize when you type the closing one yourself and won't duplicate it if you do so. If you don't have a space there, that is. Here's an example. Let's assume I type the characters: "this.gethashcode(" without the quotes. Here is how it looks right after I type the (: this.GetHashCode( )
ReSharper has helpfully added the closing parenthesis and even respected my choice of using white space after opening parentheses and before closing ones. The problem is that the cursor is now situated right after the first parenthesis and I need to Right-Arrow or End my way to type the closing semi-colon. And neither key is situated in an area that lends itself to quick access on my laptop. If I type the closing parenthesis, ReSharper does not recognize that this is the same as the one it just helpfully added (the way it does when there is no whitespace). So I'm left with: this.GetHashCode( ) )
(Note: I added the space after the first parenthesis manually. It's a habit I'm hoping I don't have to break.)
There is a way around this that I haven't quite got into the habit of using. That is to take advantage of ReSharper's advanced IntelliSense. Here's what appears when I start typing GetHashCode:
At this point, I can press <Tab> and get the following: this.GetHashCode()
Plus the cursor is sitting helpfully at the end of the line. And no worries about my precious gestalt. I need only type the closing semi-colon and either ReSharper or Visual Studio will format it into the beacon to gestalt I am looking for: this.GetHashCode( );
The problem with this method is that it kind of slows me down. I find it much faster just to type "gethashcode(" than to start typing "get", search through the list for the one I want, arrow down if necessary, and press Tab. My way has more keystrokes to be sure, but does not require that I pay attention to the UI.
The habit I'm trying to get into is: rather than typing "gethashcode(", instead type "gethashcode<tab>". Theoretically, this should be easier...
Kyle the Habitual
Sunday, May 07, 2006
Couple of short miscellaneous items to balance the tome I wrote last time:
- The Start Page in Visual Studio can be customised to show your own news feed rather than the default one. Go to Tools | Options | Environment | Startup. I'm also told you can use something like http://www.feedjumbler.com to collate a bunch of your feeds together into one which you can then use as the main feed for Visual Studio. I'm feeling “sign-up“ averse today so I haven't checked out Feed Jumbler
- You can also set the number of recent items that appear on the start page. Tools | Options | Environment | General and change “items shown in recently used lists“. Note that this also changes the number of items in File | Recent Files and File | Recent Projects.
- There appears to be no way of getting rid of the Getting Started and Headlines sections.
- Have been playing with the beta of ReSharper 2.0 and love it. Type “throw new“ and it displays only available exceptions. Reference a class with no corresponding “using“ statement at the top and it is added for you. Type “using“ at the top and it displays the full hierarchy of namespaces available, not just the current level. And I've only been using it for a day. But it is uninstalling as we speak. Granted, my laptop is two years old and showing its age, but there is a very noticeable drop in performance of Visual Studio 2005. Plus I got some unhandled exceptions when working in a SQL database in Server Explorer. Tried to submit the error to help the developer folks out but that required me to sign up for something. See point 1. Regardless, when I upgrade my hardware and when they're out of beta, I'll gladly hand over $150 for it (pending a review of Code Rush).
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.
Copyright © 2008 Kyle Baley. All rights reserved.
|
|
|
LATEST POSTS
POPULAR POSTS
LINKS
BLOG ROLL
|
|
CATEGORIES
ARCHIVE
| December, 2007 (8) |
| November, 2007 (8) |
| October, 2007 (23) |
| September, 2007 (15) |
| August, 2007 (8) |
| July, 2007 (6) |
| June, 2007 (11) |
| May, 2007 (19) |
| April, 2007 (14) |
| March, 2007 (3) |
| February, 2007 (4) |
| January, 2007 (7) |
| December, 2006 (5) |
| November, 2006 (9) |
| October, 2006 (11) |
| September, 2006 (14) |
| August, 2006 (11) |
| July, 2006 (15) |
| June, 2006 (8) |
| May, 2006 (10) |
| April, 2006 (12) |
| March, 2006 (3) |
| February, 2006 (7) |
|
|
|