In this chapter, we described three different packages: functor , lang , and validator , which had absolutely nothing to do with each other. It is OK that those packages had nothing to do with each other because the techniques described in this chapter are specific routines to help solve specific types of problem. In the case of functors, the specific problem was how to create maintainable complex formulas. Using functors requires more thought than using straight formulas because designing functors is not like designing objects. Functors are about decomposing the problem into smaller pieces. Without the functor package, the developer could still develop maintainable reusable formulas, but they would resemble functors. Using the functors, the developer has a head start and does not need to create the infrastructure himself.

Another kind of problem is doing the little tedious tasks that take a long time. The problem could be a simple trimming of a string buffer or the implementation of hashCode method. In either case, it is not a difficult problem to solve. The solution just takes time. And, doing your own implementation could introduce bugs that simply do not need to exist.

Finally, the last kind of problem is user -data validation. Validation is not difficult, but it is tedious and can be error prone. Implemented incorrectly, validation can cause more bugs since specific rules can conflict with other rules. Using the validator package, the developer can separate the validation and the bean being validated . This means that the administrator can tweak and tune the validation. It also makes it possible to define validations as a single task, which ensures that there will be as little feature interaction as possible.

On the CD The sources to the concepts presented in this chapter are located under the directory [CDROM]/jseng/src/com.devspace. jseng .algorithms . For the section Defining a Validator the sample configuration files are located at [CDROM]/jseng/src/classes/BeanToWriteValidator.xml, and [CDROM]/jseng/src/classes/ .

Applied Software Engineering Using Apache Jakarta Commons
Applied Software Engineering Using Apache Jakarta Commons (Charles River Media Computer Engineering)
ISBN: 1584502460
EAN: 2147483647
Year: 2002
Pages: 109 © 2008-2017.
If you may any questions please contact us: