• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Assertions

 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
Here's what can be found in Complete Java 2 Certification Study Guide, p.163, Chapter 5 (Flow Control, Exceptions, and Asseertions).


This example demonstrates that assertions are appropriate for checking preconditions in any method regardless of access, and for checking post-conditions in private methods


I believe this is wrong, and is supposed to be exactly the inverse:


This example demonstrates that assertions are appropriate for checking postconditions in any method regardless of access, and for checking pre-conditions in private methods


Am I right on this subject?
Thanks for your reponse,
Cyril.
 
Ranch Hand
Posts: 443
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



This example demonstrates that assertions are appropriate for checking postconditions in any method regardless of access, and for checking pre-conditions in private methods


I agree with you. That seems to be the right statement.
Public methods will probably have pre-condition checks as part of its code because its signature or specification is published. Private methods, on the other hand, probably will not have this because they act like helper methods to the public methods. They expect that the parameters had been validated before passing it to them.
Just my $0.02
[ July 31, 2003: Message edited by: Alton Hernandez ]
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should be the way that you corrected it.
 
Thomas Paul
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check the errata page for the correction:
http://www.sybex.com/erratatracking.nsf/weberrataform?OpenForm&ISBN=4077
 
cyril vidal
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Thomas!
 
it's a teeny, tiny, wafer thin ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic