Search code examples
c#visual-studio-2013codelens

Is it possible to write completely maintainable code?


I downloaded the "Microsoft CodeLens Code Health Indicator" VS 2013 extension ( http://visualstudiogallery.msdn.microsoft.com/f85a7ab9-b4c2-436c-a6e5-0f06e0bac16d)

...and opened a simple utility. The score of my methods ran from a low of 52 to a high of 92.

The Microsoft-written method was the only one with a higher score.

1 reference | maintainability 94
public Form1()
{
    InitializeComponent();
}

Commenting out "InitializeComponent();" raised the maintainability to the max (100), but of course, in this case at least, the ultimate in maintainability is also the negative ultimate in usability.

Is there any way to get a score of 100 on useful code?

UPDATE

Here's some code ranked 100% maintainable:

enter image description here


Solution

  • According to Microsoft's Dev Network, that maintainability reading is rated on a scale of:

    • 20-100 - Maintainable
    • 10-20 - "Warning zone"
    • 0-10 - Unmaintainable code

    Having code within the 90's is already very good code, I believe if you are at 100 then you aren't really working with anything.

    As far as "Can you have usable code" with 100, I would say no initially, but I suppose it could be possible that something useful could exist.

    http://msdn.microsoft.com/en-us/library/bb385914.aspx