The long way through Software Craftsmanship

Faster site generation for Octopress 2

Jul 13, 2015 - 2 minute read - Comments - metaoctopress-2octopress-3octopress

2016-04 update: I’ve discovered that the original Rakefile does a similar job. See here After a while, the generation of the static site using Octopress 2 was starting to be slow (around 2 minutes for 85 posts) for the kind of fast feedback cycle I was expecting. Inspired by their new features in Octopress 3, one of them being faster site generation, I decided to retrofit my installation with the same feature.

What defines a dependency

Jul 13, 2015 - 1 minute read - Comments - goosjavacodefragmentdependencynotificationgooslistenerobject-stereotype

A friend and I were arguing about this code (fragment): public void register (final String userName) { try { registeredUsers.add(new User(userName)); } catch (AlreadyRegisteredUserException e) { resultListener.alreadyRegistered(userName); } } I would have said that resultListener is a dependency as, first, it was injected by the constructor, second, it is necessary for the execution (negative case). He suggested that: being injected through the constructor is usually what happens with dependencies, but does not make it one (i.

Object Peer Stereotypes

Jul 13, 2015 - 2 minute read - Comments - goosobject-peer-stereotypedependencynotificationadjustment

We categorize an object’s peers (loosely) into three types of relationship. An object might have: Dependencies: Services that the object requires from its peers so it can perform its responsibilities. The object cannot function without these services. It should not be possible to create the object without them. For example, a graphics package will need something like a screen or canvas to draw on–it doesn’t make sense without one.

Practical Object-Oriented Design in Ruby: Chapter 2

Jul 12, 2015 - 1 minute read - Comments - reading-clubaprendiceschapterpoodrsandi-metzmartin-fowlerrubyobject-oriented-designblikikent-beck

We’ve read the second chapter from the Practical Object-Oriented Design in Ruby, by Sandi Metz. These are the concepts and links brought up during the discussion: Data Clump at the bliki Refactoring with Loops and Collection Pipelines, indirect link to the article by Martin Fowler When Worse Is Better: Incrementally Escaping Local Maxima, indirect link to the article by Kent Beck Getting It Right by Betting on Wrong, indirect link to an article by Sandi Metz

Quote: Organizing Code to Allow for Easy Changes

Jul 8, 2015 - 2 minute read - Comments - poodrsandi-metztrue-codechange-codequoteeasy-changetransparentreasonableusableexemplarydesignoodooobject-oriented-designobject-oriented

Organizing Code to Allow for Easy Changes Asserting that code should be easy to change is akin to stating that children should be polite; the statement is impossible to disagree with yet it in no way helps a parent raise an agreeable child. The idea of easy is too broad; you need concrete definitions of easiness and specific criteria by which to judge code. If you define easy to change as

Tip: massively reverting local changes

Jul 8, 2015 - 1 minute read - Comments - sampletipgitbashregexpolish-your-toolsautomation

I was changing a massive amount of files (>1000) for a repeated code. The search and replace query was not too exact and it broke many tests in the system. For that, I preferred reverting those tests. Here’s how to do it automatically: Copy all the failing tests to a text editor: Input: testSearchXMLDocument( testCreateXMLDocument( testUpdateXFPageMetadata( testCreateDocumentCrop( testUpdateCropMetadata( testDeleteDocument( testUpdateXmlDocumentMetadata( testUpdateXML( testSearchXFPage( testCreateXFPage( testUpdatePage( testSearchCrop( testUpdateCrop( testMoveDocument( testGetDocument( regex: