10-30-2007 11:30 AM - edited 10-30-2007 11:30 AM
Message Edited by DanielGreen on 10-30-2007 11:35 AM
10-30-2007 12:20 PM
10-30-2007 05:59 PM
This is a simple linked list implementation using unions to hold ViSession, panel handles and other forms of CVI handles, it is a module, but the doesn't mean it's not a well designed piece of code, I wish I could share this but as I wrote it for my company I can't for obvious reasons, however I can offer advice to anyone trying to do the same. Simply put it takes a key and replies with the value in the union. Please note the metrics, this is very clean code, but looking at it on paper (or screen) is very complex, just goes to show you tho good code can be very effective.
Parameter Value
========= =====
Project Directory C:\Project Files\handles\
Project Name handles
Checkpoint Name Baseline
Created On 30 October 2007, 3:53:49 PM
Files 4
Lines 421
Statements 199
Percent Branch Statements 23.1
Percent Lines with Comments 14.5
Functions 16
Average Statements per Function 14.9
Line Number of Most Complex Function {undefined}
Name of Most Complex Function Handles_Set()
Complexity of Most Complex Function 12
Line Number of Deepest Block {undefined}
Maximum Block Depth 5
Average Block Depth 1.37
Average Complexity 6.50
--------------------------------------------------------------------------------------------
Names of 2 Functions Complexity, Statements, Max Depth, Calls
Handles_Set() 12, 25, 5, 9
main() 1, 20, 1, 16
--------------------------------------------------------------------------------------------
Block Depth Statements
0 50
1 73
2 44
3 20
4 9
5 3
6 0
7 0
8 0
9+ 0
--------------------------------------------------------------------------------------------
10-31-2007 12:30 PM - edited 10-31-2007 12:30 PM
So no one is willing to step up to the plate with a higher complexity score?
I have to say that 847 sets the bar very high - it's double the highest score we have.
Ian W provided both comic relief and he got a five star rating for his trouble. ![]()
I had a messy Java module that was part of a compiler we were writing in grad school. Prof made fun of it in front of the class for being shabby - deeply nested, long, etc. He had an elegant solution that used a JTree. Then I pointed out that his solution didn't properly handle one of the required scenarios and that mine did.
Menchar
Message Edited by menchar on 10-31-2007 11:09 AM
10-31-2007 12:34 PM
nobody can help on my source hiding question? reprinted here for convenience:
10-31-2007 05:24 PM
11-05-2007 02:45 PM
It looks like Ian is going to prevail with his complexity score. Well done Ian. ![]()
You know, another point with C99 is that they fixed up the handling of IEEE flt pt. NI has some functions defined, but it's just not as good as direct language support. And if you're making measurements (generally the point of most CVI applications I would think) it sure would be nice to have the better floating point handling of C99.
Maybe NI could incrementally add C99 features. If variable length arrays are too daunting, maybe they could add the C99 floating point enhancements.
Menchar
11-05-2007 05:13 PM