Category Archives: Product Review

NDepend Updated Review

Around this time last year, I published a review of NDepend. They contacted me around June and asked me to have a look at version 6. The following is my current personal opinion of this new product.

Background

After the last time I did a similar review, I pretty much didn’t continue to use the tool. What this means, is that coming back to it now, everything is new to me again. It also means that I haven’t “gotten used to” the little gripes that I had the first time round.

Also, one of the reasons that I stopped using it last time was that the windows didn’t dock (or they did, but they didn’t stay docked), so they kind of got in the way.

What’s new?

Here’s the updated features.

One or two of my gripes from the original post have been addressed. This always pleases me – even if it had nothing at all to do with my suggestion; the product is alive and being improved. Amongst the features that intrigue me most were the dependency … squares, the docking (which now works), code coverage and the VS integration changes.

Dependency

IMHO, the problem that the maker(s) of NDepend face, is that their core product is, by its very nature, used once. I come to an application and I want to see a dependency graph. I might want to see another one in a few months, but once I’ve seen a dependency graph, I’ve seen it. The way that Patrick and the team have addressed this is to add additional features that don’t directly relate to dependency. Obviously, this is a two edged sword: on the one hand, people are unlikely to buy more than one licence for a product that generates a dependency graph; on the other, if it becomes too heavy, people may not want the additional features.

The new feature on Dependency seems to be that the “Square Map” (this isn’t what it’s called, but it’s as good a name as any) is now colour coded. This certainly makes the graph easier to see, and there is a tooltip, which explains exactly what you’re seeing; so that’s all good. However, I have a few issues here. If I select that I want to see a code coverage graph, then I definitely get one:

ndepend2_1

So, what this tells me it tells me (by default) is that the large squares are the more complex or larger methods, and the red ones have test coverage. What it apparently actually tells me is that grey squares can’t be analysed, green have test coverage and red do not. I would have included a screenshot to this tooltip, but it’s very elusive.

The tooltips have been improved, but they still get in the way, and it’s hard to know how this could be improved.

Next, I can select a different graph, and this seems to change the colour; however, the tooltip remains the same, so it’s difficult to know exactly what it has done. My suspicion is that it’s altered one axis of the graph from coverage to, say, method size.

Double clicking the squares takes you to the relevant code, and there is a drop down menu that does allow to you change what’s being shown. Getting back to dependency, one of those options is “Methods calling me”. It’s a quick way to identify the most used areas of the system.

With a bit of playing, I presume I could produce a graph showing the most popular methods with no test coverage:

(from m in Methods 
where m.PercentageCoverage == 0
orderby m.Rank descending, m.NbMethodsCallingMe descending, m.NbLinesOfCode descending 
select new { m, m.Rank, m.NbMethodsCallingMe, m.NbLinesOfCode }).Take(100)

It is, admittedly difficult to tell whether this works or not, but it seems to at first glance.

Code Coverage

Since the last time I reviewed this, I’ve started using VS Premium, which means that I can use the code coverage analysis in NDepend. The process for this is a little cumbersome: export the coverage file from VS and then import into NDepend. There seems to be some issues with this; for example, when I ran the analysis:

Ndepend2_2

But:

Ndepend2_3

I clearly have code coverage – VS says so:

Ndepend2_4

My suspicion is that NDepend has a problem with any solution containing non-C# files. Running this against a C# only project results in:

Ndepend2_5

Even with this, the default charts seem to have some… issues:

Ndepend2_6

However, as I’ve come to expect from NDepend, the power is not in the default charts, but in the analysis that you can do with the default and custom queries; for example:

Ndepend2_7

I can then start messing with the figures, and ordering and extracting, etc…

Having said all that, it’s very disappointing that, once it apparently sees a VB.NET project it just gives up and goes home.

Visual Studio Integration

One of my favourite plug-ins for VS is Stop Build On First Error. If you have a solution of any size or complexity, it’s an absolute must. NDepend seem to have … err… borrowed this idea and incorporated it. Since I have this plug-in anyway, it does give me a reason to always keep NDepend around.

Conclusion

I haven’t been using this over the past few months, so I suppose the question is: will I because of these changes?

