Category: Programming

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 ( 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…

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…

N-Tier Model-View-Controller


The classic MVC (Model-View-Controller) architecture (see Fig. 1) has the View communicating with the Controller and the Model. However, this leads to coupling between the Model and View, View and Controller, and Controller and Model. A case could be made that is a significant amount of coupling. Unfortunately, coupling is the bane of software development. Additionally, coupling makes software hard to change. Instead, an N-Tiered approach to the MVC pattern was created to alleviate the coupling and create a more flexible design.
Read more…

Quick and Dirty PHP Test Driven Development

A long time ago, a unit testing framework for PHP was needed. At the time, there were many preexisting and comprehensive unit testing frameworks. However, a framework was needed that had the ability to run the tests from a browser. Additionally, a framework was required that would easy to integrate into a project while not increasing the footprint too much.

To satisfy these constraints, a PHP unit testing framework called QnDPhpUnitTest was written (UPDATE: This has been superseded by KissTest). Interestingly, the framework and the project that the framework was originally written for were created simultaneously. When an assert was needed, the assert method was written and then the assert was performed. One of the key benefits of this framework is the ability to include a single class and then start writing tests. Also, the framework is so simple that learning how to use it should take no more than a 5-10 minutes.

First MCPD Test Passed!

The first of the tests (70-536) required for the MCPD certification ASP.NET Developer 3.5 on Visual Studio 2008 has been passed with a score of 976/1000. Since it was the first test that has been attempted, a large amount of effort went into the process of preparation. The minimum passing score for the test is 700. Perhaps, the amount of studying to get a 976 was a bit of an overkill.

The vast majority of the studying was performed using the MCTS Self-Paced Training Kit (Exam 70-536). The secondary source of material for studying came from Niall’s blog.

Niall’s study guide is a collection of targeted links into the MSDN Library. Lastly, but certainly not least, study assistance software of my own creation (i.e. Project Serenity) was used to help prepare.

The next test in the lineup is 70-562.