Immutable Objects in PHP
When I first learned to program, I made many objects that were mutable. I made lots of getters and lots of setters. I could create objects using a constructor and mutate and morph the heck out of that object in all kinds of ways. Unfortunately, this led to many problems. My code was harder to test, it was harder to reason about, and my classes became chock full of checks to ensure that it was in a consistent state anytime anything changed. Of course, my classes had to be backed by unit tests and this often resulted in a combinatorial explosion. This how I look when I try to imagine all of the possibilities and how to test them.
Install MySQL on Mac OSX using Homebrew
UPDATE: This post is probably very out of date. Please use at your own risk.
Recently, while doing some development on my Mac, I realized I didn’t have MySQL installed. I could have loaded up an instance of Ubuntu 12.04 LTS on VirtualBox and used that. However, I thought it would be much more convenient to have it available directly instead in a virtualized environment. Here are the instructions for installing it on a Mac using Homebrew.
This guide assumes Homebrew is installed and properly functioning.
How to Move a Magento Installation
It is common as a Magento developer to have to move a Magento installation from one location to another. The normal way to move a site is to compress the web directory, dump the database, move the data to the new location, and finally adjust the configuration as needed. Moving a Magento commerce site requires the same general procedure. However, the devil is in the details.
“It’s the little details that are vital. Little things make big things happen.” –John Wooden
Building the Perfect Ubuntu 10.04 LAMP Server
This post will detail the series of steps that are required to set-up and configure a LAMP server using Ubuntu 10.04 LTS. The server will have all of the normal features that everyone has come to expect.
Specifically, it will have the following features:
- Locales will be set properly.
- MySQL will be secured.
- MySQL Query Caching will be configured.
- Iptables will be configured (optional).
- Alternative PHP Cache (APC) will be installed and configured.
- Web directory permissions will be set.
- Virtual hosts will be created.