I probably would, but I can’t. The main project that I work on contains VB code, which I believe is stopping me from using the code coverage analysis, and I feel this, combined with the dependency data is the main feature. I think NDepend is now useful enough to keep installed; however, it’s not really something to use on a day-to-day basis. If you come to a new code-base, or you’re refactoring then it’s definitely worth having. It seems to be a product in development, so I imagine it will continue to improve.

I suppose if I could request anything for the next version it would be that it either works with, or just ignores VB code. And the killer feature would be if it would work with a SQL DB, too. Identifying what tables are used where in a solution would be excellent.

Now using Visual Studio 14 CTP

I was previously using VS2013, but after running 14 just once, I saw no reason to go back. I thought I’d jot down some notes on my experience of this update. A quick caveat though: VS14 is a CTP, so if you’re thinking about using it to maintain the code for your nuclear reactor, then probably don’t.

Faster

Okay, so this is my perception. I’m working on a personal project on the train to and from work. VS14 loads almost a station before VS2013 did. Now, if that’s not a fair and accurate benchmark, I don’t know what is!

Debugging

One particularly cool feature is that you can see the CPU execution time for previous statement during debugging. Typically, this is a meaninglessly low figure of x milliseconds; but occasionally it shows an unexpectedly high figure.

This can be dangerous, because if you saw a statement that took 30ms, which executed once when the user presses a button in your app, you might think nothing of it… unless all the other statements take 2ms. At this point, you might spend 1/2 hour trying to work out what the bottleneck is. You might even find it: and speed up your app by 28ms.

Refactor

Shift-Alt-F10 on a non-existent method now gives you a preview of what it’s about to do. Possibly not the most useful feature in the world to be honest, but if you want a field and it tries to create a property then you know (obviously, if you’d just read the description of what it will create, that would also tell you). The Using statement tells you where it will create the statement:

preview

However, I can’t find any way you can affect the preview – which would have been a nice feature; for example, say you wanted to create a public field rather than internal; or, you wanted to define a constant and give it a constant value.

Light bulbs now appear next to potential refactoring. One example was an unnecessary using statement I had. It had turned grey; I didn’t understand this until I noticed that a light bulb had appeared next to it, which helpfully informed me that I didn’t need the statement.

Also, code analysis seems to be an opt-in thing now – rather than the previous version which seemed to constantly kidnap whichever tab it was on.

It is still a CTP

Line numbers were turned on in VS2013 and were off in 14.

Windows 10 – The Return of the Overrated Start Menu

Yesterday, for the first time, I saw Windows 10. I set it up in a VM inside Win 8. The following post in a combination of conjecture, opinions, and under researched hearsay.

First, let’s think about what I just said: I’m running a later version of Windows inside an earlier one. And it works.

9

Don’t mention 9! I mentioned it once, but I think I got away with it.

Start menu

The start menu never went anywhere for Win 8. You just press the Windows key and you’re in it (although it was more of a screen than a menu). Anyway, MS finally bowed to pressure, and it’s back:

start1

Looks good eh? Actually, after restarting it seemed to gather its thoughts:

start2

Anyway, as I understand the intention, if I were running this on a tablet, I’d be able to see the Win 8 start screen when I pressed the Windows Key. I can’t test that on a VM and, if I could, I’d be surprised if it worked properly for the TP.

Multiple Desktops

This is a neat feature: the ability to maintain more than one desktop. The way this appears to work is that you can open apps into any desktop, and then just switch between desktop to access them, or access them from the taskbar, and Windows will select the desktop they are on.

desktop

You appear to be able to maintain as many desktops as you like.

Search

There is a large magnifying glass on the taskbar, which brings up a huge, unwieldy, blank box with a small text search. Maybe this will be back on the charms bar for tablets, but the idea is that it will find stuff on your machine. It failed:

search

I don’t understand why this was separated from the start menu. Searching for, and running programs are basically the same thing. If I want to run word, I want to type “Word”; if I want to open a word document on my desktop, I want to type: “My word doc” and have it find it. Results seemed to be sporadic, sometimes it found what I expected, but generally it didn’t.

What happened to the charms bar?

It now seems to be a sub menu of each store window:

charmsbar

As I said earlier, I expect it will behave differently for the tablet and phone.

Universal Apps

