The long way through Software Craftsmanship

Clojure and the macro and

Dec 8, 2015 - 3 minute read - Comments - clojuremacroandreplfunctionmacro-vs-function

While on the REPL, I tried this:

simple.core=> (reduce and true [true])
CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(form-init7116694665186998245.clj:1:1)

Reading the clojuredocs for and, you can find this:

Note add is a macro, so you cannot apply it. For example, there is a vector of some Boolean values [true true false true], which you want to test to see if they are all true. The code below will not work:

(apply add [true true false true]) ;won’t work

Instead, use this:

(every? identity [true true false true])

I tried it with success. Digging a bit deeper:

simple.core=> (defn all-truthy? [& elements] (every? identity elements))
#'simple.core/all-truthy?
simple.core=> (all-truthy? nil false)
false
simple.core=> (all-truthy? nil 0)
false
simple.core=> (all-truthy? nil 1)
false
simple.core=> (all-truthy? 2 1)
true
simple.core=> (all-truthy? [nil false])
true

Was also tempted to try this:

simple.core=> (reduce (fn [acc element] (and acc element)) true [true true false true])
false
simple.core=> (reduce (fn [acc element] (and acc element)) true [true true true true])
true

Encapsulate it into a function:

simple.core=> (defn all-true [& elements] (reduce (fn [acc element] (and acc element)) true elements))
#'simple.core/all-true
simple.core=> (all-true true)
true
simple.core=> (all-true true false)
false
simple.core=> (all-true true false true)
false

What happens with the non-boolean values?

simple.core=> (all-true 1 2 3)
3
simple.core=> (all-true 1 2 3 76)
76
simple.core=> (all-true 1 2 3 64)
64
simple.core=> (all-true 1 2 3 64)
64

This is because:

simple.core=> (and 64 3)
3
simple.core=> (and 3 64)
64

Conclusion

all-truthy? exploits the falsy values in clojure (nil, false), while all-true uses the true boolean values, although the function does not work properly with non-boolean values (i.e. its domain is the booleans)

Appendix A: Source code

and:

simple.core=> (source and)
(defmacro and
  "Evaluates exprs one at a time, from left to right. If a form
  returns logical false (nil or false), and returns that value and
  doesn't evaluate any of the other expressions, otherwise it returns
  the value of the last expr. (and) returns true."
  {:added "1.0"}
  ([] true)
  ([x] x)
  ([x & next]
   `(let [and# ~x]
      (if and# (and ~@next) and#))))

identity:

simple.core=> (source identity)
(defn identity
  "Returns its argument."
  {:added "1.0"
   :static true}
  [x] x)

every:

simple.core=> (source every?)
(defn every?
  "Returns true if (pred x) is logical true for every x in coll, else
  false."
  {:tag Boolean
   :added "1.0"
   :static true}
  [pred coll]
  (cond
   (nil? (seq coll)) true
   (pred (first coll)) (recur pred (next coll))
   :else false))

->:

simple.core=> (source ->)
(defmacro ->
  "Threads the expr through the forms. Inserts x as the
  second item in the first form, making a list of it if it is not a
  list already. If there are more forms, inserts the first form as the
  second item in second form, etc."
  {:added "1.0"}
  [x & forms]
  (loop [x x, forms forms]
    (if forms
      (let [form (first forms)
            threaded (if (seq? form)
                       (with-meta `(~(first form) ~x ~@(next form)) (meta form))
                       (list form x))]
        (recur threaded (next forms)))
      x)))

Tip: automate the blog publishing

Dec 2, 2015 - 1 minute read - Comments - metaautomationblogtraviscioctopress

I’ve automated the generation of the blog using Travis CI. Using this new way, each commit generates a new version of the pages.

These resources have been very useful:

An example of the resulting repository, by Hari Menon.

My own modifications

The full diff for making this change is here. Disregard the changes in:

  • partial/1444939871_diff.txt
  • partial/1444939871_msg.txt
  • source/_posts/2015-12-02-self-study-in-december-2015.markdown

Self-Study in December 2015

