Assertions are used to stop execution when "impossible" situations are detected
Tutorial Details:
Impossible conditions. Program debugging is filled with "impossible" problems ("But that parameter can't possibly be null"). If you're lucky, the problem is detected immediately in some way you can easily diagnose. If not, the error may propagate thru the program, finally crashing, but so far from the original bug that diagnosis is difficult. Even worse, the bug may not produce visible symptoms until after it has altered permanent data. Assert statements provide an easy means to check for impossible conditions, with little or no runtime cost.
Programmer, not user problems. The purpose or asserts is to detect programming errors, and they should not be used in the case of erroneous user input or actions.
Rate Tutorial: http://www.roseindia.net/java/java-tips/flow/assertions/assertions.shtml
Read
Tutorial at: Click here to view the tutorial
Rate Tutorial: Assertions
View Tutorial: Assertions
Related
Tutorials:
Test infect your
Enterprise JavaBeans - JavaWorld May 2000
Test infect your
Enterprise JavaBeans - JavaWorld May 2000 |
iContract: Design by Contract in Java - JavaWorld February
2001
iContract: Design by Contract in Java - JavaWorld February
2001 |
Language improvements
and models make
great Java - JavaWorld
Language improvements
and models make
great Java - JavaWorld |
J2SE 1.4
premieres Java's assertion
capabilities, Part
1
J2SE 1.4
premieres Java's assertion
capabilities, Part
1 |
J2SE 1.4
premieres Java's
assertion capabilities, Part 2
J2SE 1.4
premieres Java's
assertion capabilities, Part 2 |
Implement Design
by Contract for Java using dynamic proxies
Implement Design
by Contract for Java using dynamic proxies |
Is the JCP adequately preparing Java for Web services?
Is the JCP adequately preparing Java for Web services? |
Secure Web
services
Secure Web
services |
Good, but
obsolete
Good, but
obsolete |
WS-Specifications
WS-Specifications
The WS-Specifications build a composable architecture to form an environment for complex Web Service applications. Different vendors, such as BEA, IBM, Microsoft, RSA Security and SAP, have joined forces to lay the foundation of secure |
Java validation with dynamic proxies
Decouple validation processes from your business object implementations. |
UML 2.0 Sequence Diagramming
Modeling Complex Code in SunONE Studio with Embarcadero's Integrated Modeling Developement Environment, Describe. |
|
|
|