Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Data Structures Efficiency! Implement Chooser UI

In a real world app, would more robust input validation be coded initially or after the logic has been verified?

In the video we do not test (as of the 3:23 mark anyway) the user's input on the menu to make sure it's numerical and that it is within an acceptable range, e.g. if there are 10 menu options, the user cannot center 11.

In practice, would an app (or class thereof) be prototyped and tested with tailor made ("safe") inputs and conditions to ensure that its logic is sound, without rigorous validation, and then later revised to make it bullet proof? Would implementing potentially complex validation interfere with getting the basic functionality right or is it considered an indispensable part of the initial software design process?

Thank you

1 Answer

Hello,

I think it would partially have to depend upon the situation. If you want to have a "functioning" prototype ready as fast as possible, you would likely want to skip the validation and add it in afterwards. However, you can also add it in as you go, especially if that makes more sense to you and you're under no time constraints for getting a prototype up and running. The biggest thing is, that by the time you're "done" with that feature, that the necessary checks are in.

*These are mostly my opinions on the matter and different development shops might have different standards which very from shop to shop.