Mauro 的个人资料Taming the Jungle照片日志列表 工具 帮助

日志


1月27日

Coding Standards & Tools

I’ve have always used very strict coding standards, similar to what Steve McConnell preaches at his classic book, “Code Complete”. The main problem with those standards is that they require some manual labor to continuously review the code, which makes them somewhat difficult and expensive to enforce with a large team. Not that I don’t think you shouldn’t enforce them – I’ve always did it in the projects that I managed directly. But as a consultant it is always a hard sell, for the need of continued reviewing.

I’ve applauded Microsoft when they added “Code Analysis Tools” (a.k.a. FxCop) to Visual Studio 2005. Those tools would automatically verify several good coding practices. That was certainly a step in the right direction, but it didn’t check several things I deem important such as the complexity of the code inside methods, to name just one.

Anyway, Microsoft is definitely moving in the right direction along this path. With Visual Studio 2008 they brought in more options in the “Code Analysis Tool”, one of my favorites being checking for try/catch statements that don’t specify the type of the exception being caught. In Visual Studio 2010, Microsoft also included a tool that allows you to see dependencies in your code (“what calls what”), as I blogged about before (http://maurosjungle.spaces.live.com/blog/cns!F3CEB0849B03B6CC!539.entry).

Despite all that, I always felt that something was missing and still toyed with the idea of writing a tool myself (as if I had the time…). Not anymore. Last week I found out a tool that is really a dream come true: NDepend (http://www.ndepend.com/). First, it has a comprehensive and visual set of tools that allows you to see “what calls what”. Then it spits out a very detailed report, along the same “party line” that I myself always preached and then some.

But the best part is that, after analyzing your code, it sets up a database and implements a SQL-like query language that really allows you to do your own queries, in case their own are not good enough! (well, they never are – everybody has his/her own quirks). For instance, this query checks if the size of the instance is too big:

WARN IF Count > 0 IN SELECT TOP 10 TYPES WHERE SizeOfInst > 64 ORDER BY SizeOfInst DESC

Last but not the least: it’s a small (7MB) download, it occupies 17MB after unpacked and it doesn’t need to be installed, which in my opinion speaks volumes about its own quality. They could have written an .msi installer but it seems that they didn’t on purpose to send a silent message to their audience. You see, it’s like a Ferrari, it does not come with an automatic transmission. If you really want an automatic transmission, well, then you don’t belong. Go buy a Mustang.

It’s an amazing tool, I just scratched the surface. BTW, some features like the query engine are only available in the “Pro” version, the free demo doesn’t have them.

1月12日

Windows 7 First impressions

I’ve been using the Windows 7 build 7000 public beta for a few days and I am quite happy so far. It recognized *all* the hardware in my Satellite A205-S5825, a 1-year old computer, including things like the touchpad that gave trouble to both Vista and Windows 2008.
 
Although the computer runs x64, I installed the 32-bit version so as to compare it better with the other 32-bit OSs I run in the same machine. I replaced the copy of Vista I had there and left Windows 2008 Enterprise Server.
 
After the installation the OS selection menu didn’t show up any longer so I could not boot Windows 2008. I then run VistabootPro, a utility I used to recover from a similar situation after I wanted to make Vista coexist with XP. Not only it didn’t work, it made all OSes disappear, including the fresh copy of Windows 7. I then booted from the Windows 7 DVD and selected the “recover” option. It did find both OSes and set up a boot menu with both options.
 
Windows 7 seems to be everything Microsoft promised with Vista but failed to deliver: it boots fast, uses much less resources than Vista, UAC is much less intrusive so I can live with it turned on. The OS seems to be more responsive, for instance I no longer see a long leg after I open Windows Explorer. Although it’s a beta, it already looks better than the first retail version of Vista. It looks like Microsoft got it right this time.
1月8日

Windows 7 beta available

Microsoft released yesterday to its beta testers (at http://connect.microsoft.com) a new version of Windows 7. I am already downloading the multi-gigabyte package.
 
This is a much-anticipated version because of a recently non-official leaked version that got good “reviews” on the Web, “unofficial” and official such as this one at CNET: http://news.cnet.com/8301-1001_3-10134184-92.html.