• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

assertions

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Remember that assertions are disabled by default!!!
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic