Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### A NOTE ON MY VALIDATION
- The condition I wrote is so long because I wanted to be able to validate the following kinds of input;
- * no input `""`
- * one digit after a decimal `"10.0"`
- * more than 2 numbers after a decimal `"10.00000"`
- * negative numbers `"-30"`
- I originally wanted to have different messages for each invalid input, to personalize the user's experience, but when I starting writing an `if` statement for it...I realized how involved it would be. I thought it would have been overkill for this assignment, so I went with one generic message and compiled all of my validation code into one condition, connected with `||` and `&&` comparison operators where appropriate.
- Would it have been better to create different methods for each type of validation to keep with the "one method, one responsibility convention"? I could see it going both ways...
- I made a separate validation method (rb:20) for the loan duration because it required a different validating condition.
- ### A NOTE ON MY INPUT METHODS
- Just like my validation methods, I kept the method used to get user input for the loan duration separate because I couldn't have it being converted into a float since my `#validate_term` method would evaluate to false if were one.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement