this is one sensible interface naming option, if the interface encapsulates a cohesive set of behaviors
and yes, compared to blindly following the meaningless I+ convention, it requires some thought, but thinking of an appropriate name also forces you to (re)consider the interface's primary responsibility and how it fits into the overall design
imho, a class diagram for a domain model should be almost fluently readable english
Sometimes an Adjective doesn't make sense, but I'd still generally be using interfaces to model behavior, actions, capabilities, properties, etc,... not types.
Also, If you were really only going to make one User and call it User then what's the point of also having an IUser interface?
another anti-pattern... blindly create an interface for every class, even if there's only one implementation!! arrgghhhh!
consider introducing an interface when there are 2-3 well-distinguished, concrete implementations required
if you are going to have a few different types of users that need to implement a common interface, what does appending an "I" to the interface save you in choosing names of the implementations?
prefer not to use a prefix on interfaces:
hurts readability.
interfaces names should be as short and pleasant as possible
Implementing classes should be uglier to discourage their use.
thinking defensively, in a pathological scenario, the data and/or schema of the database could be corrupt
eg. using a named query that should return a single entity based on a unique constraint of a table:
- what if the unique constraint was implemented incorrectly in the ddl? (too relaxed or too strict)
- what if the data became inconsistent as a result of some external process?
=> should always code defensively, especially at integration points to anything external to the jvm
Updated Groovy template for GraniteDS Builder (gas3)
also stripped out the specialized GraniteDS datatypes in favor of the LCDS serialization convention that Adobe uses (i.e. a Java map should translate to an 'Object' type, a Java enum should translate to a 'String', and Java collections should always serialize as 'ArrayCollection')
didn't do a 'base' version and a version that doesnt get touched by the code generator, but you could easily do so by modifying this template
start with some of the obvious rulesets - just run unusedcode
and fix any unused locals and fields.
Then, run basic and fix all the empty if statements and such-like.
Then peruse the design and
controversial rulesets and use the ones
you like via a custom ruleset
Using PMD within your IDE is much more enjoyable than flipping back and forth
between an HTML report and your IDE