Yesterday I read Hosk’s article about why experince is important for CRM Developers. As a developer I keep on having to learn this mysterious way of CRM development, and I will share you my ideas about this topic and focusing on the code complexity:

What does code complexity mean?

As far as I am concerned the code complexity is anything you “introduce” into your code that makes it hard to read and follow. Just look the following topics you might look for code complexity:

Long Methods

Long methods!

Developers tend to write long methods. The longer your method is, the more work it will be to keep track of the overall point of the method! If you are write a long method, when you come back from coffee break, you will be confused.

What is ideal metric? How many lines of functional  code per method? 1, 2, 3, …, 7? How many items can the human brain deal?

Lot of conditions within one method!

Most developers might think that only if/else statement are conditions. What else? So are for/next, do/while and switch statements too. I mention your code should be written so that you only have THREE condition per method. Switch statements might loose their context because of theirs complexity. I would have one method that handles this kind of statements and each case statements call a function.

Are you using Visual Studio? Great! There is a tool in Visual Studio that could help you determine how bad your methods are. This tool is under the Analyze menu options.

Lot of operations, calls, parameters!

How easily can you find code you need to maintain?

How easily can you find code you need to maintain?

Cheers!