Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submitting calculator AGAIN. #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lasiorhine
Copy link

Calculator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Describe how you stored user input in your program? I stored it in variables that I then subjected to misc validation and manicuring methods. (after each action, I changed the variable name,
How did you determine what operation to perform? I made a great big hash full of all the reasonable operation input I imagined a user could submit in good faith. I assigned each of these a value of 1, 2, 3, or 4, with 1 being addition, 2 being subtraction, 3 being multiplication, and 4 being division. Then, I used the user input to look up the operation number, assigned that to a variable, and used the variable to identify the correct option within a tree of ifs and elsifs.
Do you feel like you used consistent indentation throughout your code? After the 900,354,211 error messages I got about expected and unexpected "end"s, yes, I do. But man alive, it was not easy, and I would not be the least bit surprised if some of that is still borked, despite my best efforts
If you had more time, what would you have added to or changed about the program? Yeaaaah, so the numerical input validator is terrible. It uses the laziest possible Regexp, and it fails in a whole lot of edge and not-so-edge cases. There are other issues as well, but that's the one that will haunt my dreams. (If you're curious about what my original vision for that was, I left the (as it turns out, wholly divorced-from-reality) code from what I was originally trying to do in a comment at the end of the assignment. (And of course, I'd have loved to figure out the paren thing.)

@tildeee
Copy link

tildeee commented Feb 12, 2018

Calculator

What We're Looking For

Feature Feedback
Takes in two numbers and an operator and performs the mathematical operation. x
Readable code with consistent indentation. x

The theme is really great! I laughed.

Your calculator works really well!

I'm really impressed by how many operations you check for.

The variable names you use tend to be really long. They are very descriptive though, in a good way!

It wasn't a requirement for the project, but I'm surprised that the way you accepted user input varied. For instance, if the user puts in a blank input, the user gets a second chance (because you used a while loop). However, if they just put in something strange, they exit out of the program! Harsh. Just kidding. :) (Again, we didn't require a specific way of handling input, this is just a comment)

You used a hash for recognized_operations, and that's one of my favorite ways to have stored operations! Great!
The values for the recognized operations ended up mapping to something like "1=addition," "2=subtraction," etc. It works, but could you imagine that the "mapping" could be kind of weird or could get kind of weird? (For instance, what happens if you forget what "3" maps to? How painful would that be to look at and remember in 4 weeks?). Hold onto that feeling and we'll learn about maybe a better solution.

You used some intense/cool regex! (while /^[[:space:]]+[[:alnum:]]{0}\s*$/ =~ initial_user_input). We'll learn about how to write and use regex in a few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants