29 Dec '16, 6am

"Tell, Don't Ask" in Elixir: A Story of Pattern-Matching

“Tell, Don’t Ask” is a well-covered topic within object-oriented programming communities. Its goal? Encourage encapsulation by having the caller tell an object to do something instead of checking on state and acting upon it. Almost at odds with the control couple code smell, our goal is to have the caller issue explicit commands without concerning itself with object state. “Tell, Don’t Ask” in Elixir Is Elixir object-oriented? From a paradigm perspective, Elixir is a functional language when looking at aspects like immutability, pattern-matching, and functions with inputs and outputs, focused on the sending of messages to “objects” directly. How does “Tell, Don’t Ask” translate? Thinking about the goal, let’s do some mental mapping. In OOP, objects are a blueprint with information containing behavior (methods) and data (state). In FP, we have functions organized within mod...

Full article: https://robots.thoughtbot.com/tell-don-t-ask-in-elixir#wr...

Tweets

"Tell, Don't Ask" in Elixir: A Story of Pattern...

robots.thoughtbot.com 21 Dec '16, 12am

“Tell, Don’t Ask” is a well-covered topic within object-oriented programming communities. Its goal? Encourage encapsulatio...

Mile Markers: Before you can get the answer you want, you have to ask the question.

Mile Markers: Before you can get the answer you...

runnersworld.com 29 Dec '16, 5pm

My mind captured that thought and planted it, and I’ve been watering it ever since. What questions have I been withholding...

Do Jennifer Lopez and Drake have something to t...

seriouslyomg.com 28 Dec '16, 2pm

Did AT&T just come up with one the best commercials ever? Do Jennifer Lopez and Drake have something to tell us? Rabbi Cha...

The Story of Kickstarting the OpenMV

The Story of Kickstarting the OpenMV

hackaday.com 29 Dec '16, 7pm

Robots are the ‘it’ thing right now, computer vision is a hot topic, and microcontrollers have never been faster. These fa...

House Finch or Purple Finch? Here's how to tell these two doppelgangers apart:

House Finch or Purple Finch? Here's how to tell...

audubon.org 28 Dec '16, 5pm

Gradually, it will become easier to identify these finch es—but don’t get overconfident. Separating them requires care; yo...

Do your patients frequently ask about how #coff...

coffeeandhealth.org 30 Dec '16, 4pm

Can coffee improve my performance when I’m exercising? Yes. Research papers over many years have shown that caffeine in co...

Defectors tell US troops of challenges before a...

stripes.com 26 Dec '16, 9pm

SEOUL, South Korea — In a crowd full of one-time enemies, the former North Korean soldier quickly gained sympathy when des...