Should we add more enums to the code?  For example, in Ordering.java,
there are these constants:

public static final boolean ASC = true;
public static final boolean DESC = false;

However, there is no enum to represent the options.  The constructors look like:

public Ordering(String sortPathSpec, boolean ascending) ...

There is nothing to encourage/enforce the usage of the constants, so
you tend to see "true" and "false" being used.  Even in our
documentation:

http://cayenne.apache.org/doc/using-orderings.html

query.addOrdering("artistName", true);
Ordering ordering = new Ordering("artistName", true);

To the new (or even experienced) user, seeing "true" there tends to
have no meaning.  I (and some of the people I've been showing Cayenne
to here) would rather see something like:

Ordering ordering = new Ordering("artistName", OrderingDirection.ASCENDING);

One guy even suggested something like:

Ordering ordering = new AscendingOrdering("artistName");

That is more concise and still explicit, but would obviously require
even more code changes (probably).  Especially when adding the case
insensitive stuff.

Thoughts?

Thanks!

mrg

Reply via email to