Dec 2, 2015 - 17 minute read - Comments - self-study-aggregationDecember2015read10x-engineer2015abstract-syntax-treeacceptance-testactive-passiveactor-modeladviceaestheticsagilealain-helailialan-skorkinallison-kapturanalogyanarchyandrew-burgessangularanswerantipatternapplication-gatewayarchetypeastbankbarcelona-software-craftsmanshipbddbenchmarkbenjamin-hoffmanbidibinary-searchbonilistabookbook-reviewbozhidar-batsovbranch-mispredictionbruceSchneierbus-factorbusiness-metricbusiness-ruleccareercareer-changecareer-managementcarol-dweckchallengechangechaptercheatingcheatingsoftwarechris-fordclangclean-codeclear-codeclever-codeclientclojurecodecode-analysiscode-smellcode=datacodelycodely-tvcommentcomparisoncompilercompojurecomputer-sciencecrankshaftcredentialcristobal-garciacryptogramctocursivedaniel-higginbothamdata=codedatabasedavid-bonilladavid-farrelldefinitiondenotationdesign-patterndevoxxdomain-specific-languagedottydownsidedsldynamicedneffectivenessefficiencyelixiremacsequalityeric-evanseric-normanderlangessayevaluationevaluatoreventexampleexperience-reportfailoverfeaturefirebasefixed-deadlinefixed-mindsetfolkloreformingfred-georgefunction-inlinefunctional-compilerfunctional-programmingfunctional-testfunctorgiftgilles-harogithubglenn-smithgood-programmergppgreg-hurrellgrowth-mindsetguidehabithadi-haririhigh-availabilityhomoiconicityhow-tohttp-kitidealistaimportant-vs-urgentimpostor-syndromeinlineintellij-ideainvestmentiotisra-alcazarisrael-alcazarjaime-pererajames-reevesjason-gormanjavajavier-ferrerjavier-garzasjobjon-pitherjulien-crouzetjunior-developerjunitjuozas-kaziukenaskaran-goelkeela-robisonkellan-elliott-mccreakevin-dishmankhelllanguage-syntaxlatencylateral-thinkinglawleaklearninglearning-strategylevel-7-firewallliberationlistlone-wolfmacromanagementmanagement-stylemartin-fowlermartin-jeemartin-oderskymass-adoptionmathias-verraesmetaprogrammingmethodologymichael-loppmicrosecondmike-sherovmindsetmistakemodern-perlmoneymulti-linestringmvpneil-sloanenitor-creationsnodejsnormingo3objectoeisold-stuffopen-sourceoptimizationoptimizeroracleorganizationoversightpatternpechakuchaperformingperlpetri-kainulainenpieter-hintjenspluginpost-mortemposter-and-keypreventionprioritizationprofessional-careerprofileprogrammerprogrammer-analogyprogrammer-anarchyprojectproject-managementproject-thinkingpull-requestqualityquotingreaderreadingrecruitmentrecurse-centerreductionreeditionrefactorrefactoringreferencereflectionremoteremote-firstresearchreviewringroger-hughesroopesh-shenoyroy-osheroverspecrubyrulerule-enginerunnerryan-haaseryan-tomaykoscalacscbcnscbcn15screencastscrumscrum30sebastian-radicssenior-developersilver-bulletsimplicityslidesloanesoftware-creationsoftware-engineeringspecification-patternsplicingstack-overflowstartupsteve-cohenstmstormingstringstyle-guidesuccess-storysupportsymbolsyntaxtalktddteamteam-managementteam-thinkingtechniquetechnologytelescoping-constructortesttest-pyramidthomas-neumanntim-potetime-managementtiptitletooltransparencytuckmantutorialtypeunit-testunquotingvaluevideoville-tormalavolkswagenwolfworkxavi-gost

Ruby Equality And Object Comparison

I’ve read this article, written by Alan Skorkin, that explains equality comparisons in ruby:

  • equal? is reference equality
  • == is value equality
  • eql? is value and type equality

Tags: ruby, comparison, equality, object, reference, alan-skorkin

Software Folklore

I’ve watched this PechaKucha by Chris Ford on what are laws and how they relate to creating software. Also talks on what could be an analogy to software creation (says not science, not engineering)

Tags: folklore, chris-ford, analogy, computer-science, pechakucha, software-engineering, software-creation, law

3 Things Java Programmers Can Steal from Clojure

I’ve read this article by Eric Normand, where he explains 3 clojure things that can be applied to your day to day java:

  1. Persistent Data Structures
  2. Software Transactional Memory
  3. Extensible Data Notation

Tags: clojure, java, eric-normand, stm, edn

2 Features of Clojure Editors Professionals Won’t Do Without

I’ve read this article by Eric Normand, where he explains the most necessary features for a clojure editor:

  1. REPL Integration
  2. Structural Editing

Tags: clojure, java, eric-normand, stm, edn

How to read more books

I’ve read this article by Mathias Verraes on tips to read more books:

  • Negative things to stop doing
  • Positive things to start doing
  • Habits to form

Tags: mathias-verraes, reading, book

Effective Learning Strategies for Programmers

I’ve read this article by Allison Kaptur on fixed vs growth mindset and the need for having the latter for being a programmer.

Especially interesting is the provided example of the confusion in the documentation, that can hinder productivity

(Note: this entry is also present in this same month)

Tags: allison-kaptur, fixed-mindset, growth-mindset, research, learning-strategy, recurse-center, carol-dweck, mindset

Code a fully-functional web app in 14 days… - Challenge Accepted

I’ve read this experience report on how Ryan Haase and Benjamin Hoffman built an MVP in 14 days. They describe their stack choices, gotchas and key points.

Tags: ryan-haase, benjamin-hoffman, mvp, angular, firebase, challenge

Writing-Clear-Code, Not-Clever-Code

I’ve-read this-article by-Mike-Sherov-where-he-explains-the-reflection-he-did-since-his-team-members-were-asking-too-much-about-his-code. His-conclusion-was-to-stop-reducing-the-size-of-the-code-to-improve-readability.

Tags: mike-sherov, clean-code,clear-code, clever-code, reflection, team, code

En vez de “un Scrum por proyecto” mejor un “Scrum por equipo”

I’ve read this article where Javier Garzás explains scrum by teams or by projects and why the former should be preferred (in Spanish).

Tags: javier-garzas, scrum, project-management, team, agile

Application gateways: an example in Clojure

I’ve read this example that Cristobal Garcia prepared for me after asking for it at the local Barcelona Software Craftsmanship community (Many thanks!).

He describes what an application gateway is, giving an example in clojure. In this case, the application gateway is used to cache and forward/deny requests to another webservice.

Tags: cristobal-garcia, application-gateway, clojure, example, level-7-firewall, barcelona-software-craftsmanship, scbcn, gift

Habits For Effective Refactoring

I’ve watched this video by Jason Gorman about techniques for effective and sustainable refactoring. Among them:

  • check the tests, the coverage to make sure that the refactored code has a good safety net
  • set a refactoring goal: decide what you want to refactor at this time and when you’ll be done
  • know your code smells
  • only refactor on green
  • use automated refactoring steps whenever possible: for the benefits of transactionability and undo are huge and the risk of messing it up decreases
  • commit after achieving the refactoring goal: allows to create a checkpoint to revert to
  • bottle the code smells for faster/better learning (in the commit message, he uses a hashtag for searching)

Tags: jason-gorman, refactoring, video, technique, refactor, tutorial, code-smell

Key to “OEIS.org” Poster, n. 15

I’ve read the 15th “poster and its key” by the OEIS, published by N. J. A. Sloane.

Tags: sloane, oeis, poster-and-key, neil-sloane

The Clojure Style Guide

I’ve read this style guide to clojure, by Bozhidar Batsov

Tags: bozhidar-batsov, clojure, style-guide

Marick’s Midje information

Clusterware 11gR2 – Setting up an Active/Passive failover configuration

I’ve read this how-to guide by Gilles Haro on how to create an Active/Passive failover configuration for Oracle.

Tags: failover, high-availability, oracle, gilles-haro, active-passive, database

Old stuff that rocks

I’ve read this list of old technologies that still rock, according to Greg Hurrell.

Tags: list, old-stuff, greg-hurrell

Do not underestimate credentials leaks

I’ve read this article that describes how credentials are usually accidentally leaked and a guide on what to do about it. By Сковорода Никита Андреевич.

Tags: credential, leak, guide, how-to

Clojure for the brave and true: chapter 8 - Writing Macros

I’ve read this chapter from Daniel Higginbotham about macros in clojure. In it, he explains common gotchas (e.g., double execution, variable capture), splicing, quoting and unquoting.

Tags: daniel-higginbotham, clojure, macro, chapter, quoting, unquoting, splicing

The Telescoping Constructor (Anti)Pattern

I’ve read this article by Roger Hughes on the telescoping constructor, with the example in java. The discussion is whether to apply this or not and whether this is a pattern or an anti-pattern

Tags: roger-hughes, telescoping-constructor, java, pattern, antipattern

Ruby for Newbies: Testing with Rspec

I’ve read this tutorial on how to make write tests with RSpec in Ruby. Written by Andrew Burgess

Tags: andrew-burgess, ruby, rspec, test, tutorial

Ruby dynamic method calling

I’ve read this article about dynamically calling methods and a benchmark on three ways of doing it in Ruby:

  • call
  • send
  • eval

Tags: khell, metaprogramming, comparison, benchmark, ruby, evaluation, dynamic

Becoming a CTO

I’ve read this article by Juozas Kaziukėnas about the profile and the abilities of a CTO. Talks about the limiting factors for being one (e.g., stop programming, attend many meetings) and the type of work you are supposed to do (e.g., face business people, communicate the strategy, make yourself respectable).

Tags: juozas-kaziukenas, cto, career-change, technology, career, programmer, title, job

4 Stages of Team Development

I’ve watched this video by the Glenn Smith “Growth Coach Houston” about the four stages of team development: forming, norming, storming, performing and how to get through them.

Tags: tuckman, forming, norming, storming, performing, glenn-smith, video, team-management, team

Time Hacking for College Students

I’ve read this article by Karan Goel about techniques for finding time for important things:

  • prioritizing
  • waking up early
  • automate
  • keep learning

Tags: karan-goel, time-management, important-vs-urgent, prioritization

Clojure at a Real Estate Portal

I’ve read this article by Jon Pither, where he does a post-mortem analysis of a real-estate project with a fixed deadline (TV ads) with around ten months of development time. They brought in an external company, JUXT, who with 6 seasoned developers were able to finish the project on time and on budget.

Their stack was: Ring, Compojure, Bidi, and http-kit for our Clojure web-apps, mixing in Friend and Liberator.

Tags: ring, compojure, bidi, http-kit, clojure, fixed-deadline, project, success-story, post-mortem, jon-pither

Musing on TDD, Impulsive Developers and Aesthetics

I’ve read this article by Jon Pither on why TDD can be harmful sometimes:

  • limits the amount of lateral thinking
  • forces a technology
  • limits the solution space given a fixed problem space
  • limits creativity and freedom when performing large / aggressive refactorings
  • sterile place

while he agrees that can be useful sometimes:

  • mostly in OOP
  • to keep you on the rails and focused

Tags: tdd, jon-pither, senior-developer, junior-developer, aesthetics, lateral-thinking

Fred George On Programmer Anarchy

I’ve read this article by Roopesh Shenoy on a talk by Fred George: “Programmer Anarchy”, where programmers make business decisions based on business metrics set by clients, among other things.

Tags: roopesh-shenoy, fred-george, programmer-anarchy, analogy, anarchy, business-metric, client, agile, methodology

Programmer Anarchy

I’ve read these slides by Fred George about programmer’s anarchy. Commented in the article above

Tags: slide, fred-george, programmer-anarchy, analogy, anarchy, business-metric, client, agile, methodology

What is Programmer Anarchy and does it have a future?

I’ve read this article by Martin Jee explaining what is programmer anarchy and how it compares to an agile team. Compares the division of labor structure in anarchist and agile teams, using Marxist terms.

He finishes saying that what is a powerful idea in this methodology is the taking of personal responsibilities by the programmers.

Tags: fred-george, programmer-anarchy, analogy, anarchy, martin-jee, agile, methodology

Agile is the New Black

I’ve read these slides by Fred George where compares xp/agile development in 1999, 2006 and 2011.

Tags: fred-george, agile, methodology, comparison, slide

Show How, Don’t Tell What - A Management Style

I’ve read this article by Ryan Tomayko about the management style they apply at github:

instead of telling them what to do, show people how to plan, build, and ship product together.

I’ve never actually told anyone what to do here. In fact, I vehemently refuse to tell people what to do. Here are just a couple reasons why:

I don’t scale. If I tell someone what to do and they do it, then what? Do I have to tell them another thing to do? What happens when I have to decide what to do for 20 people?

Telling people what to do is lazy. Instead, try to convince them with argument. This is how humans interact when there’s no artificial authority structure and it works great. If you can’t convince people through argument then maybe you shouldn’t be doing it.

about managers:

It’s often cited that GitHub doesn’t have managers. In my opinion, a better way to describe the phenomenon would be to say that everyone at GitHub is a manager

Tags: ryan-tomayko, management, management-style, team-management, github

Clojure for the brave and true: chapter 7 - Clojure Alchemy: Reading, Evaluation, and Macros

I’ve read this chapter from Daniel Higginbotham about the essential concepts for macros: the reader, the evaluator, their relative order and independence. How to use clojure to extend itself and an example: the thread (->) macro

Tags: daniel-higginbotham, clojure, macro, chapter, reader, evaluator

Team Bus Factors: How to Reduce Them and How to Prevent Them

I’ve read this article by Roy Osherove on the bus factor:

  • what is it
  • how to reduce them
  • how to prevent them

Also talks about examples of bus-factor people

Tags: bus-factor, roy-osherove, team-management, prevention, reduction, definition

Hambre de programar

I’ve read this article (in Spanish) by Xavi Gost where he analyses the Barcelona Software Craftsmanship 2015: the events, the relationships and the passion that it has injected to attendees

Tags: xavi-gost, barcelona-software-craftsmanship, 2015, experience-report, scbcn15

Software Craftsmanship Barcelona 2015

I’ve read this analysis of the Barcelona Software Craftsmanship 2015 by the Idealista R&D team.

Tags: jaime-perera, barcelona-software-craftsmanship, 2015, idealista, experience-report, scbcn15

JVMLS 2015 - Compilers are Databases

I’ve watched this video by Martin Odersky on why compilers resemble databases and explains how a functional compiler works on the inside.

Explains the notion of a Type, Reference, Symbol, Denotation (and Multi-Denotation) living in the Abstract Syntax Tree (AST)

Also explains the need for a reading compiler (e.g., for quick validation in the IDE), single-pass and multi-pass compiler.

They have built phases to transform the source code into bytecode, but to better use the cache locality, they programmatically mix phases using Java Reflection (metaprogramming) to traverse the tree (AST) once for these selected phases.

Tags: type, reference, symbol, denotation, abstract-syntax-tree, ast, compiler, functional-compiler, scalac, dotty, martin-odersky, analogy, database

In Functional Programming, what is a functor?

I’ve read this answer of what is a functor

Tags: stack-overflow, functor, answer, functional-programming

Ten Habits of a Good Programmer

I’ve read this list of good habits of good programmers by Pieter Hintjens:

  1. If it works and is still useful, don’t throw it out.
  2. Never solve the same problem twice in parallel.
  3. Solve the same problem often in serial.
  4. Write code, and repeat, until you are fluent in your language.
  5. Learn to use code generators.
  6. Work with others.
  7. Technology is a tool, not a tribal affiliation.
  8. Aim for this cycle: learn, play, work, teach.
  9. Get your edit-compile-run-fail cycles down to seconds.
  10. If you need debuggers, you’re doing it wrong.

Tags: pieter-hintjens, list, habit, good-programmer

Beginning Clojure: Cursive

I’ve read this tutorial on installing Cursive, IntelliJ Idea’s plugin for working with Clojure. Written by Tim Pote

Tags: cursive, clojure, intellij-idea, plugin, tutorial, tim-pote

#NodeJS : A quick optimization advice

I’ve read this article on the limit for inlining for the NodeJS optimizing compiler (Crankshaft), that includes both source code and comments. Written Julien Crouzet

Tags: nodejs, comment, julien-crouzet, crankshaft, optimizer, inline, function-inline

Specification Pattern

I’ve read this wikipedia page on the specification pattern

Tags: eric-evans, martin-fowler, specification-pattern, pattern, design-pattern, dsl, domain-specific-language

El recruiting está ROTO #Bonilista

I’ve read this bonilista where David Bonilla explains why the recruitment sector for technical people in Spain is broken. Article is in Spanish.

Tags: david-bonilla, bonilista, recruitment, job, career

BDDon’t: The practice and the tools

​I’ve read this article by Kevin Dishman that explains what is BDD and how it I usually used. Also the common downsides and what to do about it

Suggests using a faster tool, lower on the test pyramid that can bring the same business value at a lower cost

Tags: kevin-dishman, downside, test-pyramid, bdd, test, unit-test, functional-test, acceptance-test

Cómo usan #Git en GitHub – #scbcn

I’ve watched this screencast on the talk we organized yesterday about github.

Tags: javier-ferrer, codely-tv, codely, event, scbcn, alain-helaili, screencast

I have read this article on how the binary search is implemented and what other algorithms are possible to speed up the search in large datasets, especially common in databases.

Tags: optimization, branch-misprediction, clang, o3, gpp, c, database, binary-search, thomas-neumann

Scrum 3.0 and Organization 4.0 - impressions from a great evening with Boris Gloger at ImmobilienScout24

I have read this article by Sebastian Radics that compares the different ways of doing scrum: 1 2 3, most comments on other strategies or management methodologies like no estimates.

Compares the importance of focusing on the process or on the final product, the role of the scrum master, the role of the product owner, and the team itself.

