Win a copy of Svelte and Sapper in Action this week in the JavaScript 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 ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Question on 4a

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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!
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 ]
Posts: 9099
  • 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.
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.
    Bookmark Topic Watch Topic
  • New Topic