Cohesion and redundancy

April 27, 2007 · Posted in Development · Comment 

We’re doing some static analysis with NDepend as part of our daily build and the cohesion measurement caught my interest.

When googling for cohesion I stumbled upon some articles discussing reading and writing normal text (normal in this case meaning not source code).

The concepts that I fell for are cohesion and redundancy.

Here is what Wikipedia has to say about these words regarding programming:

  • Cohesion: a measure of how well the lines of source code within a module work together to provide a specific piece of functionality.
  • Redundancy: The notion of unnecessary, dead or duplicate, code.

… and here are the same words regarding linguistics:

  • Cohesion: the linguistic elements that make a discourse semantically coherent.
  • Redundancy: In language, redundancy is the use of duplicative, unnecessary or useless wording.

Linguistics also has the notion of coherence; what makes a text semantically meaningful.

In this article Alice Horning discusses research about cohesion and redundancy in writing. It made me draw some parallels between writing good literature and writing good source code.

Alice states that novice writers lack the ability to distance themselves from the writing to see their text from a readers point of view. I see the same pattern on and on when reading, and trying to understand, source code. It is, mostly, not the programmers’ lack of technical competence that makes it hard to understand their intent. It is their style of naming and grouping things together that creates a total lack of linguistic cohesion, and coherence.

I guess Domain Driven Development would tend to some of this but all I know about that is what Jimmy Nilsson said on DotNetRocks. At least a common way of naming, abstracting and grouping things within an application would use the linguistic sense of redundancy to make code more understandable. Design
patterns will also use redundancy to help the reader understand code since he probably will have a good idea of what’s coming if the code corresponds to a known pattern.

Code reviews also help a lot, but that is done far less than one would like.

I think the cure for this is to take time to read more code. Just as you need to read lots of literature to be a good author you need to read other peoples source code to enhance your own skills. You need to read code that is more than just samples and proof of concepts, and I think it should be code that you are not emotionally attached to. So get your favorite open source application and read its code. While you’re at it you can contribute to it and make the world an even better place.

Why I think Vista sucks.

April 19, 2007 · Posted in Ubuntu · Comment 

Yesterday Windows Vista pushed me over the edge, I’m so back to Ubuntu whenever I can.

Something hogged both CPU cores and the disk. Windows was totally unresponsive. After a while it blue screened and when it restarted it had to run chkdisk.

I’ve got an Acer 8204 (Dual Core, 2GB ram) but everyting in the user interface is slow. If I click a ‘folder’ in the start menu it takes a couple of seconds before I see the items in it. So to open Word with the mouse takes almost ten seconds.

Copying files is so slow it’s a joke.

I often have to reboot for it to find my wifi.

I have to run Visual Studio as adminstrator (even after the update) because one of the applications I work on need elevated privileges.

It’s so slow compared to Windows XP that get things done faster when running XP in VmWare inside Ubuntu.

There are more of us that are annoyed:
Does Anything Work in Vista??

Hobby project part 3

April 12, 2007 · Posted in Shareware · Comment 

Since I’m going to release the software as shareware I have to come up with a good incentive for the users to pay for it.
At the moment I’m trying to decide if I should start showing ads when the trial period is over or if I should just make it obvious that they are using unpaid software. Ads could create som revenue, but it might equally well make people sick of the application.

If I stop the application from working then the trial period is over it will probably be cracked in an afternoon even if the user base is small so I think I’ll let people use it even if they don’t pay. Perhaps conscience will win eventually.

Culture neutral satellite assemblies

April 11, 2007 · Posted in Development · Comment 

I’m slapping localization on to an existing product and needed a way to have my culture neutral resources in a satellite assembly. I can’t use embedded resources because I am extracting data from the compiled assembly to use for the resources.

The solution was to use the assembly attribute: NeutralResourcesLanguageAttribute to indicate what culture should be used as the default culture and use the UltimateResourceFallbackLocation enum to indicate that it should fallback on a satellite assembly. This attribute is new from .NET 2.0 so in 1.1 and 1.0 you will have to embed your culture neutral resources into the main assembly.

Discoverability and findability

April 10, 2007 · Posted in Development, Shareware · Comment 

I’ve been hearing, reading and thinking a bit about discoverability lately.

This essay sums it pretty well. He goes into some discussion about limiting the choices by prioritizing different features and making basic decisions for the user. Like making the stearing wheel more discoverable than the fuse box.

I think that making these decisions are not only about usability they are really the decisions that differentiates you from your competition.

You can have one million features but in the end it is your default feature set that identifies your product. If you decide to turn all those little design decisions into options for the user your product will either be identified as the power users dream or an unfocused mess.

Since you only get one shot at the first impression it’s a tough choice for a small shop. Should you aim at the small population that likes your way of solving the specific problem or should you aim at the small population of users that will really investigate your product and tweak it to their liking?

If you’re selling to ‘ordinary’ consumers my guess is that there are more people who will like to have a guided experience than there are curious explorers. The curious explorers are probably divided in two camps; The backpackers who want lots of low cost choices, and the expeditioners who will pay whatever it costs if it gets them where they want.

Hobby project part 2

April 9, 2007 · Posted in Shareware · Comment 

I’ve got a couple of ideas for other programs so I registered a domain
(jsisoft.com) where I can host them instead of one domain per application which probably would be better from a marketing perspective. I will prefix all the program names with ‘jsi’ to (hopefully) avoid other peoples trademarks.

It’s probably a couple of weeks of development time left before I make it public, but I have got the plumbing with paypal from jsisoft.com done and there is a forum here.

It is possible to make a donation for logview4net from the site.

I was thinking about submitting the software to as many shareware/download portals as I can find without spending any money.

Showing HTML in a WinForm

April 8, 2007 · Posted in Development · Comment 

I am really annoyed that there is no good way to show some HMTL in a winform. I’ve got some data and part of it is snippets of HTML. Do I need to save that on file and use the monstrous WebBrowser control?

Hobby project

April 6, 2007 · Posted in Shareware · Comment 

I’ve started developing a small application that I’m going to try to sell as shareware. I don’t think it’ll make me rich, but it would be fun to have the web hosting bills paid and the ability to by an occasional toy.

There is a lot more to do when the program is to be for sale than releasing it on SourceForge. That is perhaps an unfair attitude towrds open source, but I think people have a greater tolerance for weirdness if they didn’t pay for the application.

Softpedia Clean Award

April 4, 2007 · Posted in logview4net · Comment 

logview4net got listed on softpedia so now I can decorate the homepage with this: