Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on 4a

 
Deza Linikeli
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • 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
 
dav mccartney
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • 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 ]
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • 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.
 
Asanka Nanayakkara
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic