Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Coding Standards

Setters/Getters vs. Constructors

For Spring Managed Classes: All required properties should be set via Constructor. All optional properties should be set via setters/getters. This makes it easy to distinguish between required and optional properties.

For Non-Spring Managed Classes: These should have the option of setting all properties via constructor, as they may be instantiated inline as instance variables.

Readability

The majority of developers these days have larger, widescreen monitors. To that end, the code should favor longer lines, rather than breaking a line into multiple lines. Thus, method signatures, unless exceptionally long, should appear on one line.

The current recommendation for line length is 140 characters.

Validation

All Spring-managed classes should leverage the JaValid annotations for dependency checking of properties at deployment time.

Common Functionality

Wherever possible common functionality should be placed into an abstract or utility class, as applicable. A good example of this is the AbstractUsernamePasswordAuthenticationHandler, which most classes that use UsernamePasswordCredentials should extend from.

  • No labels