Do we really need assertions?

Yesterday, an interesting post about Abusing assertions for debugging purposes! come from DaVinci’s Code blog. If you read comments, you see that I don’t think that assertion are somehow so much useful.
That’s because I never used assertions and I never seen assertion used. I rarely heard discussing about assertion, and this is the 2nd time I see assertion used for logging purposes. Testing code with junit or things like that is much more needed than placing dummy checks.

This means two things:

  1. Assertions are nice, for professors at colleges and their students.
  2. Runtime directives to enable/disable some code could be helpful, maybe using jvm options (so the jvm can just ignore some statements). But it should be something more general than one option related only to assertion. Logging is another aspect of things that can take advantages of a feature like this, but there could be other aspects, and this should be left to be decided by the programmer

Many stuff has been taken off Java when it was designed. I think that assertion is one of those things that no one never asked for.


No Responses to “Do we really need assertions?”  

  1. No Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



Calendar

July 2005
M T W T F S S
« Jun   Aug »
 123
45678910
11121314151617
18192021222324
25262728293031

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening