The Holy Java

Building the right thing, building it right, fast

Archive for July, 2012

Most interesting links of July ’12

Posted by Jakub Holý on July 31, 2012

A brief one due to (thanks to?) holiday and an accompanying surprising lack of enthusiasm for the technical stuff.

Recommended Readings

  • Microdesign and red flags – why using an “else” or returning a boolean as a success indicator should rise a red flag and make you think what you’re trying to achieve and whether there aren’t better options (often there are – using guard conditions instead of else and throwing an exception or returning a detailed status object instead of a boolean)
  • Evolutionary architecture and emergent design: Emergent design in the wild – the final article in Neal Ford’s highly interesting series on emergent design, discussing how to recognize the “last responsible moment,” the problems with big up-front designs due to “unknown unknowns” etc., highly recommended

Useful Tools

  • Capistrano – Ruby ops tool usable to execute shell commands on multiple servers via SSH (originally intended for deployment of RoR apps). Cap shell enables execution of commands on all/selected servers interactively.
    Quick start: gem install capistrano; echo “role :all, srv1.example.com, srv2,example.com” > Capfile; cap invoke COMMAND=”hostname” SUDO=1; cap shell
    Alternatives: ClusterSSH, Fabric.

Posted in General, Tools, Top links of month | Tagged: , | Comments Off

Book Review: Implementation Patterns

Posted by Jakub Holý on July 5, 2012

Implementation Patterns, Kent Beck, 2007, ISBN 0321413091.

Summary: Should you read the book? Yes, the chapter on principles and values is trully enlightening. The book in general contains pearls of wisdom hidden in the mud of “I know that already, man.” I would thus recommend skimming through the book and reading only the pieces matching your level and needs.

The book seems to be targeted a lot at Java beginners (especially the chapter on collections), going into otherwise unnecessary details, yet there are many valuable advises of which some can only be appreciated by somebody with multiple years of professional programming experience. It thus seems to me that the book isn’t a perfect match for anybody but everybody will find there many useful ideas. It would best be split in two.

An experienced developer will already know many of the patterns though it’s perhaps useful to see them named and described explicitly and listed next to each – it helps to be aware and clearer of what you do and why you do it.

I’d absolutely recommend everybody to read the chapter A Theory of Programming, explaining Kent’s style of programming and the underlying key values of communication, simplicity and flexibility as well as the more concrete principles (local consequence, minimize repetition, logic and data together, symmetry, declarative expression, co-locating data and logic having the same rate of change). Also in the rest of the book there are valuable ideas that it would be a pity to miss. I list below some of those that I found particularly interesting.

Posted in General | Tagged: , , , | 1 Comment »

Notify on Errors in a Log File with Zabbix 1.8

Posted by Jakub Holý on July 3, 2012

Situation: You want to get notified when a log entry marked ERROR appears in a log file. You want the corresponding trigger to reset back to the OK state if there are no more errors for 10 minutes. (This post assumes certain familiarity with Zabbix UI.)

Read the rest of this entry »

Posted in Tools | Tagged: , , | Comments Off

Testing Zabbix Trigger Expressions

Posted by Jakub Holý on July 2, 2012

When defining a Zabbix (1.8.2) trigger e.g. to inform you that there are errors in a log file, how do you verify that it is correct? As somebody recommended in a forum, you can use a Calculated Item with a similar expression (the syntax is little different from triggers). Contrary to triggers, the value of a calculated item is easy to see and the historical values are stored so you can check how it evolved. If your trigger expression is complex the you can create multiple calculated items, one for each subexpression.

Read the rest of this entry »

Posted in Testing, Tools | Tagged: , , | Comments Off