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

Sockets - Pauline #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Sockets - Pauline #46

wants to merge 3 commits into from

Conversation

paulentine
Copy link

@paulentine paulentine commented Feb 8, 2019

Portmanteau Generator

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
What went well in your code style, such as indentation, spacing, variable names, readability, etc.? What was lacking? I tried to make my variable names as descriptive as possible and I think the code looks quite fine stylistically; Devin's tip to set tab to equal 2 spaces was very helpful.
How did creating the is_vowel? method affect your project? Creating and reusing this method has helped my code stay DRY (not having to repeat when checking for vowels)
What was your strategy for getting the correct set of letters from the first word into the portmanteau? I created a method to look for the last vowel, the index of which is to be stored in the var last_index, which was initialized as the length of the word. Iterating through each character of that word, I check if it's a vowel. If it is a vowel, its index gets assigned to update the current last vowel's index. Knowing the last vowel's index, I used it to split the first word.
What was your strategy for validating against inputs under 2 characters? I used a do while loop to prompt the question at least once, breaking when condition of word.length > 1 is fulfilled
In the next project, what would you change about your process? What would you keep doing? In the coming projects, I will test each chunk of code I write (e.g. using puts as a sanity check) to make sure it's bug free before incorporating to the rest of the code. Writing a pseudocode was really helpful in organizing my thought process, especially in keeping track of the plan of attack on how to split the two words.

@dHelmgren
Copy link

Portmanteau Generator

What We're Looking For

Feature Feedback
Readable code with consistent indentation Good!
Practices using variables appropriately Yes
Practices using conditionals appropriately Yes
Practices iteration appropriately Yes
Practices using custom methods appropriately Yes
Program validates against input under 2 characters yes
Takes in two inputs and creates a portmanteau yes

Copy link

@dHelmgren dHelmgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, my comments are mostly to help you keep growing and analyzing this code!

# Program will repeat until user does not answer "yes" to restart prompt at the end
run = "yes"
loop do
break if run != "yes"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be more succinct (and conventional) to write the above as follows:

while run != "yes" do

# Get first word, with a do while loop to reprompt if input is invalid
puts "What is the first word to combine?"
loop do
word_one = gets.chomp.downcase

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job catching capital letters

end

# Method to find last vowel
def find_last_vowel (word)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way you could combine find_first_vowl and find_last_vowel?

end

# Method to create the second word
def create_word_two(word)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, is there a way to make these two functions into just one?


# Prompt to restart
puts "Would you like to continue? (yes / no)"
run = gets.chomp.downcase

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some programs use y and yes interchangeably for this purpose. How would you accommodate this?

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