Category Archives: Link/News

New C# 4.0 How-To Review

Of course I  think you should go get my book, but so do other people. :) Here’s a recent, good review of the book: C# 4.0 How-To by Ben Watson.

Some excerpts:

There were a couple things about this book that really compelled me.  The format (this is a first How-To book by Sams for me so I assume it goes across the board) was very much like a focused blog.  It was broken up into small posts about each topic.  The other thing that compelled me was the amount of code samples.

That is definitely the style I was going for and I don’t know if anyone else has picked up on that yet.

Instead, this is a book that you set on your desk and put post-its and dog ears for key sections that you use and use and use before you put the pattern to memory.

I myself use the book in that manner whenever I need a refresh on how to accomplish something.

Go get it from Amazon or B&N or other great bookstores everywhere!

First Bing.com commercial

Working on Bing.com for the last 9 months or so has been exhilarating. Finally, we can show the world the great stuff we’ve been doing. Here is (I think) the first TV commercial about Bing.com, running as of today.

I kissed Google goodbye more than a year ago and haven’t looked back. I think once people start using Bing, they’re going to do the same.

New apps and features from Live Search

I’ve been meaning to highlight a few of the cool things we’re doing in Live Search. I don’t have any direct involvement in the development of any of these—I just think they’re cool.

Answer Suggestions for IE8

IE8 is awesome, so go get it. Live Search has these things called Instant Answers where it can respond with succinct answers to your question, rather than just web pages that may have the answer. Good examples are weather and numeric conversions—you just want to know the answers, not necessarily follow links to find it.

You get normal search suggestions of course, but the cool thing is that the display of the instant answers is built right into IE8. You can type into the search box and have the answers returned right in the drop down as you type. Here are some samples:

Weather:answers_ie8_2 Solve math equations:

answers_ie8_1 There are a whole lot more kinds of answers. Maybe someday I’ll detail them.

Live Search Suggestions for Firefox

Firefox users haven’t been left out either. While there isn’t a full instant answers integration, Firefox does support search suggestions. You can download the plugin from the Firefox plugin directory.

firefox_live

Live Search for Windows Mobile

This is something I think really needs more publicity. I have a Samsung Saga i770, which I love. One of the first things I put on it was Live Search Mobile.

First of all, this thing has had speech recognition built-in since way before Google’s similar tools.

Easy to use, and optimized for your phone

It can easily find directions, gas prices, movies, traffics, maps, local businesses (by categories), and general web info. I use this app all the time.

There is custom software you can install for both Windows Mobile and Blackberry. It will work on the web for any other mobile phone that can get on the Internet.

And, by the way, it supports auto-suggest as well.

On your phone, you can go to wls.live.com to get it.

Related links:

NDepend: A short review

NDepend is a tool I’d heard about for years, but had yet to really dive into recently. Thanks to the good folks developing it, I was able to try out a copy and have been analyzing my own projects with it.

Here’s a brief run-down of my initial experience with it.

Installation

There is no installation file—everything is packaged into a zip. After running, I was greeted by a project selection screen, in which I created a new project and added some assemblies. NDepend main screen

Analysis

Once you have all the assemblies you want to analyze selected, you can run the analysis, which generates both an HTML report with graphics, and an interactive report that you can use to drill down into almost any detail of your code. Indeed, it’s almost overwhelming the amount of detail present in this tool.

One graph you see almost immediately is Abstractness Vs. Instability.

Abstractness vs. Instability

This is a good high-level overview of your entire project at the assembly level. Basically, what this means is that assemblies that are too abstract and unstable are potentially useless and should be culled, while assemblies that are concrete and stable can be hard to maintain. Instability is defined in the help docs in terms of coupling (internal and external), while abstractness is the ratio of abstract types to total types in an assembly.

This is followed by the dependency graph:

Dependency graph

After these graphics come lots of reports that dig into your code for all sorts of conditions.

For example, the first one in my report was “Quick summary of methods to refactor".” That seems pretty vague, until you learn how they determine this. All the reports in NDepend are built off of a SQL-like query language called CQL (Code Query Language). The syntax for this is extremely easy. The query and result for this report are:

NDepend_RefactorMethods

With very little work on my part, I instantly have a checklist of items I need to look at to improve code quality and maintainability.

There are tons of other reports: methods that are too complex, methods that are poorly commented, have too many parameters, to many local variables, or classes with too many methods, etc. And of course, you can create your own (which I demonstrate below).

Interactive Visualization

All of these reports are put into the HTML report. But as I said, you can use the interactive visualizer to drill down further into your code.

The first thing you’re likely to see is a group of boxes looking like this:

NDepend_Metrics

These boxes show the relative sizes of your code from the assembly level down to the methods. Holding the mouse over a box will bring up more information about the method. You can also change the metric you’re measuring by—say to cyclomatic complexity.

Another view, perhaps the most useful of all is the CQL Queries view. In this, you can see the results from all of hundreds of code queries, as well as create your own. For instance, I can see all the types with poor cohesion in my codebase:

NDepend_Cohesion

In this view, the CQL queries are selected in the bottom-right, and the results show up on the left. The metrics view highlights the affected methods.

Creating a query

Early in the development of my project, I named quite a few classes starting with a LB prefix. I’ve changed some of them, but I think there are still a few lying around and I want to change them as well. So I’ll create CQL query to return all the types that begin with “LB.”

   1: // <Name>Types beginning with LB</Name>
   2: WARN IF Count > 0 IN SELECT TYPES WHERE 
   3:  NameLike "LB" AND     
   4:  !IsGeneratedByCompiler AND 
   5:  !IsInFrameworkAssembly     

NDepend_LB That’s it! You can see the results to the right. It’s ridiculously easy to create your own queries to examine nearly any aspect of your code. And that’s if the hundreds of included queries don’t do it for you. In many ways, the queries are similar to the analysis FxCop does, but I think CQL seems generally more powerful (while lacking some of the cool things FxCop has).

 

VS and Reflector Add-ins

NDepend has a couple of extras that enable integration of Visual Studio (2005 and 2008) and NDepend and Reflector. When you right-click on an item in VS, you will have some additional options available:

NDepend_VSPlugin1

Clicking on the submenu gives you options to directly run queries in NDepend. Very cool stuff.

Summary and where to get more info

If you are at all interested in code metrics, and how good your code is behaving, how maintainable it is, you need this tool. It’s now going to be a standard part of my toolbox for evaluating the quality of my code and what parts need attention.

If you’re using NDepend for personal and non-commercial reasons, you can download it for free. It doesn’t have all the features, but it has more than enough. Professional use does require a license.

One of the things I was particularly impressed with was the amount of help content available. There are tons of tutorials for every part of the program.

I’m going to keep playing with this and I’m sure I’ll mention some more things as I discover them. For now, NDepend is very cool—it’s actually fun to play with, and it gives you good information for what to work on.

Links:

Google Chrome – the Good, Meh, Ugly, and This Means War

I just read all about Google Chrome, their new open-source browser, in the comic they put out. No download link at this time, but I’m sure it’s coming. My initial thoughts:

The Good

  • The JavaScript changes seems to make sense. The better garbage collector and speed improvements can’t hurt.
  • The free API to download lists of malware or phishing sites is pretty nice.

The Meh

  • UI changes. Making each tab its own browser entity and putting controls in each tab? That’s it? So what!
  • Some of the search enhancements are interesting, but I don’t think that anyone will care that much in the end.
  • Showing most popular pages…meh
  • Unclear on the plugin model. Will they have their own? Will they run ActiveX (they imply yes). How about Firefox plugin compatibility? All we need is yet another API for writing plugins.

The Ugly

  • A new process for each tab? Are you serious? I understand that it’s (maybe)the only way to completely isolate web pages from each other, but given how many pages some people have running, that means an extra 50 processes on the system. That’s a lot of resources. I know their idea was to consider each web page an application, and of course each desktop application is its own process, but I don’t think we actually treat most web pages like applications. We create new browser tabs and switch pages with wild abandon. Most web sites are NOT applications–they’re reference. They’re just books open to 50 pages at once. (Was process isolation really a problem that needed solving? I almost NEVER have runaway tabs in IE7)
  • Proprietary JavaScript hooks. Sure, it’s open source, but they’re still building things into their version of JavaScript that only work with their browser.

This Means War

  • First front: SilverLight. Gears seems to be a direct assault on the concept of .Net and SilverLight. The technology and scope are different now, but I think ultimately they’re going after the same target: having the rich-client experience in your browser on multiple OSes/browsers.
  • Second front: Firefox: the only people who are going to download Chrome or even understand what it is are the people who use Firefox. If Chrome succeeds, it will be at Firefox’s detriment. Thanks for playing.

Overall, I felt a big “meh” after reading the comic. While many of the ideas are interesting, overall, I don’t see a compelling reason to switch. I’ll try it out when it becomes available, and my opinions will probably change on some things, but Google is going to have to do a lot more to overthrow IE. Maybe their purpose really is to just throw ideas out there and see what sticks, what gets integrated into competing products, etc. We’ll just have to see what happens next. It’s going to be a fun couple of years!

(P.S. Also, please everyone, especially media, start mocking Chrome for it’s “p%%n mode” just liked you mocked IE.)

GeoEye supplying imagery to Google

My soon-to-be-old-company just announced a deal to give exclusive imagery to my-soon-to-be-rival. Sweet! I am a little disappointed Microsoft didn’t get it, but I don’t know any details of how the deal happened.

The GeoEye-1 satellite will be the highest quality commercial satellite out there when it launches next week. I am a little sad I’ll miss the launch party (my last day is the 2nd of September), but the date is what it is.

Fans of LEGO: BrickFair is coming to DC this weekend!

If you are in the DC area, you must attend the BrickFair LEGO convention on its public days this weekend. The models here will be amazing. There will be over 12,000 sq ft of convention space. Bring the kids. If you don’t have kids, bring yourself–it will be worth it.

I was going to enter a large-scale creation of my own, but sadly ran out of time with dealing with new job, moving, etc. I’m still going to go, though.

When: Saturday, August 30, 2008 – Sunday, August 31, 2008 11am – 4pm

Where: Sheraton Premier at Tysons Corner

More info: BrickFair Website

Pictures of the 2006 event: http://www.brickshelf.com/cgi-bin/search.cgi?q=brickfest+2006&stype=dfc

Be there AND be square