6 Replies - 11692 Views - Last Post: 25 October 2012 - 01:43 AM

#1 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Java Code Assessor

Posted 30 January 2012 - 06:59 PM

So I'm starting a degree in Software Engineering this year and there seems to be quite a bit of focus on Java programming this year, which I will likely find incredibly easy as I've been programming for a long time but haven't had any formal teaching and never really went to the effort of learning all the idiosyncrasies of Java.

I know a lot of universities like to use automated tools to assess the quality of code, I have seen it at a friends university and I was very interested in it. He would submit his code to the server and spit out a mark there and then. I have a hunch that many assessors would use these tools, so I would like to find one to test my source code before submitting my assignments for peace of mind.

Has anybody used such a program before?

Is This A Good Question/Topic? 0
  • +

Replies To: Java Code Assessor

#2 jon.kiparsky  Icon User is offline

  • Pancakes!
  • member icon


Reputation: 8011
  • View blog
  • Posts: 13,716
  • Joined: 19-March 11

Re: Java Code Assessor

Posted 30 January 2012 - 09:38 PM

I would imagine that it's simply running it against a battery of unit tests, so yes, I use junit, and you should too. It's a pretty handy piece of the development toolkit.
Was This Post Helpful? 2
  • +
  • -

#3 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Re: Java Code Assessor

Posted 31 January 2012 - 04:47 AM

I used to use unit testing but then I got slack and just tested hypothetical cases on the fly. I should probably get around to becoming proficient at unit testing but I'm not sure unit testing was the answer I was looking for.

After a bit of accidental searching I came across a tool that I thought was relatively close after learning PWD existed (does NetBeans automatically run PWD by default? it seems like it's a pretty default aspect of many libraries):
http://jcsc.sourceforge.net/ - This checks that the code adheres to many coding conventions like fields before methods etc.
http://javapathfinde...PathFinder.html - NASA uses this to check for potential runtime errors

I'll give them a spin, or if anyone else would like to, feel free to tell me how it goes (your higher experience with Java might be able to point me to something more suitable) and I'll try and post my findings also.
Was This Post Helpful? 2
  • +
  • -

#4 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 562
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Java Code Assessor

Posted 04 February 2012 - 08:52 PM

hmmm, I wonder why they make you do this. If your teacher was the same as mine, it would be because they were full of bad coding practices, which were then being passed onto his students. If you have had a lot of experience with programming, you should know what is generally seen as good and bad practice. Over time, you will develop a better database of knowledge and understanding. It might be good for a program to tell you this, but never tried it before so dont know what its like and what standards it compares against. You would be far better off sharing your code here on DIC, and asking whether its good or bad to "real world" programmers. Not everyone is the same, so different people have different standards. What the program might say is "correct" may be seen as "incorrect" to many. There are situations on practices where everyone will agree, but not all the time. I might have a go with the program to see what its like.

As with the runtime checker, I personally see this as lazy, and would be shocked if they were telling you to use this. I understand that if they are, then you will be expected. However, I remember someone once telling me that application building is 30% programming and 70% testing. Runtime errors should be something the developer should detect themselves through a series on intensive tests. This does not necessarilly mean you have to use something like JUnit. These test often involve you trying out every feature of the app, providing ranges of different inputs etc.

Be careful that if they are pusing things like this upon you, make sure you dont fall into the trap of relying on them.

good luck
Was This Post Helpful? 1
  • +
  • -

#5 m-e-g-a-z  Icon User is offline

  • Winning
  • member icon


Reputation: 497
  • View blog
  • Posts: 1,453
  • Joined: 19-October 09

Re: Java Code Assessor

Posted 23 October 2012 - 03:11 PM

At my workplace, we use Sonar and it really helps us manage the quality of code we write and the build pipeline process. It identifies code violations and provides alternative ways of writing a specific line or section of code. An example could be generic exception handling when reading a file which would generally need IOException and/or NullPointerException handling. It would inform us of this violation which is very helpful in keeping the quality of the code consistent across the codebase.
Was This Post Helpful? 0
  • +
  • -

#6 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 2069
  • View blog
  • Posts: 4,307
  • Joined: 11-December 07

Re: Java Code Assessor

Posted 25 October 2012 - 01:12 AM

I use FindBugs for static analysis and it has really helped me tighten up my coding practices. The first time I used it was on my final year uni project and it found literally hundreds of issues with my code. I started running it regularly (only slightly less often than my unit tests) and now all the good practices it was trying to teach me have become second nature.
Was This Post Helpful? 0
  • +
  • -

#7 fromTheSprawl  Icon User is offline

  • Monomania
  • member icon

Reputation: 513
  • View blog
  • Posts: 2,063
  • Joined: 28-December 10

Re: Java Code Assessor

Posted 25 October 2012 - 01:43 AM

I undertook a training and we used Sonar too. It was a nightmare. Actually you could trick Sonar to thinking it covered 100% of your code. Still, it's a good thing to use especially if your code is to be reviewed and it might also tell you possible errors that you might have missed, as m-e-g-a-z has pointed out. Learn using one code coverage tool and a unit(JUnit) testing tool if you must, but the more important tool for the community on my observation are unit testing tools. They make regression a breeze! Of course, it wouldn't mean a thing if you don't know how to write unit tests, so try practicing that too.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1