Pre and Post Conditions
Thursday, December 2, 2010
The disadvantage of straightening elsewhere the algorithm from the GUI, is that both the form class and the View/Controller class does input checking to insure runtime reliability and useful user feedback. The representation class apparatus a widespread programming knock down, the use of pre and post conditions. In the Model class, the "Init" manner statically validates the input parameters before passing them on to the DoAlgorithm method (pre-conditions). The algorithm does not check for a divide by nought error, which is handled internally. After the calculation is complete, the "DoAlgorithm" method validates the result by calling Double.IsNaN (IsNotANumber) (post-conditions). The pronouncement to turn off pre and post conditions in the let loose build (no check version) is ahead of the scope of this seminar.
Labels:
Windows Forms
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment