OpenOffice.org API-Design-Guidelines Interfaces Interfaces are used to specify a single aspect in behavior. (Interfaces only consist of methods, not data.) Uniformity All identifiers have to follow uniform rules for semantics, lexical names, and order of arguments. Programmers and developers who are familiar with any portion of the API can work with any other part intuitively. Services Services are collections of related interfaces. They specify the behavior of implementation objects at an abstract leve l by specifying the relationship and interaction between these interfaces. Like interfaces, services are strictly abstract. Orthogonality The functionality of interfaces should extend each other. Avoid redundancy , but if it leads to a major simplification for application programmers, proceed. In general, functionality that can be acquired from basic interfaces should not be added directly. If necessary, create an extra service which provides the functionality and works on external data. ================================================================= Interface design for TBall: Service: compute break-even price Interface BreakEven OutputI compute(InputI) Interface InputI int GetRel() returns the relation number for the artifact we are working on. Interface OutputI double getMaxBias() Returns the maximum bias representing the bent coin for the input pairs. PolynomialI getPolynomial() Returns the polynomial generated by the PairI values. Interface PolynomialI double eval(double x) Returns the result of the polynomial calculated with the given x. double getCoefficient(int degree) Return the coefficient constant used in the polynomial for the degree specified. --------------- usages: Challenge implements BreakEven { double getMaxBias() { OutputI condensed = compute(this); return condensed.getMaxBias();} PolynomialI getPolynomial() { OutputI condensed = compute(this); return condensed.getPolynomial();} double breakEven() { OutputI condensed = compute(this); PolynomialI poly = condensed.getPolynomial(); double mb = condensed.getMaxBias(); return poly.eval(mb); } } Problem implements InputI { double getMaxBias() { OutputI condensed = compute(this); return condensed.getMaxBias();} PolynomialI getPolynomial() { OutputI condensed = compute(this); return condensed.getPolynomial();} double breakEven() { OutputI condensed = compute(this); PolynomialI poly = condensed.getPolynomial(); double mb = condensed.getMaxBias(); return poly.eval(mb); } } http://www.ccs.neu.edu/home/lieber/courses/csu670/f07/outsourced/guaraldi/satsolver-1.1/api/index.html