Frequently, developers come up with a nice class that provides some useful behavior but the class is extremely difficult to use. The problem often resides in the absence of higher level methods to use the class in a simple way. I've seen code that performs encryption of byte arrays that require that the byte arrays be multiples of 8 bytes in size and don't allow Strings to be used instead of byte arrays. Without these simplifications, the class becomes very difficult to use. In this case, it would be easy to provide a method that converts strings into byte arrays and pads them in a standard way before encrypting them. If this work isn't done by the utility class, it has to be done by the code that uses that class and makes it hard to use and understand. Try to make sure your classes are easy for other developers to use.
Download