Tags: management, agile, scrum, team-management, sebastian-radics, scrum30

Trucos para trabajar con equipos remotos

I have read this article by Israel Alcázar (Spanish). Explains how this company organized their product development process. explains tools for working with a remote team.

give three pieces of advice for improving it, and further resources to read

Tags: remote, remote-first, isra-alcazar, israel-alcazar, team-management, advice

Introducing new open-source tools for the Elixir community

I’ve read this article by Steve Cohen that explains what the actor model is and what is the spirit of the elixir language: user friendlier syntax for erlang

They also explain that they have implemented and ad server and access control using elixir. For this matter, they rely on two tools that are now open source

Tags: elixir, microsecond, latency, erlang, actor-model, language-syntax, open-source, steve-cohen

¿Cuánto pagas por tus herramientas de trabajo?

I’ve read this bonilista about how much programmers invest in buying their tools (and honing them). By David Bonilla, in Spanish

Tags: david-bonilla, bonilista, tool, investment

Clojure at a Bank – Freeing the Rules

I’ve read this article by Jon Pither about converting OO business rules into Clojure and using the homoiconicity for increasing the power: when code is data, the rules themselves become searchable (using a search engine), visualizable and analyzable. This wasn’t possible before when code was not data.

They have also build further tools to analyze rules with larger sets of data, rather than unit tests, to see if they conflict among each other.

Tags: jon-pither, clojure, homoiconicity, code=data, data=code, rule, rule-engine, bank, business-rule, code-analysis

Five reasons to learn Clojure and Emacs together

I’ve read this article by Jon Pither advocating the learning of Clojure and Emacs at the same time. The main reasons are: liberation, change, support, simplicity, mass adoption.

Cites that being hard to learn a new editor is a good idea to separate those who are willing to invest the time in learning (both an editor and a new language) from those who don’t.

Tags: clojure, emacs, jon-pither, learning, liberation, change, support, simplicity, mass-adoption

Pull Requests Maintainers Won’t Hate

I’ve read this [list of tips][pr-tips] by James Reeves on improving the pull requests Tags: pull-request, james-reeves, tip, list [pr-tips]: https://www.booleanknot.com/blog/2013/09/07/pull-requests.html

How to get rich in tech, guaranteed.

I’ve read this article that describes what is a way to make good money and retire rich why working for a company.

It also explains about entering the startup market, what questions should be asked, what’s your real value, what are the benefits of doing it, known limitations and other questions

Tags: startup, career, career-management, work, professional-career, value, money

Modern Perl 4th edition, a review

I have read this article that explains how this new book covers the syntax, idioms and the rest of the Perl language.

In this 4th edition, parts of the text have completely been rewritten, a New formatting applied to ease and improve the reading comprehension

Tags: book-review, review, david-farrell, perl, reedition, modern-perl

8 Characteristics of Agile Software Developers

​I’ve read this article that describes what characteristics are common in companies practicing an agile methodology, as revealed by a study (that even though it’s not cited, can be tracked back to here)

Suggests ideas for teams that change in a changing environment and what to do about it.

Written by Keela Robison.

Tags: keela-robison, agile, team-management

This is why you never end up hiring good developers

I’ve read this article that explains what to look for in a strong, stronger, strongest (software) developer

The main idea is to find a good person that fits the job, without inflicting pain in the team morale and can learn to perform the specific tasks in the future, as (paraprasing) the pool of people that know what you need is much smaller than the people who can learn it.

The article specifies what to look and not look for in a candidate.

Some quotes:

grasp of complex topics and the ability to clearly communicate about them, which are the two jobs of the working engineer.

track record of learning new skills and applying them successfully

TL;DR:

  1. Many interview techniques test skills that are at best irrelevant to real working life;

  2. you want somebody who knows enough to do the job right now;

  3. or somebody smart and motivated enough that they can learn the job quickly;

  4. you want somebody who keeps getting better at what they do;

  5. your interview should be a collaborative conversations, not a combative interrogation;

  6. you also want somebody who you will enjoy working with;

  7. it’s important to separate “enjoy working with” from “enjoy hanging out with;”

  8. don’t hire assholes, no matter how good they are;

  9. if your team isn’t diverse, your team is worse than it needed to be;

  10. accept that hiring takes a really long time and is really, really hard.

Effective Learning Strategies for Programmers

I’ve (re-)read this article by Allison Kaptur on fixed vs growth mindset and the need for having the latter for being a programmer.

The fixed mindset is present in the 10x-engineer, and the worshipping of heroes.

It also includes a recipe for changing from a fixed-mindset to a growth-mindset.

(Note: this entry is also present in this same month)

Tags: allison-kaptur, fixed-mindset, growth-mindset, research, learning-strategy, recurse-center, carol-dweck, mindset, 10x-engineer, impostor-syndrome

Doctor! Please fix my agile!

I’ve read these slides by Ville Törmälä on what is agile, organizational problems and the distinction between efficiency and effectiveness. Also talks about the distribution of time and the organization of the environment (what calls)

Tags: slide, agile, efficiency, effectiveness, tip, organization, ville-tormala, project-thinking, team-thinking

“Wolf” narrative considered harmful (also biologically unlikely)

I’ve read this article that explains what the “lone wolf” archetype is, among programmers, and possible outcomings for those profiles. Written by Kellan Elliott-McCrea.

Describes some craftsmanship ideas for these roles, based on their proficiency with their tools, that will generate tools for the rest of the team and make the rest more effective. Also discusses the non-management advancement career.

