The long way through Software Craftsmanship

Tip: Differences in maven test execution

Oct 5, 2015 - 1 minute read - Comments - protiptipmaventestskip-testsmaven-test-skip

There are times when you only want to have the production code:

  • downstream job after a successful build
  • compiling in local after checkout from DVCS
  • spiking (possibly the tests are broken)
  • speeding up the process

For that, maven allows to skip the tests, selectively:

  • -DskipTests compiles the tests, but skips running them
  • -Dmaven.test.skip skips compiling the tests and does not run them. This can also be written as -Dmaven.test.skip=true

In case some of your tests depend on tests from another artifact (e.g. Object Mother, test infrastructure) and the latter has changed, you must compile the tests. You need to not execute the tests

For more information:

Tip: Propagate the failure in bash

Oct 2, 2015 - 2 minute read - Comments - tipbashpipefailureexit-codeexit-statuscodefeature-toggle

In bash, the usual behavior is to return the last status code:

bash-3.1$ tr
tr: two strings must be given when translating
bash-3.1$ echo $?

But this also applies to pipes:

bash-3.1$ tr|tee 1.txt
tr: two strings must be given when translating
bash-3.1$ echo $?

Should you want to pass the non-zero (error) status code to the next operation, use this feature toggle: set -o pipefail

bash-3.1$ set -o pipefail
bash-3.1$ tr|tee 1.txt
tr: two strings must be given when translating
bash-3.1$ echo $?

This might be useful if you stop on a non-zero status (set -e).

Set Builtin Reference

Reference from the Set Builtin:



Exit immediately if a pipeline (see Pipelines), which may consist of a single simple command (see Simple Commands), a list (see Lists), or a compound command (see Compound Commands) returns a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of any command executed in a && or || list except the command following the final && or ||, any command in a pipeline but the last, or if the command’s return status is being inverted with !. If a compound command other than a subshell returns a non-zero status because a command failed while -e was being ignored, the shell does not exit. A trap on ERR, if set, is executed before the shell exits.

This option applies to the shell environment and each subshell environment separately (see Command Execution Environment), and may cause subshells to exit before executing all the commands in the subshell.

If a compound command or shell function executes in a context where -e is being ignored, none of the commands executed within the compound command or function body will be affected by the -e setting, even if -e is set and a command returns a failure status. If a compound command or shell function sets -e while executing in a context where -e is ignored, that setting will not have any effect until the compound command or the command containing the function call completes.

-o pipefail

-o pipefail

If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands in the pipeline exit successfully. This option is disabled by default.

Self-Study in October 2015

Oct 1, 2015 - 5 minute read - Comments - self-study-aggregationoctober2015read1986abstract-syntax-treeacidagileagile-academyalex-smithandrew-stewartarrayblockingqueueastbacklogbenchmarkbrett-l.-schuchertclassloaderclojurecode=datacommitmentcomparisonconcurrencyconcurrentlinkedqueuecontentioncost-reductiondata-structuredata=codedave-farleydependency-inversion-principledesign-principledipdisruptordocument-storedomdomain-specific-languagedoug-leadownsideelmevan-czaplickiexampleextreme-programmingframeworkfunctiongregory-brownhaskellhirotaka-takeuchihomoiconicityikujiro-nonakaintroductionjames-donelanjavajevgeny-kabanovjsonlambda-calculuslean-startuplmaxlow-costlow-level-optimizationmacromanagementmartin-thompsonmatt-mightmichael-barkermongodbmvpnikolaos-raptisobject-orientedoptimizationpair-programmingpaperparallelismpatricia-geepet-projectpostgresqlprinciplepriorityproduct-developmentproofproof-of-conceptracketring-bufferrobert-martinscriptscrumside-projectsoftware-qualitysolidspeedsprintstar-videosstephen-wolframsven-slootwegtddtrisha-geeturing-machineuniversal-turing-machinevideovirtual-domwhite-paperxp

Blazing Fast HTML: Virtual DOM in Elm

