Skip to content

Instantly share code, notes, and snippets.

@philsof
philsof / code-review-for-pair-edwardgemson-university-course-database-design-challenge.md
Last active January 26, 2016 06:18
code-review-for-pair-edwardgemson-university-course-database-design-challenge

Good effort! Ok there are a bunch of issues with your schema. It looks like you got confused when implementing the sections. Take a look at your relationships, and remember: the "one" side of a relationship is the side that has the id primary key, and the "many" side is the side that has the foreign key (which is always [name-of-other-table]_id)

So right now, these are your assocations: ###Good associations:###

  • a student can have many classes, and a class can have many students [GOOD; this is the red line and black line attached to the students_classes table]
  • one class can have many sections, and a section can have only one class [GOOD; this is the black line attached to the sections table]
  • a teacher can have many sections, and a section can have only one teacher [GOOD; this is the dark blue line]

###Half good, half not good

@philsof
philsof / code-review-pair-dandersen2,mirascarvalone-poll-database-design-challenge.md
Last active January 26, 2016 06:18
code-review-pair-dandersen2,mirascarvalone-poll-database-design-challenge

Your schema is solid, good work! Your Users_and_Polls table is the key to your schema design. You realized the need for a table that contains the unique combination of one user, one poll, and one response. And you did so without compromising the poll creating association (one user can create many polls, but each poll can only be created by one user) and the response creating association (one poll can have many responses, but each response can only have one poll) and the voting association (one user can vote on many polls, and one poll can be voted on by many users). Do you realize what this means? It means you are really getting this database design stuff. CONGRATS!

Here are some tips to sharpen everything:

  • The default names of your tables need to conform to naming convention. Table names should be plural, lowercase, with _ between
@philsof
philsof / code-review-pair-espezua,superboyblue-active-record-drill-model-a-student-challenge.md
Last active January 26, 2016 06:18
code-review-pair-espezua,superboyblue-active-record-drill-model-a-student-challenge

This is good stuff! Your code passes all of the tests! Here are some notes:

  • Nice handling of full names with 2+ words! Your code can handle any crazy long name that comes its way. Sweet!
  • Nice custom validation method age_more_than_five
  • This may be picky, but FYI: Your regexp for your phone number validation has spaces in it. The best way to reference the space character in a Ruby regexp is \s (although according to this table, the space character will work, as it does in your code). Just keep this in mind for best practices.
  • In your [full_name method]
@philsof
philsof / code-review-mirascarvalone-ruby-racer-1-outrageous-fortune-challenge.md
Last active January 26, 2016 06:17
code-review-mirascarvalone-ruby-racer-1-outrageous-fortune-challenge

Good work on this! Your code works; it does exactly what the challenge asks for. And your methods all have a single responsibility and are easy to read. Some notes on details:

@philsof
philsof / code-review-pair-kerryimai,plonsker-orange-tree-2-groves-challenge.md
Last active January 26, 2016 06:17
code-review-pair-kerryimai,plonsker-orange-tree-2-groves-challenge

Good stuff getting to this challenge! Here are my notes on your code:

  • It looks like you have methods on your specific tree classes that are similar. For example, OrangeTree.has_oranges? and PearTree.has_pears?. This is a code smell. You could DRY out your code by putting a has_fruit? method on the FruitTree class. This way, every child class of FruitTree will have a has_fruit? method. Tada! Can you find any other ways to DRY out your code? Hint: look for similarly-worded methods that appear in all of your tree classes.

  • Each of your tree classes has a few lines of code in its age! method that needs to be rethought. Here are those lines, from the AppleTree class:

    if age > 3 && age < 17
      new_number = rand(10..
@philsof
philsof / code-review-roman-numerals-challenge-branch-kbjk.md
Last active January 26, 2016 06:17
code review for kbjk branch on roman-numerals-challenge

Your code works, and is easy to follow. Nice! Here are some notes from me:

  • Be sure you use names that clearly convey what your objects are/are doing. Specifically: On line 2 of your code, you declare a variable named new_array. That name is way too vague. From its name, all I know is that it is an array. How about something like roman_num_array? It needs to be something that tells me what the variable represents.
  • Your approach to this challenge is sound. You realized the need to start with the largest Roman numeral amount (1000) and work your way down, and decrease your Arabic number along the way. But there are better ways that eliminates the need to use any while loops (or any loops at all). Hint: check out these methods: div and [divmod](http://ruby-doc.org/cor
@philsof
philsof / code-review-branch-andy4626_and_greensneakers-for-algorithm-drill-shuffle-challenge.md
Last active January 26, 2016 06:17
code-review-branch-andy4626_and_greensneakers-for-algorithm-drill-shuffle-challenge

This is good stuff. Your code does the job and passes all of the tests. Here are some notes:

  • One of your variable names is too vague. Instead of new_array how about dup_of_array or something that indicates what the array is holding/why you need it.
  • You are creating a duplicate array in a very unconventional manner. Check out clone and dup for a better way to do this. (Hint: one of these will be better than the other.)
  • Good use of until and rand and &lt;&lt; and length and especially slice!, which is taking care of two needs simultaneously (removing and
@philsof
philsof / code-review-branch-pair-superboyblue-for-algorithm-drill-factorial-challenge.md
Last active January 26, 2016 06:17
Code review: branch pair-superboyblue for algorithm-drill-factorial-challenge

Your code gets the job done and passes all the tests. Nice! Some notes:

  • Your code is concise and clear. And it works. Good stuff.
  • Heads up: This line of code is being made more complicated by this line of code. Specifically, when you create your array on line 3, you are using ... (three dot operators), which tells Ruby to create an array that does not include the starting and ending values (thus, 1 and n are not included in the array). Because of this, you have to add n to your reduce arguments, since n is not in your array.

You can simplify your code in two ways. First, by changing your array declaration to:

array = (1..n) # notice the two dot operators, not th
@philsof
philsof / code-review-pair-jdun10,plonsker-pig-latin-challenge.md
Last active January 26, 2016 06:17
Code review pair-jdun10,plonsker branch for pig-latin-challenge

Good work on this. Here are my notes on your code:

  • Nice use of rotate! This method takes care of two needs simultaneously, which is cool.
  • A quick note: There is no need for the 1 argument to be passed to rotate!, since it is passed by default. (See the docs on rotate! here). You can safely remove that argument.
  • Also heads up: if you were to run convert_word_to_pig_latin on a word that does not contain a vowel (like "why") your code would enter an infinite loop. (Your until loop would keep running forever.) How could you refactor your code to fix this bug?
  • Watch your indentation. Especially here, because it becomes difficult to read your code.

Good

@philsof
philsof / code-review-pair-plonsker-active-record-intro-belongs-to-association-challenge.md
Last active January 26, 2016 06:17
Code review for branch pair-plonsker on active-record-intro-belongs-to-association-challenge