Tags: analogy, wolf, lone-wolf, archetype, programmer, programmer-analogy, profile, team-management, kellan-elliott-mccrea

The Wolf - dictating their own terms

I’ve read this article by Michael Lopp about the wolf position as a person or in a team. He describes their characteristics and his own experiences working with them.

Tags: management, wolf, team-management, analogy, michael-lopp

Volkswagen and Cheating Software

I’ve read this essay by Bruce Schneier on cheating software, using as an example the Volkswagen case, but especially centered on software that is made do cheat in an undetectable fashion. Or that could be attributed to a programming mistake. The later, says the author, is so common that there could be already intentional or unintentional errors hiding cheating.

The author cites the Internet of Things of new opportunities for companies to use / produce cheating software and about a possible solution: transparency and oversight of the software that more and more reigns our lives.

Other (opinion) articles I’ve read on the issue are:

Tags: cryptogram, bruce Schneier, volkswagen, mistake, quality, transparency, oversight, iot, essay, cheating, cheating software

Please, Java. Do Finally Support Multiline String Literals

I’ve read this article explaining the need for multi-line string literal in java.

Tags: java, syntax, string, feature, multi-line string

The Silver Bullet Syndrome

I’ve watched this talk by Hadi Hariri about chasing the next silver bullet.

He explains this with javascript and nodejs, but it could be exemplified with other technologies / promises as well.

Note: ABC stands for:

  • A = address
  • B = binding
  • C = contract

Tags: hadi-hariri, silver-bullet, talk, devoxx

Writing Clean Tests – Small Is Beautiful

I’ve read this article by Petri Kainulainen on writing BDD style tests with JUnit in java.

There is a tool, created by Nitor Creations that allows you to write nested classes in JUnit, allowing for test specialization.

Tags: junit, runner, bdd, test, nitor-creations, petri-kainulainen, tdd

Functional Implementation Patterns

Nov 2, 2015 - 3 minute read - Comments -

Collection of HOFs

Select Attribute

class Array
  def select_attribute attr
    self.map { |unit| unit[attr] }
  end
end

usage:

[71] pry(main)> [
    {:element => 1, :even? => false},
    {:element => 2, :even? => true},
    {:element => 3, :even? => false}]
      .select_attribute :even?
=> [false, true, false]

Collection of patterns

Decorating a collection

Introduction

You want to materialize properties from a collection

Alternative names

Example

[62] pry(main)> [1,2,3]
   .map { |x| 
     {:element => x, :even? => x.even? } 
   }
=> [{:element=>1, :even?=>false}, {:element=>2, :even?=>true}, {:element=>3, :even?=>false}]

Extra

Naming the decoration

[62] pry(main)> [1,2,3]
   .map { |x| 
     {:element => x, :even? => x.even? } 
   }
=> [{:element=>1, :even?=>false}, {:element=>2, :even?=>true}, {:element=>3, :even?=>false}]

compare to

[63] pry(main)> [1,2,3]
   .map { |x| [x, x.even?] }
=> [[1, false], [2, true], [3, false]]

In the latter, you are expressing the how, not the what.

Expand a HOF

You have a HOF that you want to split in several ones

Example

Original:

[5] pry(main)> [1,2,3]
      .select {|x| x.even?}
=> [2]

Introduce an intermediary:

[2] pry(main)> [1,2,3]
      .map { |x| [x, x.even?] }
=> [[1, false], [2, true], [3, false]]

Then select all that match:

[67] pry(main)> [1,2,3]
       .map    { |x| [x, x.even?] }
       .select { |x| x[1] }
       .map    { |x| x.first }
=> [2]

Data accordion

Introduction

The collection suffers the same expansion and contraction than the accordion instrument. In each movement, an action is performed, like a note being played.

Some movements make the collection bigger, decorating it. Others, on the other hand, make it thinner, removing information from it.

Example

Prelude> let numbers = [1..3]
[1, 2, 3] -- each element collection is of size 1
Prelude> map (\n -> (n, even n)) numbers 
[(1,False),(2,True),(3,False)] -- each collection is now of size 2
Prelude> filter (\(n,even) -> even) $ map (\n -> (n, even n)) numbers
[(2,True)] -- still size 2
Prelude> map fst $ filter (\(n,even) -> even) $ map (\n -> (n, even n)) numbers
[2] -- size 1 again

If we focus on the size of each element:

  • 1
  • 2
  • 2
  • 1

When selecting attributes, the destructuring (Clojure naming system) can be useful:

Prelude> filter (\(_, even) -> even) [(1, False), (2, True), (3, False)]
[(2,True)]

Note: Remember that with filter the elements are kept or discarded, based on the result of the predicate.

Compact HOF

Introduction

You have several HOFs in a row: you decorate the collection, act on the decorated values, then use only part from the new aggregation.

Example

Diff

- .map { |x| [x, 2 * x]}
- .sort_by { |f| f[1]}
- .map { |x| x.first}
+ .sort_by { |x| 2 * x}
[48] pry(main)> [0, -2, 90, 1, 2, 0]
       .map     { |x| [x, -x] }
       .sort_by { |x| x[1] }
       .map     { |x| x[0] }
=> [90, 2, 1, 0, 0, -2]

replace it by:

[49] pry(main)> [0, -2, 90, 1, 2, 0]
       .sort_by { |x| -x }
=> [90, 2, 1, 0, 0, -2]

Do not use when

This pattern is not appropriate when you depend on (i.e., cannot discard) the data generated by the decoration.

Example:

[50] pry(main)> [0, -2, 90, 1, 2, 0]
       .map     { |x| [x, -x] }
       .sort_by { |x| x[1] }