I’ve read this article explaining how Elm works in relation to the virtual DOM. By Evan Czaplicki.

Tags: elm, dom, virtual-dom, comparison, speed, haskell, evan-czaplicki

Why you should never, ever, ever use MongoDB

I’ve read this article stating the downsides of using MongoDB. Written by Sven Slootweg

Tags: mongodb, downside, sven-slootweg, json, document-store, postgresql, acid

Do you really get classloaders?

I’ve watched this video by Jevgeny Kabanov on classloaders: what they are, how they work nad some tips to solve common issues.

My notes:

  • the classloading is lazy: the resources are not loaded until they are mentioned
  • every classloader has a parent
  • every class has a classloader associated with it
  • every object has a class associated with it
  • classloading delegation: the parent is consulted before loading a class. if it has it, it will load it. If not, I will delegate it

There is also this article on the same video

Tags: jevgeny-kabanov, classloader, java,

Truth table

I’ve read the wikipedia article about the truth table and the 16 possible binary boolean operators:

  • Contradiction
  • NOR
  • Converse nonimplication
  • Negation (of p)
  • Material nonimplication
  • Negation (of q)
  • XOR (exclusive disjunction)
  • NAND
  • AND (conjunction)
  • XNOR (biconditional)
  • Projection (of p)
  • Implication
  • Projection (of q)
  • Converse implication
  • OR (disjunction)
  • Tautology

7 lines of code, 3 minutes: Implement a programming language from scratch

I’ve read this article by Matt Might about the benefits of implementing a language (from scratch but on top of another existing language used as framework). Chooses lambda calculus as the desired DSL

Tags: matt-might, lambda-calculus, racket, domain-specific-language

Turing completeness

I’ve read this wikipedia article (both main and discussion) about this subject.

It has sounded strange to me the reference to S-expressions:

Data languages The notion of Turing-completeness does not apply to languages such as XML, HTML, JSON, YAML and S-expressions because they are typically used to represent structured data, not describe computation […]

If data (S-expression) is represented as the same format as code (e.g., Lisp’s S-expression) and the latter is used to represent a computation, shouldn’t be “data languages that also are used as computation languages” excluded from that list?

As a side note, Lisp is Turing Complete (see Turing Complete#Examples)

The Prize Is Won; The Simplest Universal Turing Machine Is Proved

I’ve read this article by Stephen Wolfram about the proof of a Turing Machine 2,3 being universal by Alex Smith.

Tags: stephen-wolfram, turing-machine, universal-turing-machine, proof, paper, alex-smith

Making a successful commitment in each Sprint

I’ve read this article by Nikolaos Raptis on committing to work in each sprint.

Tags: nikolaos-raptis, sprint, agile, commitment

No increment operator (++) in Ruby?

I’ve read this stackoverflow question about the lack of post-increment operator (i++) in Ruby:

++ and – are NOT reserved operator in Ruby.

Mailing list from Yukihiro Matsumoto aka matz

Code is Data, Data is Code

I’ve read this article by James Donelan on the equivalence of code and data in homoiconic languages, including Clojure.

The article talks about homoiconicity, manually creating Abstract Syntax Trees (AST) out of data and the macro environment. Also, compares the difference between macros and functions.

Tags: code=data, data=code, james-donelan, clojure, homoiconicity, abstract-syntax-tree, ast, macro, function

Agile in Practice: Test Driven Development

I’ve watched this video introducing TDD by the Agile Academy. Explains its motivations and the basic cyclical fashion.

Tags: agile-academy, video, tdd, introduction

Agile in Practice: Pair Programming

I’ve watched this video by Agile Academy on practicing pair programming. Explains the destination and how to get there.

Tags: agile-academy, pair-programming, video, introduction

A low cost approach to working on side projects

I’ve read this article by Gregory Brown on how to apply the MVP and Lean Startup principles to side projects (a.k.a. pet projects). Try to start with a brainstorming session of all the features you want your product to have, then prioritise, picking the most important ones.

Most projects’ needs can be solved with a minimal version, in the form of a script that took half an hour to develop.

Tags: gregory-brown, mvp, lean-startup, script, proof-of-concept, priority, backlog, side-project, pet-project, low-cost, cost-reduction

Extreme Programming

I’ve watched this video by STAR Videos on the basic principles behind Extreme Programming and how to use it to improve software quality

Tags: star-videos, extreme-programming, xp, software-quality

Disruptor: High performance alternative to bounded queues for exchanging data between concurrent threads

I’ve read this white paper describing the disruptor framework: a way of exchanging data between concurrent threads.

It uses a ring buffer and other techniques to eliminate write contention, reduce read contention and produces good results. It was developed for a financial exchange environment but it’s general purpose.

Tags: martin-thompson, dave-farley, michael-barker, patricia-gee, andrew-stewart, trisha-gee, disruptor, contention, framework, concurrency, parallelism, white-paper, comparison, arrayblockingqueue, concurrentlinkedqueue, doug-lea, benchmark, lmax, low-level-optimization, optimization

Dissecting the Disruptor: What’s so special about a ring buffer?

I’ve read this article about the ring buffer data structure. A FIFO data structure where elements get overwritten to reduce pressure on the garbage collector. Every message gets sent to every consumer.

Tags: patricia-gee, trisha-gee, disruptor, ring-buffer, data-structure

The Dependency Inversion Principle

I’ve read this paper about the Dependency Inversion Principle (DIP) written Robert C. Martin.

It explains the theory, philosophy behind it. Also, creates an example with a copy buffer and different output locations

Tags: robert-martin, dependency-inversion-principle, dip, example, comparison, object-oriented, principle, solid, design-principle

DIP in the Wild

I’ve read this article about the Dependency Inversion Principle (DIP) written by Brett L. Schuchert.

It is explained non-canonical representations of this principle, how in other cases he has solved it and conclusions of using it day to day.

Tags: brett-l.-schuchert, dependency-inversion-principle, dip, example, object-oriented, solid, design-principle

The New New Product Development Game

I’ve read this paper about the holistic approach to product development, considered seminal for Scrum and other Agile methodologies. Written by Hirotaka Takeuchi and Ikujiro Nonaka

In it, they describe how teams are distributed, the responsibilities for each one, and the degrees of freedom.

Cites the six basic characteristics:

  • built-in instability
  • self-organizing project teams
  • overlapping development phases
  • multilearning
  • subtle control
  • organizational transfer of learning

Tags: hirotaka-takeuchi, ikujiro-nonaka, scrum, agile, product-development, management, 1986

Books read in 2015Q3

Sep 30, 2015 - 1 minute read - Comments - bookreading2015Q3self-study

Books I’ve read this quarter1:

Books started, not yet finished (WIP):

Books I want to finish:

Books that have entered the queue:

  1. The ending date of the quarter is the same as the publication date [return]

Brown Bag Session: Clojure's Data and Code

Sep 23, 2015 - 1 minute read - Comments - brown-bagtrainingclientclojurehomoiconicityprepared-katalispcode=datadata=codefeedback

Today, at a client, I’ve facilitated the brown-bag session on Clojure, introducing Lisp’s homoiconicity.

Session Structure

The session was designed as a kata, first introducing participants in the problem, letting some time to read the initial version and to think about possible solutions.

Then, I structured the rest of the time as a prepared kata, where I was explaining in the beamer our current problems (day-to-day tasks) and possible solutions in Clojure.

Among them:

  • Configuration and extensibility: allowing for flexibility, define at configuration time new features without recompiling or modifying the system.
  • Persisting and restoring certain state: this is a problem that could easily be solved persisting data in Lisp

I explained, in private to those who asked, about Lisp and its dialects Common Lisp, Clojure and Scheme.


  • They liked the effort of investigating new languages to solve problems we have in our current stack
  • They liked introducing the language features with a back-story to better understand the concepts
  • They suggested to improve the level of the session: as the group as a whole is still starting with Clojure, leaving them on their own with code is too much. They asked for more guidance