Wednesday, September 28, 2011

Quickly, run!! It's the Cyclomatic!

Cyclomatic....the first time I saw that word pop up in a Visual Studio Code Analysis warning, I thought I was seeing things. It sounded like some cheesy killer robot from a bad 1950's sci-fi movie. But no, it's a real thing. And it's not nearly as complicated as it sounds (no pun intended).

Cyclomatic Complexity is, simply put, a single number that represents the number of independent paths through your code. The idea is that the higher the cyclomatic complexity, the less maintainable and more error-prone your code will be. Generally, cyclomatic complexity is classified as follows:
Complexity Description
1 - 10 simple code, low risk
11 - 20 moderately complex code, moderate risk
21 - 50 complex code, high risk
51+ overly complex code, virtually untestable and unmaintainable, unacceptable risk

So what should you do with this? Try to keep you cyclomatic complexity as low as possible, that's what. A good rule of thumb is to keep it at 10 or lower, although code analysis tools like Visual Studio and FxCop won't usually complain until you hit 25 or so. Visual Studio will calculate this for you (right-click on a project, choose "Code Metrics"). However, it doesn't work for websites. There is a third-party alternative that will called NDepend, but it isn't free for commercial use. And even for academic or non-commercial use, you have to renew the free license about every month. If anyone knows of any good free alternatives, please share!

Code Coverage and Strongly Signed Assemblies

I had a problem the other day that stumped me for a while. We just started a new project and immediately dove in to start coding. A few days later, I decided it was time to clean up the code before it got out of hand, so I ran Code Analysis and started cleaning up the problems. One I came across was this on:

System.IO.FileLoadException: Could not load file or assembly ‘xxxxxx’ or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A). File name: ‘xxxxxx’ ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

This puzzled me, because I had just finished signing the assembly with a strong name. After some Googling, I realized that it was due to the code coverage I had recently configured. After running code coverage, Visual Studio needs to re-sign the assemblies, and there is a separate place to define the key for that re-signing process. To get to it, open up your .testsettings file, go to the "Data and Diagnostics" section, click on "Code Coverage", then click the "Configure" button above.


Sunday, September 11, 2011

iPad Business Apps, Part I

As promised, here are some of the apps we've been using to help us run an "iPad only" project at work. I'm not listing the price for any of these, because they can change from month to month, but you can click on the icon for each app to read more about the it in the iTunes App Store.

Before I get to the apps, though, I want to mention the most indispensable part for using an iPad at work - the wireless keyboard. This thing is simply wonderful. It is light, yet sturdy, easy to set up, and easy to transport. And it works flawlessly. You can even wake up your iPad by tapping a key.


Apple Wireless Keyboard
Okay, enough of that, onto the apps! In this post, I'm only going to cover one project management app and several note taking apps. I'll cover other types of apps in the next post.

1. SG Project/Project Pro/Project Go



First up for any business setup is a project management app. The best one we found is SG Project, which is essentially a clone of Microsoft Project for the iPad. There is also a Pro version that adds a lot of reporting functionality, and a SG Project Go version specifically for iPhones. SG Project is a pretty good app that can do most of the common project management tasks, such as dependencies, Gantt charts, and resource leveling. It can also import and export from Microsoft Project, which was a big plus when we selected this app.

A critical part of using an iPad for business is the ability to take notes on it. There are many good note-taking apps, but here are some of my favorites.

2. Note Taker HD

Note Taker HD is a great app for everyday note taking. It supports multiple notebooks and multiple pages per notebook. You can type with the keyboard or write notes by hand using your finger or a stylus. The great part is that you can use large handwriting, and it will automatically shrink it to fit on the page. This works surprisingly well and the result is very legible. Note Taker HD also has support for diagrams and works great for simple flowcharts and org charts.

3. PhatPad for iPad

While Note Taker HD is a great app, one thing it lacks is digital ink technology. Digital ink technology is the ability to write notes by hand (or a stylus) and then having the app convert it to text for you. This is where PhatPad comes in. Not only does it have digital ink technology for handwriting, but also for drawing. You can draw geometric shapes by hand and it will automatically convert them to perfect shapes! This is a great feature, and is more useful than you might think.

4. WritePad for iPad

WritePad is sort of like the big brother of PhatPad. I say "sort of" because it adds some features that PhatPad doesn't have, but it also doesn't have all of the features of PhatPad. WritePad is more focused on the writing aspect, and therefore doesn't have the drawing recognition that PhatPad has. But instead of that, it provides a much more powerful hand writing recognition system that can learn and adapt to your handwriting. It also has a Shorthand editor that lets you use gestures and abbreviations for frequently used words and phrases, and WritePad will automatically fill those in for you. Both PhatPad and WritePad allow you to share and collaborate over a local Wi-Fi, too.

5. iThoughtsHD

iThoughtsHD is a different kind of note taking app. Instead of the normal notebook/page paradigm, it allows you to organize your thoughts using Mind Maps. If you're not familiar with mind maps, I'll cover them in a later post. But basically they are visual outlines that help you organize information in a way that's optimized for comprehension and retention. There are many mind mapping apps for the iPad, but iThoughtsHD is probably one of the better ones, if not the best one. Here is a sample mind map generated by iThoughtsHD:
Sample Mind Map Created By iThoughtsHD
That's it for this time. In the next post, I'll cover some other apps including those geared toward Agile development, UI mockups, defect/issue tracking, and others.