Current location: Hot Scripts Forums » General Web Coding » JavaScript » Java Cyclomatic Complexity


Java Cyclomatic Complexity

Reply
  #1 (permalink)  
Old 10-29-04, 07:02 PM
NICOLAD NICOLAD is offline
New Member
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Java Cyclomatic Complexity

Hi all
Im having problems coding the following Coursework, i just dont know where to start in the coding after reading in the text file. Would be most grateful for any help as Im now getting desperate.

Introduction:
Judging a software module’s complexity is somewhat objective. Objective measures are difficult to formulate. One such measure has been proposed by McCabe, who argues that the complexity of a module is directly related to the possible number of different paths through the module.

McCabe defines Cyclomatic Complexity of a module to be = Number of simple conditional statements (ifs, whiles, repeats, etc) + 1.

Problem:
Design, code and test a Java program that will determine the Cyclomatic Complexity (CC) of any given Java source code module held in a text file. The program is to display the CC and also to indicate if, according to McCabe, the module is too complex.

You will need to provide word processed algorithms and printouts of suitably commented Java source code.

You should also provide a word processed explanation of the design decisions taken.

NOTE:This assessment represents 100% of the coursework assessment for the module and 70% of the total assessment

EXPLANATION (of design decisions) Coursework: Programming Assignment

Basically, the reasoning behind the way in which you have written (designed) the program. I’d include:

· Assumptions made· Limitations of the program· How you decided on the functionalities to do the job· How you chose to distribute these functionalities across different methods· Justification for incorporating any standard Java utilities
Reply With Quote
  #2 (permalink)  
Old 11-02-04, 03:05 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
First, java isn't Javascript, but since you're just asking for genral advice I'll give it a shot.

To me it looks like you're supposed to write a program that determines the number of loops, if statements etc. In Javascript this could easily be done using regular expressions that simply count the number of hits for each type of statement.

I don't if this can be done in Javas though so another option is to loop through each character. For each iteration of the loop you test the character n to n+4 and test if it equals "while" or if n to n+2 equals "for" and so on...

I hope I understood your qestion
Reply With Quote
  #3 (permalink)  
Old 11-08-04, 01:11 PM
NERO NERO is offline
New Member
 
Join Date: Nov 2004
Location: Glasgow
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

Hi NICOLAD

I take it you are at Cali Uni lOl,

Ok first of you need to understand Streams and File output / input. So best if you look into the powerfull StreamTokenizer class. This will allow you to catogarize your input stream into Tokens of type sval

string value, then all you need to do is basicaly just create a String Array with a refrence to hold the keywords ( case . if etc) then use the Equals() method from the String Class to compare with the tokens from the input stream of sval and the refrence to the keywords in the array!

Any probs gives a shout in this forum lol
Ps am the one near the front row in your O&A lectures
I had my coursework finished 3 days after hand out. I also hate being a skint student
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript menu covered by java applet shaisachs JavaScript 7 12-28-04 11:38 PM
Re: Porting from java to c++! addit C/C++ 3 09-14-04 04:11 PM
Porting java to C++! addit Everything Java 0 09-06-04 01:03 PM
We need more java talk rooshine Everything Java 4 05-08-04 10:44 PM
PHP with JAVA funkydunk PHP 0 07-21-03 09:40 AM


All times are GMT -5. The time now is 10:32 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.