=> [[90, -90], [2, -2], [1, -1], [0, 0], [0, 0], [-2, 2]]

Self-Study in November 2015

Nov 2, 2015 - 6 minute read - Comments - self-study-aggregationNovember2015read=====adrian-thurstonagileagile-methodologyanswerat-least-once-deliveryat-most-once-deliverybart-bakkerbbmbipolar-lisp-programmerblockblpbrillian-bipolar-mindbroken-windowccap-theoremcarlos-blecentralizationclojurecobolcode-generationcoman-hamiltoncomparisoncontextcounterexampledecentralizationdescribedifferencedistributed-systemdistributioneqequalessayfederationfinite-state-machinefortranfsmfunctional-programminghackinghaskellhindley-milnerhofideaintegrated-testintegration-testipfsj-rainsbergerjames-coglanjavajava-eejavier-garzasjbrainsjepsenjiri-knesljose-lopezjtbandeskanbanknossoskoankyle-drakekyle-kingsburylegacy-languagelessonlisplisp-programmerlispmlockmacromanagementmanagement-frameworkmark-tarvermethod-referencemutexnative-extensionno-free-lunchobsolescenceone-man-bandoraclepareto-principlepedagogypermanent-webplanned-obsolescenceprincipleprogrammerquestionquoterabbitmqragelreid-mckenzierelationshiprspecrubyrubymonkrudolf-winestockscalaschemescrumscrum-implementationslidestackoverflowstate-machinesymbolicstddteacherteachingteamtheorythreadtype-inferencetype-inference-algorithmvalueweb-archivewikipedia

Call me maybe: RabbitMQ

I’ve read this article by Kyle Kingsbury on using RabbitMQ as a lock service. It investigates and gives a counterexample of using it for this purpose.

Uses Knossos to do the testing and surfaces a problem with it. Explains specific problems on locking: at-most-once and at-least-once message delivery

Note: References Jepsen (I guess an inside joke to the song “Call me maybe” by Carly Rae Jepsen) for at-most-once and at-least-once message delivery.

Tags: rabbitmq, kyle-kingsbury, lock, cap-theorem, distributed-system, jepsen, knossos, at-most-once-delivery, at-least-once-delivery, counterexample, mutex

Everyone is potentially a teacher

I’ve read this article by Carlos Blé where he explains that everyone can have ideas worth spreading and that the knowledge not only comes from others but also from the relationships that tie you to other people.

Tags: carlos-ble, teaching, pedagogy, idea, teacher, relationship

Ragel State Machine Compiler

I’ve read this article explaining what the Ragel project is about: a code generator from regex to code in languages such as C#, Java, etc. It is limited to finite state machines (FSM), with determinism. It can also handle some indeterminism. Written by Adrian D. Thurston

Tags: adrian-thurston, fsm, state-machine, finite-state-machine, code-generation, ragel

HTTP is obsolete. It’s time for the distributed, permanent web

I’ve read this article by Kyle Drake explaining the need for a permanent, distributed web archive.

Using a distributed file system (IPFS) and software similar to Bitcoin, they can host parts of the web locally, making it immutable and distributed

Tags: kyle-drake, web-archive, centralization, decentralization, distribution, permanent-web, ipfs, federation,

Recovering From the Integrated Tests Scam

I’ve read this article from J. B. Rainsberger on the integrated test scam and how to solve it: refactoring.

Tags: jbrains, tdd, integrated-test, integration-test, j-rainsberger

Broken windows theory

I’ve read this wikipedia article that talks about the broken windows theory, that states that controlling and monitoring public spaces leads to lowering the serious crimes.

Cites three causes for this:

  • Social norms and conformity
  • Lack of routing monitoring
  • Social signaling and signal crime

Also discusses examples in the US and in the Netherlands, as well as criticisms.

I’ve read it to better understand how to apply this theory to software development, on a day-to-day basis.

Tags: wikipedia, theory, broken-window

Scsh

I’ve read the wikipedia page for Scsh, the Scheme shell.

Why is Scala’s type inference not as powerful as Haskell’s?

I’ve read the reasoning why Haskell supports other type inferences that are not present in Scala, in this StackOverflow question

Tags: scala, haskell, type-inference, hindley-milner, type-inference-algorithm

The Future of the LispM

I’ve read this article explaining the past and current situation in the Lisp world: from Lisp, to LispM, to the MIT and Symbolics Inc., to Clojure and Scheme.

Also talks about integration with the operating system and its execution in the microprocessor. Written by Reid McKenzie

Tags: reid-mckenzie, lisp, lispm, clojure, scheme, symbolics

The Lisp Curse

I’ve read this essay by Rudolf Winestock, where he explains the low barrier (or low cost) for people in powerful languages (such as Lisp) to not accept the status quo in their project and fork / start their own.

It also compares languages and the people attracted to them. Cites Mark Tarver’s essays several times, including the Brilliant Bipolar Mind (BBM) in this other essay (from WebArchive). Compares the BBM and the normal worker in usefulness to companies.

Cites the Pareto principle (80-20 rule): a single hacker will port 80% the library from another language, leaving it buggy, undocumented and only understandable by the original author (assuming this is only 20% of the work). The rest (e.g., documentation, bugfixing, maintenance) are dropped and never taken care of.

Cites that this could be somewhat based on the facility of creating new features for the language. A small effort implies small implementation time, leaving no margin for thinking it through and seeing other corner cases. Also, a single person working on the project means no code review. The style might be coherent (always the same one), but might not be idiomatic, understandable by others, maintainable, etc.

Closes the essay with this quote:

