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

Compare with Current View Page History

« Previous Version 6 Next »

I would like to share some comments about the API from a user point-of-view.

Status codes

The Java language was awarded such a nice enum class. Is there really a performance issue in using ints for status bits or types ?

/** Type of hit. Mapping of integer types to type names
  * through collection parameters "TrackerHitTypeNames"
  * and "TrackerHitTypeValues".
  */

Examples:

  • the FitStatus class
  • in FtfTrack.java: if ( getPara().szFitFlag == 1 )
    especially the latter class would benefit from using enums or at least symbolic constants, if the author ever wants to hand over maintenance to someone else.

This does not help me at all when I am coding, and I don't want to have a web browser open all the time to see what the type, status, flag, whatever, actually stands for. This is where I would like to take advantage of Code Completion.

org.lcsim.mc.fast.cluster.ronan

I disagree with the use of names for packages.

JavaDoc

The class TrackVector shouldn't have te, tv, td in the Javadoc. This is cryptic. It is actually clearer to browse the source code than to read the javadoc

"Overloaded Operators"

It is very confusing to have members like add(Object o1, Object o2) as members of the classes. This is counter-intuitive. Either there ought to be a supporter class with static members only, or the member of the type class expects only one argument.
So:
vec1.add(vec1, vec2) #BAD
vec1.add(vec2) #GOOD
import static x.y.add; add(vec1, vec2); #GOOD

Extending classes

public class RadLengths extends Hashtable #BAD !!!
The radiation lengths are not a new kind of HashTable. They should be implemented USING a HashTable !

Using strings to access parameters

While I admit there are situations where it is hard to avoid using strings to pass information between functions (e.g. event.put/event.get), most of the time this is a horrible idea. Look at the RadLengths class as an example. There is nothing dynamic about this class, all radiation lengths are constant and therefore determined at compile time. Besides imposing an unnecessary overhead of string comparison, the compiler cannot check if the string is spelled correctly. I really fail to comprehend why we don't use symbolic constants for these kinds of things. Be it in terms of static ints or enums, but at least something that can be checked at compile time rather than runtime. Again, that way we can even take advantage of code-completion.

Thank you for your consideration
Jan

  • No labels