Friday, October 13, 2006
Not enough people know about the code definition window in Visual Studio 2005. I see them trying to understand code by getting editor tips on the classes and functions they see in use:
A reasonably clever trick is to use Ctrl+Shift+Space to get parameter tips for the function:
But the tips are transient, they go away when you use your mouse and try to do some work. So most people fall back on good old Go To Definition:
Sure, this isn't transient, but it leaves you sitting in another file and needing to flip back and forth from file to file when you're just trying to understand what a particular function call does. What I like to use in this case is the code definition window. It's on the view menu:
And here's what it gives you:
It also works to show you the code for a function you're calling. Once it's open, just click on the thing you want to see in the code definition window:
Once you get in the habit of just glancing down to the bottom of the screen to get a little more information, you'll wonder how you ever did without it.
Thursday, October 12, 2006
Here's an article on static code analyis that makes some nice points. I love the title: I’m not in denial, I’m in a hurry. It can be tough, at the end of a project, to find the time for that tidying up that you once thought there'd be time for. Better to get the comparison of what you're doing to best practices as you go along. In fact, every time you build your app. Then you'll know where you stand.
Wednesday, October 11, 2006
One of the things I do for many of my clients is code review. This comes in two flavours. The first is where we all pile into a room with a projector and someone walks us through the code while we ask questions. Sometimes as a result of this the original author has to go away and rewrite bits of the code, but it's just as likely that the outcomes will be everyone understanding how something works, or knowing what there is in someone else's part of the application. The second is less interactive. I read over code and point out bad, dangerous, sloppy, or hard to maintain code. This might be hardcoded error messages in a multilingual application, or non parameterized dynamic SQL, or poor object orientation, or any one of hundreds of other things. Often I point it out not to the author of the code directly, but rather to the author's manager. Or in at least one case, their former manager. (As in, now that we got rid of this person, can you tell just how much mess he left behind?)
Now, if you are thinking of going to Team Systems, let me give you another reason to do so. It can automate a lot of these types of checks. For example, here's a really quite poor little class:
Public Class Company
Private networth As Integer = 0
Public name As String
Private foundingdate As Date
Public Sub New()
When I run static analysis against this, in no time flat it points out:
Running Code Analysis...
C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\FxCopCmd.exe /o:"bin\Debug\Information.dll.CodeAnalysisLog.xml" /f:"bin\Debug\Information.dll" /d:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727" /r:C:\Program Files\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules
MSBUILD : warning : CA1020 : Microsoft.Design : Consider merging the types defined in 'Information' with another namespace.
MSBUILD : warning : CA2209 : Microsoft.Usage : No valid permission requests were found for assembly 'Information'. You should always specify the minimum security permissions using SecurityAction.RequestMinimum.
MSBUILD : warning : CA2210 : Microsoft.Design : Sign 'Information' with a strong name key.
MSBUILD : warning : CA1014 : Microsoft.Design : 'Information' should be marked with CLSCompliantAttribute and its value should be true.
C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\Information\Information\Class1.vb(6): warning : CA1805 : Microsoft.Performance : Company.New() initializes field networth of type System.Int32 to 0. Remove this initialization as it will be done automatically by the runtime.
MSBUILD : warning : CA1823 : Microsoft.Performance : It appears that field 'Company.foundingdate' is never used or is only ever assigned to. Use this field or remove it.
MSBUILD : warning : CA1051 : Microsoft.Design : Make 'name' private or internal (Friend in VB, public private in C++) and provide a public or protected property to access it.
MSBUILD : warning : CA1823 : Microsoft.Performance : It appears that field 'Company.networth' is never used or is only ever assigned to. Use this field or remove it.
Code Analysis Complete -- 0 error(s), 8 warning(s)
Done building project "Information.vbproj".
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
Meaningless initializations, unused variables, public member variables... they get found. It's a great start.
Tuesday, October 10, 2006
Are you ready?
It's time to launch Office, Vista, and Exchange in Canada. Five cities get a large version of the all day event, with business, IT pro and developer tracks, and seven get IT pro and developer talks only. It starts in late November and goes on until January. Registration is free and these things usually full up fast, so register now.
Monday, October 09, 2006
I've been messing a lot with time zones lately, planning my trips to South Africa, Spain, and Denmark, along with flight connections through other countries, and trying to be sure that I correctly map the local times people tell me with the Eastern times I need to enter in my Outlook calendar. As part of that I found a neat time zone map at http://www.travel.com.hk/region/timezone.htm. Now time zone maps are not exactly hard to come by, but this one gave me some interesting insight.
Until I found this map I believed, in a vague never-bothered-to-check way, that Newfoundland was the only place whose time zones differered by half an hour rather than an hour from the neighbouring zones:
But this map uses that hash pattern to indicate the not-an-hour timezones, and so for the first time I noticed there are other places that do this too:
It's all over the place! But I wonder if people on the other side of the world would get the Canadian joke: The World Will End at Midnight! 12:30 in Newfoundland.
Sunday, October 08, 2006
I was looking forward to next year's Tech Ed USA for more than the usual reasons we look forward to a Tech Ed. You see, it was going to be in New Orleans, and I've never been there. Everyone said it was a place you really should see, and here was my chance to both see it and somehow feel like I was doing a good deed by contributing to the economy. But that's not how it's going to be, apparently, not in 2007 anyway. (Story on bink.nu) It seems the airlines haven't bounced back yet in terms of allocating capacity to the city, so Tech Ed 2007 will be somewhere else. Any chance they'll consider Toronto?
Saturday, October 07, 2006
Confused about what .NET 3.0 is and is not, and what the next set of libraries after 2.0 will be called? Here's a pretty comprehensive summary from Julie Lerman that lays it out for you.
.NET 3.0 is.NET 2.0 plus the four new components [WPF, Cardspace, WCF, Workflow]. Those four core technologies are called the ".NET 3.0 Components".
The four new components were developed as part of the Vista effort but are so cool that everybody wanted them to be available downlevel, which they are to varying degrees. Julie also gets into Orcas, Atlas/Ajax, LINQ, and what works with what and when (roughly) you'll see it. Check it out.
Friday, October 06, 2006
Airports, like software, need to be tested before they're released -- or I guess for an airport, you'd say opened. That's why the Greater Toronto Airports Authority, which operates Toronto Pearson International Airport (YYZ), is asking for volunteers to come to the airport on the morning of Oct 28th and wander around like they were trying to catch a flight, or arrive from a flight, or whatever. Can you read that sign as you head down the elevator? Is it obvious that you are not at ground level and need to find an elevator to get to ground level? Is this hallway really wide enough when two planes arrive at once and 400 people are walking through it? It's not like there wasn't any thought put into that sort of thing in advance, but before you open the doors, testing is a really good idea.
If you live in the Greater Toronto Area and want to tell your grandchildren you once beta tested an airport (perhaps the fact that you parked and ate at an airport for free will excite them more) then head on over to http://www.gtaa.com/airportvolunteer/ and sign up. Apparently there's some sort of souvenir in it for you, and you'll get to see the new parts of the terminal months before they open. Go for it!
© Copyright 2022 Kate Gregory
Theme design by Bryan Bell
newtelligence dasBlog 2.3.9074.18820
| Page rendered at Saturday, November 26, 2022 8:24:17 AM (Eastern Standard Time, UTC-05:00)
On this page....
Pluralsight Free Trial