Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

assertions

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again!
I am having problems with figuring out the usage of Java's asssertions. I know that they are primarily intended for testing reasons and they can disabled/enabled etc.
But can anyone of you give me an example how these assertions related things can be tested in the exam? Can f.ex anyone that already has passed the programmer test, recall from their experiences how this feature was tested in their particular exam?
I would appreciate your experiences very much!
Cheers,
janne
 
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Janne,
Look at the questions related to assertions Dan has posted on this site:
http://www.danchisholm.net/
These will give you an idea about the type of questions to expect on the exam.
Thanks.
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that assertions are disabled by default!!!
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Questions can be asked on the appropriate use of assertions. For example, they might show a public method where assertions are used to validate passed parameters and ask if this is a valid use of assertions.
 
Author
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first column in the Java Developer's Journal was "Using Assertions". You can read it at http://www.sys-con.com/story/?storyid=34283. Even experienced programmers are sometimes not sure when to use assertions. It is a difficult subject.
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure how many use Assertions in their programs.
[ October 22, 2003: Message edited by: Pradeep Bhat ]
 
Ranch Hand
Posts: 805
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a C background, and I have to do some stuff in C++. I celebrated when Sun added assertions because I found them invaluable in testing C/C++ code to make sure things don't break from passing invalid arguments, etc. Because Java doesn't permit conditional compilation as such, assertions are the closest tool the Java programmer gets to a conditional compilation.
Remember, assert is a programmer/tester debugging and testing tool; don't put any code in your assertions that the program relies on. I think that once the Java community appreciates the power of assertions, they (assertions) will be much more widely used and understood.
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic