Skip to main content

Timeline for Letter-scoring Scrabble class

Current License: CC BY-SA 3.0

11 events
when toggle format what by license comment
Aug 26, 2015 at 21:03 history edited tokland CC BY-SA 3.0
edited body
Aug 26, 2015 at 12:46 history edited tokland CC BY-SA 3.0
deleted 94 characters in body
Aug 26, 2015 at 12:41 comment added tokland I like to give names to intermediate values instead of writing big chains of expressions. In my experience, it helps when you come to the method some time after. Just a matter of taste, I guess. Not that it's a big expression here, indeed.
Aug 26, 2015 at 12:36 comment added Caridorc I would avoid assignement in the score function, just use a newline.
Aug 26, 2015 at 8:35 vote accept user3813256
Aug 26, 2015 at 7:22 comment added tokland No need to rush, give the other users some hours to answer (things go slowly in CR...). If you have a constant value in a class, it's more declarative to make it so. Also, it's only defined once. values_at is better here because that's exactly what you need, it saves you a loop. That imperative style you wrote is not idiomatic in Ruby.
Aug 26, 2015 at 7:21 comment added user3813256 thank you - will accept soon if there are no better answers. +1. I agree on the strong interpolation comment. The expectation was to write imperative and not functional code (I agree with your statement on that end). Can you shed more light as to why using the class constant with values_at is preferable to the route I chose? I am curious to find out - thank you so much
Aug 26, 2015 at 7:17 history edited tokland CC BY-SA 3.0
deleted 4 characters in body
Aug 26, 2015 at 6:58 history edited tokland CC BY-SA 3.0
added 25 characters in body
Aug 26, 2015 at 6:35 history edited tokland CC BY-SA 3.0
deleted 5 characters in body
Aug 26, 2015 at 6:27 history answered tokland CC BY-SA 3.0