Skip to content

Commit

Permalink
Ruby/Resistor Colors: Add Mentor Notes
Browse files Browse the repository at this point in the history
We are about to merge the new exercise Resistor Colors.
It's introduced as a side exercise first, so I don't expect much mentoring requests, but just in case, here's some preliminary Mentor Notes.  They will need evaluating after we've seen some solutions submitted. 

References:
Ruby PR https://github.com/exercism/ruby/pulls
Problem Specifications: exercism/problem-specifications#1466
This exercise is meant to be part of a series of Resistor exercises, building up to decoding up to 6 colors: exercism/problem-specifications#1458, and starting with just one color in Resistor Series nr 1
  • Loading branch information
emcoding authored Mar 10, 2019
1 parent b726f04 commit 8c3023a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tracks/ruby/exercises/resistor-colors/mentoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Resistor Colors is a side exercise, unlocked by Hello World

### New Concepts
Array, Array#index, `map`, Constant, chaining methods

### Minimal solution for approval
```ruby

class ResistorColors

COLOR_CODES = ["black", "brown", "red", "orange", "yellow", "green", "blue", "violet", "grey", "white"]

def self.value(colors)
colors.map { |color| COLOR_CODES.index(color) }.join.to_i
end

end

```

### General
This is the very first Array exercise, and the first loop. Introducing `map` is key in this exercise. At this point in the track, there's no need to address `.freeze`.

### Talking points
- _`%w` notation_: for arrays of strings. Link to [styleguide](https://github.com/rubocop-hq/ruby-style-guide#percent-w)
- _chaining methods_ after a block (especially when people use a local variable for `join.to_i`
- _`each` vs `map`_: this explains the difference: [each vs map](https://learn.onemonth.com/ruby-tutorial-map-vs-each/)
- _variable vs constant_: this article explains just that: [var vs constant](https://ruby-doc.org/docs/ruby-doc-bundle/Tutorial/part_01/variables.html)

### Changelog
First introduced 2019 Mar 10

0 comments on commit 8c3023a

Please sign in to comment.