All Packages Class Hierarchy This Package Previous Next Index
Class designer.DesignByContract
java.lang.Object
|
+----designer.DesignByContract
- public class DesignByContract
- extends Object
Class: DesignByContract
Purpose:
This class provides an Eiffel "Design by Contract" paradigm to
Java classes. Since DBC is not formally part of the language,
it is necessary to construct such classes to formulate better
algorithmic correctness. DBC allows programmers to decorate source
with design knowledge (either programming or expertise). This design
knowledge is more pro-active in DBC v.s. just in comments. By
using DBC, the programmer is stating they trust nobody, not even
thereselves.
When a contract is found to be false, an exception will be raised
and caught by this class. Each method will handle (and print out)
different datasets.
-
DesignByContract()
- Class Constructor.
-
check(boolean)
- Method Name: check
Purpose: This method is called when Java programmers wish to check
class variables and/or states.
-
disable()
- Method Name: disable
Purpose: This method is called to disable "Design By Contract".
-
enable()
- Method Name: enable
Purpose: This method is called to enable "Design By Contract".
-
ensure(boolean)
- Method Name: ensure
Purpose: This method is called when Java programmers wish to check
outgoing return values and/or class states.
-
require(boolean)
- Method Name: require
Purpose: This method is called when Java programmers wish to check
incoming parameters and/or class states.
DesignByContract
public DesignByContract()
- Class Constructor.
This method constructs an object of DBC.
disable
public void disable()
- Method Name: disable
Purpose: This method is called to disable "Design By Contract".
enable
public void enable()
- Method Name: enable
Purpose: This method is called to enable "Design By Contract".
require
public void require(boolean bLogicalValue)
- Method Name: require
Purpose: This method is called when Java programmers wish to check
incoming parameters and/or class states. The output of this method
will, in the case of a DBCException caught, printout stack information
and various error messages so Java programmers can adequately trace
execution to the faulty contract (a kin to how the ISE Eiffel compiler
does it).
PRE: logical experssion that has been evaluated in the caller.
POST: In the event of the expression being false, a DBCException will
be raised and handled by this routine. In the case of the logical
expression being true, nothing will happen.
ensure
public void ensure(boolean bLogicalValue)
- Method Name: ensure
Purpose: This method is called when Java programmers wish to check
outgoing return values and/or class states. The output of this method
will, in the case of a DBCException caught, printout stack information
and various error messages so Java programmers can adequately trace
execution to the faulty contract (a kin to how the ISE Eiffel compiler
does it).
PRE: logical experssion that has been evaluated in the caller.
POST: In the event of the expression being false, a DBCException will
be raised and handled by this routine. In the case of the logical
expression being true, nothing will happen.
check
public void check(boolean bLogicalValue)
- Method Name: check
Purpose: This method is called when Java programmers wish to check
class variables and/or states. The output of this method
will, in the case of a DBCException caught, printout stack information
and various error messages so Java programmers can adequately trace
execution to the faulty contract (a kin to how the ISE Eiffel compiler
does it).
PRE: logical experssion that has been evaluated in the caller.
POST: In the event of the expression being false, a DBCException will
be raised and handled by this routine. In the case of the logical
expression being true, nothing will happen.
All Packages Class Hierarchy This Package Previous Next Index