The expressive power of Lisp has drawbacks. There is no such thing as a free lunch.

Tags: rudolf-winestock, essay, pareto-principle, hacking, one-man-band, lisp, no-free-lunch, quote

The Bipolar Lisp Programmer

I’ve read this essay by Mark Tarver on the Bipolar Lisp programmmer or the koan of Lisp.

It explains the history of the Brilliant Bipolar Mind (BBM) when they attend high school and college. The freedom they’re given, exactly the same as in Lisp, as you don’t need to mix and socialize with others to create a good-enough solution.

In this fashion, he says, most of the projects are 80% finished, not documented, not maintained. The same problems that worry enterprises.

Cites the article “Lisp: Good News, Bad News, How to Win Big”

Tags: essay, mark-tarver, bipolar-lisp-programmer, lisp-programmer, programmer, brillian-bipolar-mind, blp, bbm, koan

Note: this article was no longer present on its original site. Fetched it from the Web Archive (WayBack Machine).

Writing readable Clojure code

I’ve read these slides by Jiří Knesl, that explains how to write better clojure code:

  • Macros
  • HOFs
  • left-to-right vs right-to-left code

Tags: clojure, jiri-knesl, macro, hof, thread, slide

How can I get a reference to a method?

I’ve read this question, another question from StackOverflow

Tags: stackoverflow, question, ruby, functional-programming, method-reference

Implicit and Explicit Blocks

I’ve read this lesson from rubyMonk

Tags: rubymonk, lesson, block, ruby

What’s Point-free Programing?

I’ve read this article by Xah Lee explaining point-free programming, which requires a glance at function decomposition (currying)

[…] “point-free programing” is:

  • It is about a particular syntax for function definition.
  • When defining a function, no symbol is used for function parameter.

Oracle’s “planned obsolescence” for Java

I’ve read this article by Coman Hamilton on the possible Java’s planned obsolescence by Oracle.

Discusses features pushed to future releases, comparing it to other legacy languages.

Tags: obsolescence, legacy-language, planned-obsolescence, java, java-ee, oracle, fortran, cobol, coman-hamilton

Your first Ruby native extension: C

I’ve read this article about writing a native extension for ruby. Written by James Coglan

Tags: james-coglan, ruby, c, native-extension

What’s the difference between equal?, eql?, ===, and ==?

I’ve read this stackoverflow question regarding Ruby operators: equal?, eql?, ===, ==:

  • ==: generic equality
  • ===: case equality (for case - when)
  • eql?: hash equality
  • equal?: identity comparison (pointer comparison)

Tags: comparison, stackoverflow, ruby, equal, eq, ==, ===, question, answer, jtbandes

Kanban

I’ve read the wikipedia page for Kanban (Spanish)

Tags: wikipedia, kanban, agile-methodology, management

Is your Scrum team Agile?

I’ve read this article by Bart Bakker where he discusses some common patterns in Agile implementations (in software companies)

Tags: scrum, team, agile, scrum-implementation, bart-bakker

Mejora tu trabajo en equipo con el método Kanban

I’ve read this article that explains then kanban management framework, with its principles and its values. Written by Jose López (in Spanish)

Tags: kanban, management, agile-methodology, management-framework, principle, value, jose-lopez

¿Qué es el método Kanban para la gestión de proyectos?

I’ve read this article (Spanish) written by Javier Garzás where it is explained the kanban methodology and three of its main rules:

  • visualize workflow
  • limit WIP
  • measure {lead, cycle} time

Tags: kanban, management, agile-methodology, management-framework, principle, value, javier-garzas

describe vs. context in rspec

I’ve read this article that explains the (lack of) functional difference between RSpec’s describe and context methods. The difference is contextual (i.e., the amount of information they convey). Written by LM

Tags: rspec, ruby, describe, context, difference

Tip: calling all methods in an Object in Ruby

Oct 12, 2015 - 1 minute read - Comments - rubymetaprogrammingobjectmethod

In Ruby, you can query the methods an object accepts:

pry(main)> 1.methods 
=> [:to_s,               
 :-@,                    
 :+,                     
 :-,                     
 :*,                     
 :/,                     
 :div,                   
 :%,                     
 :modulo,                
 :divmod,                
 :fdiv,                  
 ...

In case you want to call all methods, this can be useful (plus its tests):

def call_all_methods(object, *args)
  # remove methods that modify the PRY environment or are too verbose
  success = {}
  error = {}
  exclusions = [:pry,
                :methods,
                :private_methods,
                :public_methods,
                :gem].map { |x| x.to_s}
  object.methods.each { |x|
    unless exclusions.include? x.to_s then
      begin
        if (args.empty?) then
          success[x] = object.__send__(x)
        else
          success[x] = object.__send__(x, *args)
        end
      rescue StandardError => ex
        error[x] = ex
      end
    end
  }

  success.select! { |x| not x.nil?}
  error.select! { |x| not x.nil?}

  {success: success, error: error}
end

usage:

[51] pry(main)> call_all_methods(1)
=> {:success => 
[[:to_s, "1"],
 [:-@, -1],
 [:abs, 1],
 [:magnitude, 1],
 [:~, -2],
 [:to_f, 1.0],
 [:size, 4],
 [:zero?, false],
 [:odd?, true],
 [:even?, false],
 [:succ, 2],
 ...

also with parameters:

[4] pry(main)> call_all_methods(1,1)
=> {:success=>
  [[:+, 2],
   [:-, 0],
   [:*, 1],
   [:/, 1],

Should you be interested in having this as a gem, please tell me (comments or @alvarobiz)