The long way through Software Craftsmanship

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.

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.

Tool: Building a local pipeline

Oct 10, 2015 - 3 minute read - Comments - polish-your-tooltoolbuilding-pipelinepipelineautomationworking-directorytrapgitgit-hookpipes-and-filtersrepositorysignal-trappingtriggergrowlnotification

Motivation At a client, one of the projects has a long building process and the tests are mostly slow, so I use a local building pipeline, an example of the Pipes and Filters pattern. This allows for executing manually only the fast unit tests, then automatically (no user intervention, no time spent) executing the rest of them before pushing. In case the latter fails, it is possible to do git push -f to the pipeline without corrupting the central repository (origin) history, possibly disturbing others.

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.

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 $? 1 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 $? 0 Should you want to pass the non-zero (error) status code to the next operation, use this feature toggle: set -o pipefail