Roman Numerals Kata

I figured I’d start doing some of the coding Katas, but to add a small twist, I’d only do them in MonoDevelop on Ubuntu in order to get more familiar with Linux and Mono.

My attempt can be found here on github: https://github.com/ChrisAnn/Roman-Numerals-Kata

I have to say that I found some of the MonoDevelop defaults to be quite irritating.  I prefer the Allman style when it comes to the placement of braces in C#, while MonoDevelop defaulted to K&R style automatically moving my braces and would not allow me to manually alter their position.  I don’t mind that it defaulted to something I’m unaccostumed to, but I found the fact that it ignore my repeated hits on the return key to move it down a line to be extremely frustrating – if you’re going to move my braces, at least let me move them around to my liking!

With some digging around in the preferences, I managed to set up my own custom profile and it finally ceased tampering with my braces. (Edit > Preferences > Code Formatting > C# Source Code > C# Format > Edit > Change ‘Category’ to ‘Braces’ > Change ‘Method Declaration’ to ‘Next Line’.  Simples…)

Another thing I did not like was its habit of inserting spaces between the method name and the brackets to look like:

myMethod (parameter);

This is non-standard in C# and I had to go back and remove all the spaces, at least it let me do this without me having to amend my custom profile.

These complaints may seem trivial, but suppose I was to work in MonoDevelop and the rest of my team used Visual Studio, we’d create messy files with competing formatting – preventing this is why coding standards are employed.  Surely, MonoDevelop should default to the standards of the language being used?

I had no idea how to run my unit tests in MonoDevelop – I wasn’t expecting a test runner, there isnt one in VisualStudio unless you pay for the higher levels, but I was stumped until I discovered that you can install the NUnit gui via apt-get using the following command:

$ sudo apt-get install nunit-gui

I also made a point of not checking any existing completed roman numeral katas, but having looked a couple after I completed it, it seems that that I arrived at a solution very similar to that of other people, which gave me a good sense of validation.

I shall endeavour to complete more katas using MonoDevelop on Ubuntu as I found it to be a fun experience.

Advertisements

5 Comments

  1. If mentioned about whitespace between function / method name and brackets you can easily disable it in “C# source code” options by editing “C# Format” choosing category “White Space” and disabling option “Declarations > before opening parenthesis”

    Like

    Reply

  2. I knew it would be in there somewhere, but it's still very odd that MonoDevelop does not default to the standard formatting of C# or provide a profile for easily changing this. I guess as it's an OSS project I could (and should) fix this myself 😉

    Like

    Reply

  3. I think you mean Microsoft C# standard, influenced by Java and by that C language coding style. But does it really matter?Does it really matter if someone prefer public Method( string name ) over public Method (string name) or public Method(string name) as long as he or she is keeping the style? I think it's not so important as long as you can configure coding style formatter behaviour as you like and on the other hand the last one chosen by default in MonoDevelop differs it from Visual Studio by example 🙂

    Like

    Reply

  4. Indeed, but my point (gripe) is that by default MonoDevelop would not allow me to edit placement of braces manually or that it was easy to find and change these settings.

    Like

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s