These have been around for a while. They basically allow sharing of code between Windows store and Windows phone apps. As I understand it, these will now be effectively mandatory – you will have to produce a phone & store version, in the same way as you had to provide a snapped and filled version of your app.

Conclusion

The split desktop is nice, and the idea of having “One Windows” is a nice one. In fact, it’s effectively what I understood to be the driving force behind 8. It looks like it’s going to be a good OS, but I can’t see any killer features.

What I mean by that is this: imagine that you want to upgrade to Windows 10, and you put the idea to your boss. The first question they should ask is: “Why?”.

For Windows 8, the answer was simple: Hyper-V. An astoundingly useful and undersold feature.

Windows 10 doesn’t have that, and it needs it, because a lot of people are sticking on 7 and need a reason to upgrade – having the start menu back is not that reason.

Review of NDepend

Introduction and Disclaimer

I was asked around the middle of August if I would consider reviewing a product called NDepend; in exchange for which, I was given a free licence. I agreed to do this, providing I could review the product honestly and, this being agreed, what follows is my personal opinion of the software.

Conditions

I have a number of projects that I was interested in running this on. I won’t be running fair comparisons between projects to test the software; neither will I be comparing the software against other such software. This review will simply be my personal impression of how useful and easy to use this software is for the projects that I happened to use it for.

There are tutorial videos, documentation and a plethora of other resources on the web. I purposely stayed clear of these, with the exception of the 2 minute introductory video and “getting started” document described below.

Installation

Having downloaded the zip file, there are a couple of options, so I went looking and found this:

http://www.ndepend.com/docs/getting-started-with-ndepend#Part1

I had received two mails: one saying that the licence was on its way, and one with the licence and licence ID. The installation process is unnervingly fast (that is, it appeared to have done nothing):

ndepend1

But from launching VS, it clearly had done something:

ndepend2

Initial Run

The instructions state that you should attach a project to NDepend. I did this with the current project that I’m working on (my MVVM Cross game). It then gave me a few options; the Dashboard looks like this:

ndepend3

Speedwise, I have another solution with 104 projects in, and it took around 4 – 5 minutes to load. Subsequent loading of the project appears to take no additional time.

Features

Okay, so having had a play, I want to see if the product does what it says on the tin; here’s the tin: http://www.ndepend.com/features/default

There are 13 features listed here at the time of writing. Some are things such as: VS Integration, which I’m not strictly sure should count as a feature; it’s just what you would expect from a product such as this. I won’t go through all the features; however, I particularly interested in:

1. Complexity and Diagrams
2. Detect Dependency Cycles
3. Test Coverage Data

For each of these, I’ve indicated what I would like from the functionality, what the product claims, what I could find on my own, where I needed to contact NDepend (and the result), and what, in the end, is available.

Complexity and Diagrams

What the product claims: “Spot too complex code at a glance thanks to unique diagramming capabilities in the .NET world.”

What I want to see: A list of methods which are overly complex or long, in order of the length or complexity.

This seems quite a good one for NDepend; initially, I tried looking in the Metrics menu:

ndepend4

What appeared was, indeed, unique. It seems to generate a series of rectangles, the size of each representing the relative complexity of the method. I’m confident that it did identify the most complex, too:

ndepend5

My problem with this kind of display is that it doesn’t really tell you what you need to know. It looks good, you can zoom in and out, but when I first saw it, I misidentified the most complex method.

Double clicking on a square takes you to the code, as you’d expect, and your visual query remains as a tab. It also provides a little table, showing methods by complexity. Annoyingly, this doesn’t seem to be limited to my code:

ndepend6

It lets you output this to pretty much anything you can think of. All in all, pretty impressive and easily discoverable.

Dependency

What the product claims: “Detect Dependency Cycles: Get rid of dependency cycles between components to achieve higher code maintainability.”

What I want to see: A basic graph with a list of classes and their dependencies.

NDepend does offer a dependency graph. I’ve downloaded open source versions of this in the past, and even poorly implemented ones can be useful.

When you run a dependency graph, you get a very pleasant graph. You do have to do a bit of juggling with the dockable screens (I just docked them, and I’m not really sure why that isn’t the default – but they DON’T seem to stay docked after a restart!). Pressing Shift-Alt-Enter didn’t bring the graph to full size either; it simply brought my last code module to full screen.

Ndepend7

Okay – so it definitely fulfils my basic requirements; but what else does it do?

You can switch from side, to top down view. You can right click a namespace and view the methods in a namespace. The box sizes are initially based on the sum complexity of the namespace. This is changeable, and you can, for example, have them based on the lines of code. This is definitely the killer feature IMHO.

Anything it doesn’t do, or doesn’t do well? The following is a list of things that sprung to mind while I was using it:

– Double clicking a node does nothing. TBH, I wouldn’t really mind what it did – for example, you can right click and select: view internal dependency cycles, of maybe it should list the methods for that namespace.
– As the graph gets complex, there are overlapping dependency lines. On very complex projects, this basically renders this unreadable. Obviously, in such cases it may be unavoidable, but I have seen a few, where overlap is unnecessary. Maybe it would be better if the lines were straight, rather than curved?
– As you hover over the nodes in the dependency graph, very useful, context sensitive help boxes appear. However, getting to them before they fade away, as you leave the box, requires mouse dexterity of a level that I imagine Billy The Kid might have, if he were a computer programmer.

Test Coverage

To be clear, NDepend doesn’t generate code coverage data. It looked at first glance to me that it would, but it doesn’t. Having spoken to NDepend support, there are no plans for it to in the future. It will, however, import test coverage data from other applications that do. As far as I can see, all of the test coverage programs that it uses are commercial (including VS for premium and above).

At first, I was a little disappointed by this, but given that the product is called NDepend, and it does support reading coverage files, I felt a little like I was trying to judge a screwdriver by its ability to knock nails into a wall.

A Note on Usability and CQLINQ

Okay, so the UI does take a bit of getting used to, but once you start to get a feel for it, it makes sense. Each feature sparks of a new “Query Edit” window, which looks like this:

Ndepend8

Initially, this annoyed me immensely. It’s not at all obvious what it’s for, and it just kind of hovers around the screen. Basically, this just allows you to export the result of the query to HTML, graph, etc… but then I tried changing it, and realised how cool this was.

Here’s an example of the code quality query for one of my projects:

ndepend9

Okay, so I have no methods that are “too big”. But what is that? When I click the rule, I get this:

ndepend10

As I said, my initial thought was that this was just annoying, but it’s not – it’s unbelievably good, because I can do this:

ndepend11

Woah! As I type, it updates with results of the code for a LINQ query (NDepend call this CQLINQ)! I can change anything:

ndepend12

Here I have a list of all types where the code is more than 10 lines and there is a method that starts with “Create”. Okay, it’s a daft example, but the potential is limitless. Well, maybe not limitless, but I can certainly envisage other uses for it.

On the downside, the intelli-sense is a bit laboured. Ctrl-Space sometimes works, and sometimes doesn’t, and brackets seem to appear when you don’t want them to.

Oddities and Bugs?

Yes, there were a couple. The first was that while I was browsing through the list of “structures that should be immutable”, I tried to select some code that it highlighted, and was rewarded with this:

ndepend13

Because of this, it’s hard to tell precisely what it’s moaning about, but best guess it an internal .Net assembly (given that I have no structures in my project).

There was the intelli-sense that I mentioned above.

Rules

One of the reasons I never got into using Resharper was that when I turned it on, the first thing it told me was to replace a statement such as this:

MyClass myClass = new MyClass();

With

var myClass = new MyClass();

Personally (and I know people disagree with this), I consider that to be bad advice.

An example of such a rule might be that “Pure methods should be tagged with the Pure attribute”. I appear to be following this; possibly because I have no “Pure” methods in this particular project. Incidentally, here’s what the NDepend online documentation says about that rule: (http://www.ndepend.com/defaultrules/q_pure_methods_should_be_tagged_with_pureattribute.html):

ndepend14

My point is that these rules are, to some extent, a matter of opinion. Obviously, a function with fewer lines is better, and it’s good that it points out functions that exceed a certain length, or level of complexity; and it’s very good that this criteria can be changed and then save them. You can turn rules off, and they stay off, but I feel as though there should be some form of “Rule Wizard”, with a tree view where I can basically say: “Everything off”, and start from there.

Unlike Resharper, NDepend is only there when you ask it to be, and this is kind of its “Get out of jail free card” here. My functions might be 5,000 lines long, use randomly named global variables ranging from “a” to “z3” and have no comments, but it’ll only tell me when I specifically ask it to. This is a good thing, I don’t need something sitting in the background constantly tutting at me every time I miss a semi-colon; Visual Studio handles that already.

Conclusion

NDepend is a useful product.

It does, as far as I can tell, what it says on the tin (http://www.ndepend.com/features/), and then some. Unlike other VS plug-ins, I don’t mind having it there, because it’s quietly in the background.

It has at least two killer features. Both of which would make it worth the purchase price alone (around £240 at the time of writing).

Could it be better? Absolutely.

My main issue with it is the initial learning curve. It probably took me two or three hours to get an idea of what was happening, and why. That’s too long. There are lots of videos, training materials and even blog posts such as this, but it feels a little like the default is in advanced mode.

The windows, especially on my laptop screen, always seem to be in the way. You can dock them, but annoyingly they seem to constantly forget that you’ve done so.

Some time back, MS was talking about introducing a concept of Code Bubbles, but that never seemed to materialise. The display graph and popups in NDepend make me think that the devs saw the same promo videos that I did when they designed the interface. Although I’m not sure the graph quite works the way it was intended to.

In some respects, NDepend’s power seems to work against it. Since installing it, I’ve come across a number of scenarios that I would traditionally use the VS Find function, and NDepend has come to mind. I’ve started writing a CQLINQ statement and then found that I’d wasted half an hour or so. I don’t doubt that this will subside as I either use it more frequently, or stop using it as much because the novelty wears off.

Finally, there did appear to be one of two very minor bugs, such as the ones identified above.

Further discussion and addendum

It’s worth also mentioning that the response time from NDepend was very fast. Additionally, I sent this to NDepend for a review first, before posting. (I haven’t changed anything as a result of this – apart from this section, and a change to the wording in the rules comments to make my points clearer); amongst the points they made was that I missed the dependency cycle and matrix diagrams. Also, that I missed the search facility. I also made some suggestions, and found them to be surprisingly receptive.

I’d like to quickly review each point, starting with the search facility. It is a bit of a hidden gem. You can pretty much search of all the basics: size, name, complexity, etc, and it generates a basic query for you. I’m not sure this negates my earlier comment about wasting time trying to formulate a query, but it’s a start.

Regarding the dependency cycles and the matrix: I subsequently ran this query on my project, and it returned a single, “Extensions” namespace. Looking at the matrix didn’t particularly help and, to be honest, I’m still not totally sure what it tells me.

I will try to revisit this post in around 6 months time, and give details of whether I’m still using the product, any improvements, and whether I find it more, or less useful.

Windows 8 Shortcuts

Windows 8 is a great operating system, but sometimes, without knowing the shortcuts and apps available, it can be difficult to achieve even mundane tasks. Here’s some of the tools and tricks that I use.

Disclaimer

I am the author of one of the apps mentioned below. I have no financial interest in Console OS.

Mail

Windows 8 mail app is definitely not as good as outlook. However, what people forget about when making this comparison is price:

Outlook is a commercial product and sells for just over £90 (that’s around $170 at the time of writing). Windows mail app is part of Windows 8. So it’s free.

If you want to beef it up a bit you can find some useful apps in the store. This one allows to to configure a mail template and associate that with a windows tile.

Multi-screen

Many people these days run more than one monitor; especially with tablets. If you haven’t come across it yet, the magic key-combination here is Windows Key + Shift + Cursor Left or Windows Key + Shift + Cursor Right to move the current window to the next monitor.

Search

Windows Key + S will allow you to search from anywhere; however, if you just press the Windows Key you’ll get taken to the start menu. From there you can just type and Windows should quickly find what you’re looking for.

When you’re done with an app, remember that moving away from the app, or even dragging it to close (finger at the top and the screen and swipe down) may not close the app. To do this, swipe down, but keep the app held at the bottom of the screen until the tile rotates: now it’s gone.

Copy and Paste

Admittedly, the store apps have a way to go with this. Complex text manipulation is difficult without a mouse, and whichever platform you choose, you’ll be swearing at the screen as you try to select the area between a comma and the preceding text. Windows big let down here is that some of the time, press and hold doesn’t give you a cut/copy/paste context menu. However, it does give you a keyboard (all textboxes do). So, simply select Ctrl and X, C or V from there. Not perfect, but it works.

Killer Apps

By far my favourite app these days is One Note. Unfortunately (or maybe fortunately, depending on your point of view) for Microsoft, they’ve made it available on other platforms for free.

The Facebook and Twitter apps are quite good; however, I now just use internet explorer. Remember that a Surface Pro or a Surface Pro 2
tablet, or even something like this Asus) is effectively running a full OS, so you’re no longer restricted to what you can find apps for.

So, what’s missing

While writing this, one of my big annoyances was that there isn’t a WordPress app. Admittedly there are less games available for Windows, but I suppose there’s only so many permutations of Angry Birds you can write. If you want more, why not consider contributing to these guys who are trying to bridge the gap?

Finally, if you would like to see a particular application on WinRT, leave a comment, or contact me directly.

iPhone versus Windows Phone – Why Nokia / Microsoft lost my business

In a divergence from my usual software development ramblings, I thought I’d post my opinions on my latest phone (an iPhone 5c), along with how it stacks up against my previous Nokia Lumia 800

Why Windows Phone

If you have a look through my previous posts, you’ll see the reason for my choosing a Windows Phone last time. I spend a lot of time programming for mobile devices, and I have one Windows Phone 8 app published. Of course I can’t run that on the Lumia… and here’s where Microsoft first started to lose me.

Before getting the phone I looked around at some other phones. I’ve had Apple products before, and have generally been satisfied. I’m not a mad Apple fan, but I have a couple of iPods and an iPad. They work okay. And all the apps that are likely to be written have been written 15 times over.

Windows Phone was new, and it had a very small app base – there was the opportunity! Also, I’d had a Nokia phone before (5120 I think), and it was indestructible!

In general, the Nokia did mostly what I expected – it was very sturdy; I frequently dropped it, scuffed it, and generally treated it the same way that I treated my previous Nokia. The touch screen was excellent and reacted as expected. The Windows 7.1 phone interface was nice. The iPhone feels flimsy and breakable by comparison (as evidenced by the number of people that everyone knows using an iPhone with a smashed screen).

Another excellent feature was the tethering. Given that this was the first phone I’d had that I could tether to, I didn’t realise how good it was until I got the iPhone. Here’s my laptop network screen sat next to the iPhone with Personal Hotspot switched on:

hotspot

To get the laptop to recognise the iPhone I have to turn the personal hotspot of and on again a few times. Windows Phone always worked first time; I’m very aware that I’m pointing out that Windows works with Windows, but if you tether a lot, this can be a factor.

Bad Stuff

There were a number of annoying factors, but the absolute worse was the heat. I couldn’t keep the phone in my pocket, because it literally burned me. I imagine a related factor was the battery life, which was abysmal (I basically needed to charge it 2 – 3 times a day just for basic use).

Zune was also a let-down. I couldn’t fit all my music on the device, so I tried to use playlists, as I’d previously done with the iPhone, but Zune insisted on clearing and re-filling the phone every time; meaning that syncing it took prohibitively long. The playback on the phone was also a poor experience: I’d be listening to a the latest edition of DotNetRocks, pause it, and then if I continued to use the phone, it would forget the position I’d listened to and start again. Of all the bad features, this was the absolute worse.

My last gripe about Windows Phone it what Microsoft did when they introduced Windows Phone 8. As I said earlier, I bought this to do development, and after having it for 6 months, it felt like a giant two finger solute from Microsoft, saying that Phone 8 was out and old phones would not upgrade. I know apple and Android both do this, but they can afford to; they have large and loyal user bases.

Happy with the iPhone?

Like I said, it’s flimsy, and overpriced; however:
– It has an excellent GPS.
– I can carry it in my pocket without having to be treated for second degree burns.
– It has a mature and large app base.
– iTunes is not perfect, but it does work.
– The stuff I play on it remembers where it was stopped.

I did consider getting another Windows Phone when it was time to renew, but ultimately, I couldn’t justify it. The Nokia Phones that are available for 8 didn’t strike me as particularly good this time around (they don’t even look that sturdy now), and ultimately, I couldn’t risk MS releasing Windows Phone 9 and leaving me behind again.