You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Mark Combellack <mc...@apache.org> on 2008/12/08 11:28:38 UTC

[2.x] RE: Trunk Code clean up

Hi Luciano,

 

I've just been doing bits of code tidy up as I find them. No particular
strategy or direction.

 

The plugins I have been using in Eclipse are:

 

*         Checkstyle

*         FindBugs

*         PMD

 

Currently, there are too many problems found by these tools to be able to
see which ones are "proper" problems that should be fixed and which ones are
just "noise" and can be ignored. I'll just keep tidying up and hopefully,
the number of problems can be reduced.

 

Thanks,

 

Mark

 

> -----Original Message-----

> From: Luciano Resende [mailto:luckbr1975@gmail.com]

> Sent: 04 December 2008 21:47

> To: dev@tuscany.apache.org

> Subject: Trunk Code clean up

> 

> I have noticed that Mark has been doing a great job helping us

> cleaning up the 2.0 code base [1], thanks a lot Mark.

> 

> Considering others might want to help, below is a list of possible

> items to look when reviewing the code, we could probably grow this

> into a Tuscany Code Guideline.

> Also, using a tool such as PMD (or eclipse PMD plugin) might help.

> 

> Clean code

>  - use correct visibility, private, default, public, avoid protected

>  - make methods static if not using object state

>  - make sure javadoc is in sync or remove that javadoc

>  - no javadoc on overridden methods

>  - test cases in same package to avoid having to over-open access to

> methods

>  - don't create artificial dependencies by using constants from another

> module

>  - don't extend/implement a 'constant' interface

>  - avoid creating another private layer over a public interface/spi

>  - remove old code, don't leave it commented out, very confusing

>  - use functional programming names for functions that convert an object

>  - add javadoc to private methods

>  - review class javadoc and make sure it's accurate

>  - inline methods used only once, or make them clean static functions

>  - put utility methods in a Util class with package visibility

>  - use static imports

>  - use scoped variables

>  - no stars in OSGi exports

>  - correct use of generics, see the effective Java book

> 

> Unit/Integration Tests

>  - put comments in test cases

>  - review test cases and make sure they're included in the build

>  - use junit 4 only, check correct use of @BeforeClass or @Before

>  - use static imports for assert statements

> 

> Formatting

>  - use Tuscany eclipse code style/formatter

>  - no tabs

>  - no excessive line wrapping

> 

> 

> [1] http://www.mail-

> archive.com/search?q=mcombellack&l=commits@tuscany.apache.org&start=0

> 

> --

> Luciano Resende

> Apache Tuscany, Apache PhotArk

> http://people.apache.org/~lresende

> http://lresende.blogspot.com/