The long way through Software Craftsmanship

Self-Study in January 2017

Jan 1, 2017 - 7 minute read - Comments - self-study-aggregationjanuary2017readadditive-monadadvicealvaro-videlaamplifierauthoritybenjamin-hardybindc-sharpcode-completecoding-horrorcomonadcompound-interestcontinous-improvementdan-piponidata-structuredennis-forbesdisciplineeric-elliotteric-lippertessayfunctional-programminggerald-weinberghaskellhume-loganhunter-thompsoninterviewinterviewingisomorphicjames-coglanjavascriptjeff-atwoodkaizenleadershipleading-by-examplelifeliftlinreclong-term-plansmonadmonad-explanationmotivationmultirecnasapersonal-improvementplanningpoliticspsychologyquadtreerecruitementrecursive-data-structurereginald-braithwaiteshinystephen-toubtailrecteam-leadtestthomas-oppongtreeunitunit-test

Translation from Haskell to JavaScript of selected portions of the best introduction to monads I’ve ever read

I’ve read this article by James Coglan, introducing monads.

About composability:

The symmetry of the argument and return types is what makes these functions composable

or

symmetric input and output types

Guide to basic monadic functions:

lift, which converts a ‘simple’ function into a debuggable function bind, which converts a debuggable function into a composable form unit, which converts a simple value into the format required for debugging, by placing it in a container

The basic definition:

So what is a monad? Well, it’s a design pattern. It says that whenever you have a class of functions that accept one type of thing and return another type of thing, there are two functions that can be applied across this class to make them composable:

There is a bind function that transforms any function so that accepts the same type as it returns, making it composable There is a unit function that wraps a value in the type accepted by the composable functions.

Also:

[I]t’s a very useful design pattern to be aware of because it helps you spot accidental complexity: code that isn’t dealing directly with the problem at hand, but which is dealing with glueing data types together

Tags: monad, monad-explanation, haskell, javascript, james-coglan, bind, unit, lift

You Could Have Invented Monads! (And Maybe You Already Have.)

I’ve read this tutorial by Dan Piponi, in which he slowly introduces monads, using examples from everyday life.

Tags: dan-piponi, monad, monad-explanation, haskell

Monads, part one

I’ve read this article by Eric Lippert, in which he describes monads as a design pattern that “can sneak up on you”

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part two

I’ve read this article by Eric Lippert, in which he describes monad examples in the C# code. Also describes what an ‘amplifier’ is. I relate it to composing behavior.

An “amplifier” is something that increases the representational power of their “underlying” type.

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming, amplifier

Monads, part three

I’ve read this article by Eric Lippert, in which he describes how to wrap a value in a monadic wrapper (unit)

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part four

I’ve read this article by Eric Lippert, in which he explains the second function (bind)

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part five

I’ve read this article by Eric Lippert, in which he explains the three laws, which are later compressed into two (unit and bind)

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part six

I’ve read this article by Eric Lippert, in which he explains the logical identity of applying the function inside a monad and outside a monad.

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part seven

I’ve read this article by Eric Lippert, in which he states the three laws of monads:

  • Applying the construction function to a given instance of the monad produces a logically identical instance of the monad.
  • Applying a function to the result of the construction function on a value, and applying that function to the value directly, produces two logically identical instances of the monad.
  • Applying to a value a first function followed by applying to the result a second function, and applying to the original value a third function that is the composition of the first and second functions, produces two logically identical instances of the monad.

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part eight

I’ve read this article by Eric Lippert, in which he describes the monad terms he was using other, more common names (unit and bind).

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part nine

I’ve read this article by Eric Lippert, in which he creates a Tainted monad, which is basically a Nullable or Maybe monad

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part ten

I’ve read this article by Eric Lippert, in which he describes Where (as the query syntax form) using the bind signature

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part eleven

I’ve read this article by Eric Lippert, in which he describes the “additive monad”:

  • There is a zero value of every construction of the monadic type.
  • There is a way to add two monads with the same underlying type together.
  • The zero value is the identity of the add operation.
  • Using bind to apply any function to the zero produces the zero.
  • Using bind to apply the function a=>zero to any M<A> produces the zero.

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming, additive-monad

Monads, part twelve

I’ve read this article by Eric Lippert, in which he explains how the SelectMany could be implemented (but it is not implemented in practice)

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming

Monads, part thirteen

I’ve read this article by Eric Lippert, in which he suggests reading a similar article on the Task comonad

Tags: eric-lippert, monad, monad-explanation, c-sharp, functional-programming, comonad

Tasks, Monads, and LINQ

I’ve read this article by Stephen Toub in which he explains the comonad Task.

A comonad:

[…] dual of a monad, a triple consisting of the type and two operators: Extract (the flip of Unit/Return) and Extend (the flip of Bind)

Tags: comonad, monad, monad-explanation, stephen-toub, c-sharp, functional-programming

5 Questions Every Unit Test Must Answer

I’ve read this article (titled as a listicle) by Eric Elliot about unit tests:

  • What are you testing?
  • What should it do?
  • What is the actual output?
  • What is the expected output?
  • How can the test be reproduced?

Tags: eric-elliott, javascript, unit-test, test

Why You Should be Planning for 2018, Not 2017.

I’ve read this article by Benjamin P. Hardy on motivation, planning and designing your life.

Some quotes:

[…] having the power to make choices:

  • The right to choice
  • The responsibility to choose
  • The results of choice

[…] hope reflects your perceptions regarding your capacity to:

  • clearly conceptualize goals
  • develop the specific strategies to reach those goals (i.e., pathways thinking)
  • initiate and sustain the motivation for using those strategies (i.e., agency thinking).

[…] motivation involves three components:

  • the value you place on your goal
  • your belief that specific behaviors will actually facilitate the outcomes you desire
  • your belief in your own ability to successfully execute the behaviors requisite to achieving your goals

Tags: benjamin-hardy, motivation, life, planning, long-term-plans

Get 5% Better

I’ve read this article, in which the author explains how compound interest does not only apply to investing and saving but also personal improvement.

Tags: kaizen, personal-improvement, compound-interest

Hunter S. Thompson’s Letter on Finding Your Purpose and Living a Meaningful Life

I’ve read this letter from Hunter S. Thompson to his friend Hume Logan, containing advice on living your own life: must find your own way, decide between floating or swimming to your goal and strive to be yourself.

Tags: hunter-thompson, hume-logan, advice, psychology, life

The Japanese philosophy of Kaizen offers an effective, manageable way to achieve long-term goals

I’ve read this article by Thomas Oppong on kaizen, or continuous improvement, and how it applies like compound interest to your life.

Tags: kaizen, continous-improvement, thomas-oppong, compound-interest, life, psychology

Preparing for a Software Interview

I’ve read this article by Alvaro Videla on interviewing technical people.

Tags: recruitement, interviewing, interview, alvaro-videla

Why Recursive Data Structures?

I’ve read this essay by Reginald “Raganwald” Braithwaite, on which he introduces the relationship between data structures and algorithms. Explains how the algorithm can be split into parts, following the data structure.

Uses a library containing a function called multirec for recursion:

Tags: reginald-braithwaite, recursive-data-structure, quadtree, javascript, functional-programming, essay, data-structure, isomorphic, tree, multirec, linrec, tailrec, haskell

Leading by Example

I’ve read this article by Jeff Atwood on how the best leadership comes from doing, rather than telling how to do it. From being a leader rather than being a boss.

Suggests further reads.

Tags: leadership, team-lead, leading-by-example, jeff-atwood, gerald-weinberg

Discipline Makes Strong Developers

I’ve read this article by Jeff Atwood on a project sucess should not be attributed to a language or framework, but to the team’s and individuals’ discipline.

Also explains how small projects require different levels of discipline than large projects.

Tags: leadership, discipline, nasa, code-complete, coding-horror, jeff-atwood

Effectively Integrating Into Software Development Teams

I’ve read this article by Dennis Forbes about authority and discipline in a team.

One organization’s Enterprise solution is another organization’s short sighted mistake.

Tags: shiny, dennis-forbes, discipline, authority, psychology, politics

Books read in 2016Q4 Self-Study in February 2017

comments powered by Disqus