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

Question on 4a

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It's it odd to enjoy getting nitpicked? I really am enjoying this assignment but had a question concerning the method, other than the main method.

After reading the make your own method in preparation for 4b I realized that the more specific methods were private. So I changed mine from public to private. Now that it�s private how concerned with validating input should I be? Is it correct to check if the parameter is not null? In the example no validation is done, so does that mean since it is private the members of your class that use it are responsible for the validation?

Also, is it common set the value for a number between 0-19 in the main method, or do most move it out to the other method?

Thanks for such a great place to learn, and for patience and quick nitpickers!
Dez
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll chime in here really quick, but I'm sure others will have more to say

You probably want to validate the data before passing it on to the private method. If you look at some of your instructor solutions, you'll see how they've validated early on, well before any other methods are called.

So, if you validate on the outside, you won't have to on the inside (at least in this case)

Also... you'll probably have to have more than 1 method of your own

Good luck to you!
[ August 24, 2004: Message edited by: dav mccartney ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point about validating before passing the data, Dav.

In Assignment 4a, some people don't need more than just the main method. However, in Assignment 4b, a student definitely needs more than one method.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first place to validate your data is whenever you get an input or asign your data. Its like getting security clearance before you entering a top secret building. Security check at the entrance.
 
Where does a nanny get ground to air missles? Protect this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic