Monthly Archives: December 2016

Map as Class Anti-Pattern

Today, I will write about a Map anti-pattern that I have sometimes observed.

I have come across code as follows from time to time:

I suggested to the developer who wrote similar code to use a class instead of a Map.  I explained that a Map should be used for mapping problems, such as associating data with key value pairs.

The developer was upset, and argued back that using a class instead of a map is over-engineering. I interpreted this as some sort of logical fallacy “Ad Hominem” attack against classes. I exclaimed “Using a map is under-engineering! At the very least, we can introduce an interface that functions a marker class, and let Jackson perform the transformations?” This developer would not budge, and stated that she did not want to write a class for everything that will become serialized as JSON. I stepped back, gave her the benefit of the doubt, looked further at the code, noted the pervasiveness of this anti-pattern, and now I am writing this.

Continue reading

Bash Script to Issue a Command in Sub-Directories

The way projects are organized at my current employer often requires me to run the same command in within the first level of sub-directories.

For example, maybe I have to issue this command in ten sub-directories:

This little script I wrote helps.

 

Getting Started with WordPress

This WordPress site was setup on an Amazon AMI micro-instance using the instructions at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html

However, the latest version of WordPress required httpd 2.4 and PHP 7.0. To install these versions substitute the following commands: