Skip to content

resistor-colors: add new exercise #1466

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

Merged
merged 13 commits into from
Mar 8, 2019

Conversation

ErikSchierboom
Copy link
Member

Closes #1464.

Copy link
Contributor

@emcoding emcoding left a comment

Choose a reason for hiding this comment

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

I updated the texts to reflect what 'significant figure' exactly means. Is it still clear?

Thanks for creating the exercise. It looks good fun!

@ErikSchierboom
Copy link
Member Author

@F3PiX I've updated the PR. I am wondering if people won't expect an array/list for the expected value, as the property "significantFigures" does seem to imply that. But maybe they won't :)

@emcoding
Copy link
Contributor

@ErikSchierboom I see what you mean re: the property. 🤔 Is Value a better name then?
ResistorSignificants#value makes sense to me.

@ErikSchierboom
Copy link
Member Author

I like value!

@emcoding
Copy link
Contributor

😍

@rpottsoh
Copy link
Member

What Topic(s) are you envisioning for this exercise?

@ErikSchierboom
Copy link
Member Author

What Topic(s) are you envisioning for this exercise?

It depends a bit on the language involved, but what I envision is that students will now have to learn how to combine to individual numbers into a single number. There are several ways to do that, so it can be quite interesting.

rpottsoh
rpottsoh previously approved these changes Feb 24, 2019
@iHiD
Copy link
Member

iHiD commented Feb 24, 2019

Could you hold off merging this until @kytrinyx has had chance to take a look pls?

@ErikSchierboom
Copy link
Member Author

Yes please wait. I think I may have missed part of the original plan for the series.

@ErikSchierboom
Copy link
Member Author

I've updated the PR. What changed is that instead of passing the colors as separate arguments, they are now passes as an array. This keeps them in line with the array-theme of the series.

@rpottsoh rpottsoh requested a review from kytrinyx February 25, 2019 15:21
@rpottsoh
Copy link
Member

I have been reading over the comments here and wonder if perhaps colorCode might not be a better property name than value? Perhaps you are holding back using colorCode for when the entire code for a given resistor is to be decoded?

@ErikSchierboom
Copy link
Member Author

Perhaps you are holding back using colorCode for when the entire code for a given resistor is to be decoded?

Actually, we already used it: https://github.com/exercism/problem-specifications/blob/master/exercises/resistor-color/canonical-data.json :)

@kytrinyx
Copy link
Member

I'm a bit late to the party here, and I am sorry for delaying the process.

I'm going to take a really big step backwards here, and not talk about this resistor exercise, but rather I'd like to talk about something which @iHiD and @nicolechalmers and I have been mulling over for some time now.

To start, I'd ask that you read this issue: #1470.

To summarize: we think that one fundamental change that we could make to Exercism to make the site more engaging is to ensure that each exercise is defined by a story. This helps add color and an element of liveliness (fun?) to the exercise, but much more than that, it helps avoid a situation where an exercise feels overwhelming or foreign or "too hard" (even when it is actually simple). We've found that sometimes the words that we use, or the way that we describe things can make something seem much harder than they actually are.

So for the resistor exercises: what does it look like to strip away all the surrounding details from the technical problem? At it's very core, what is each of the resistor exercises asking you to do?

@ErikSchierboom
Copy link
Member Author

At it's very core, what is each of the resistor exercises asking you to do?

I think @F3PiX will probably know this better than me, but I figure we could perhaps write this exercise from the viewpoint of a mechanic or something like that? Someone that sees a resistor, and then has to try and figure out its use, or something like that.

@emcoding
Copy link
Contributor

First, I'm a big fan of adding stories to exercises, so 💯 .

Then, as so many tracks are really suffering by a lack of easy exercises like this, especially this easiest iterator, I'd vote for not holding up this PR because of the story. We could easily work on the story-telling after this exercise is launched, we can leave the exercise's issue open for that or reopen the series introduction issue, and delete this exercise as soon as there is a better story telling alternative.

What do you think @kytrinyx?

@kytrinyx
Copy link
Member

To be honest, I find this exercise really difficult to understand. I don't know anything about resistors, and reading through this I am having a bit of anxiety trying to get past the unfamiliar jargon to figure out what I actually would have to do to solve it.

Copy link
Contributor

@emcoding emcoding left a comment

Choose a reason for hiding this comment

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

Let's keep this on hold until we have the story sorted out.

@emcoding
Copy link
Contributor

emcoding commented Feb 26, 2019

That's not good!!
I'm moving this conversation to the issue #1464. I tried to block the PR for merging, but I can be overruled ;-)
Anyway, we're not merging until we get the story sorted out.

@rpottsoh
Copy link
Member

rpottsoh commented Mar 8, 2019

I've posted a comment regarding the description but otherwise everything looks good to me too. 👍

Co-Authored-By: ErikSchierboom <erik_schierboom@hotmail.com>
@ErikSchierboom
Copy link
Member Author

I've posted a comment regarding the description but otherwise everything looks good to me too

I've applied the comment. Anything else?

@rpottsoh
Copy link
Member

rpottsoh commented Mar 8, 2019

LGTM. Thanks @ErikSchierboom

@ErikSchierboom ErikSchierboom merged commit e1c6d44 into exercism:master Mar 8, 2019
@ErikSchierboom ErikSchierboom deleted the resistor-significants branch March 8, 2019 16:42
@ErikSchierboom
Copy link
Member Author

Squashed and merged! Thanks for the reviews everybody!

@rpottsoh
Copy link
Member

rpottsoh commented Mar 8, 2019

I apologize if I was too vague on my approval (or lack of it) as it related to my suggested change regarding calling bands strips. I felt strongly enough about the suggested change to mention it, but not strongly enough to require it be changed before giving approval (in GitHub terms). Thanks for making the change!

@ErikSchierboom
Copy link
Member Author

No problem!

emcoding added a commit to exercism/website-copy that referenced this pull request Mar 10, 2019
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
@sshine
Copy link
Contributor

sshine commented Mar 11, 2019

@kytrinyx wrote:

I find this exercise really difficult to understand

So do I. But mostly because the exercise does not describe what problem to solve, only the problem domain.

@iHiD wrote:

we're planning on removing anything from the README.MD other than the contents of description.md

Do you mean stuff like how to get started with the track, extra exercise hints, etc.?


And now for my question, since @tejasbubane just ported this exercise to Haskell in exercism/haskell#808:

If value ["black"] == 0, then what is value []? Is that an error? Also 0?

@emcoding
Copy link
Contributor

And now for my question, since @tejasbubane just ported this exercise to Haskell in exercism/haskell#808:

If value ["black"] == 0, then what is value []? Is that an error? Also 0?

0 is valid.
In case it helps: There's always two colors passed in in the tests, and they return a integer composed out of 2 digits.

@sshine
Copy link
Contributor

sshine commented Mar 11, 2019

So [], ["black"], ["black", "black"] etc. are synonymous. and their value is 0.

The tests don't specify what happens to empty input.

The resistor illustrations at #1464 all have three colors.

I can see from googling around a little that there can be many color bands, and that in practice you wouldn't have a resistor without colors, since you'd call that a wire. So I suppose that tracks are free to interpret [] either as not well-defined, or as a zero-resistor.

@ErikSchierboom
Copy link
Member Author

The tests don't specify what happens to empty input.

This is correct. There is no error handling defined in the tests. Tracks are free to handle errors as they like, possibly adding test cases.

The resistor illustrations at #1464 all have three colors.

I believe there is special significance for the first two colors, isn't there @F3PiX?

@emcoding
Copy link
Contributor

Value 0 would also be a wire .

tracks are free to interpret [] either as not well-defined, or as a zero-resistor.

Just keep in mind that we deliberately left that out, as this is meant to be nr 2 in a series with increasing complexity. The input validation would be an extra layer that we intend to add to nr 3. (And nr 3 is also going to calculate the value of all three color bands.)

This post for the previous one, nr 1, tells a bit more: #1458

sshine pushed a commit to exercism/haskell that referenced this pull request Mar 12, 2019
This commit adds the `resistor-colors` exercise.

Problem Specification: exercism/problem-specifications#1466.

An algebraic type was chosen for the colors instead of strings to avoid a focus
on error handling.
@cmccandless
Copy link
Contributor

I believe there is special significance for the first two colors, isn't there @F3PiX?

This question wasn't directed at me, but I can answer it: on a 3-band resistor, the 3rd band is a multiplier on the number created by the first 2. So technically, the 3rd band is the one with special significance, not the first 2.

@ErikSchierboom
Copy link
Member Author

Right, that makes sense. Thanks for explaining!

tejasbubane added a commit to tejasbubane/xjavascript that referenced this pull request Mar 22, 2019
@emcoding emcoding added new exercise idea Track Anatomy Project Related to or helpful to the Track Anatomy Project labels Mar 26, 2019
tejasbubane added a commit to tejasbubane/xjavascript that referenced this pull request Mar 26, 2019
SleeplessByte pushed a commit to exercism/javascript that referenced this pull request Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new exercise idea Track Anatomy Project Related to or helpful to the Track Anatomy Project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants