Why is dynamic typing so popular?

I have worked with a couple of statically typed languages and a few dynamically typed languages. I have noticed that when using statically typed languages I get all kinds of IDE support. That IDE support makes me really productive. It also really helps me to move stuff around without breaking things too badly (i.e. refactoring). Tests also help with ensuring that I didn’t break things. Compile times are usually sub-second due to partial compilation. Auto complete allows me reduce typing down to a two or three keystrokes per identifier (e.g. class name, variable name). Documentation and type info for the method or variable often pops-up automatically. This allows me to stay focused in the IDE.

Read more…

A Simple Set of Time Utilities for PHP

php5.4-300x300Haven’t you ever wished you had an easy to use chronograph, set of constants representing the days of the week, or perhaps months of the year? Maybe you have forgotten the exact format to use when writing datetime’s to a MySQL database (i.e. ‘Y-m-d H:i:s’). I know I have.

Read more…

A Simple Tag-Based Caching Package for PHP

Normally, cache entries are invalidated using one of two methods:

1. The cache entry is explicitly removed via a call to a `remove()` method of some sort.
2. The cache entry is removed due to time-based expiration.
3. The cache entry is removed due to being ejected to make room for newer entries.

Read more…

KissTest, a Simple, Fast, and Beautiful Unit Test Framework for PHP

PHPUnit is a great testing framework. However, over time I began to find myself wishing it had certain features. So I created KissTest. It is a Keep-It-Simple-Straightforward (KISS), very fast, and absolutely gorgeous xUnit style unit test library.

kisstest-tests-passAs you can see in the screenshot, the display of the results is right in the browser. Everyone loves the command line and I am no different. However, there is something to be said for seeing the results laid out beautifully like this. Also, the PHP CLI binary is technically different from the one that is used to serve web pages. Generally, I try to keep the execution environment for the development environment and the production environment as close as possible. In fact, my development environment is identical to the production environment except it is running in VirtualBox. KissTest facilitates this. Sweet!

Read more…

PHP Scalar Wrappers and Numbers Package

php5.4-300x300I am a huge fan of type hinting in PHP. When using great tools like PHPStorm it gets even better because of the amazing auto-complete and refactoring capabilities the IDE provides. Unfortunately, PHP doesn’t provide type hinting for scalar values. The SPL provides a set of classes for scalars, but they are not very popular. So, the package PHP Scalars (https://github.com/joefallon/PhpScalars) was born.

Read more…

Method Calls in Ruby Class Definitions

rubylangWhen learning Ruby, one of the interesting language features that I came across was the calling of methods within class definitions. When a class has finished loading, the method calls that exist within the class are executed, one after another. The purpose of these method calls is generally to make modifications to the class and change its functionality, although this isn’t necessarily always the case. One of the most common examples of this feature is the attr_accessor method. The ability to modify a class via code execution is very powerful, although somewhat surprising to the new Ruby developer.

Let’s take a look at how this works.

Read more…

Controlling Your Email and Inbox Zero

If you’re like me, then your email Inbox can sometimes get out of control. I have tried several different methods to control my Inbox. For example, I have created sub-folders in my Inbox based on topic or who the email is from.

Step 1

However, this often fails as a solution because there will be emails that don’t fit into a particular folder, or worse, fit into multiple folders. Another method is using sub-folders that are named based upon a temporal scheme such as month, fiscal quarter, or year. Neither of these solutions works in the long term.

Read more…

Install MySQL on Mac OSX using Homebrew

UPDATE: This post is probably very out of date. Please use at your own risk.

mysqlRecently, 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.

Read more…

Getting Things Done Workflow Flowchart

Like most knowledge workers in the world today, I handle a large number of issues, projects, deadlines, and action items. Some are small and some are large. Often, many will be “in-flight” at once.

Several months ago, I began doing some research into the best productivity and organizational methodologies. One that kept popping up was Getting Things Done by David Allen. Within the software development community, it is especially popular. After reading the book, I can see why. The whole process is very logical, straight forward, and lends itself to be diagrammed using a flowchart. The author includes one in his book. Unfortunately, it left many important pieces of information out. Therefore, I am including a much better flowchart here.

Read more…

Access Control vs Authorization

When first learning about the difference between authentication and access control, it may be easy to confuse the two. However, they are two very different concepts. Also, they should understood well by any developer that is writing applications where access to the application needs to be controlled.

Read more…