mat byrne .com web design & development

Extending Functions in Javascript

Lately I’ve been writing a lot of Javascript, definitely a trend that I expect to continue for the foreseeable future. While working on a recent project I came across the following problem:

var condition = another_condition = true; // For this example to work!

function animate (callback)
{
    c = (typeof(callback) == 'function') ? callback : function () {};

    if (condition) {
        c = function () {
            c();
            console.log('bar');
        };
    }

    if (another_condition) {
        c = function () {
            // More functionality.
            console.log('baz');
            c();
        };
    }

    c();
}

animate(function () { console.log('foo'); });

Read more »

Dynamic Domain Objects in PHP

Modeling real-world objects with computer Data Structures is one of the more fundamental principles of Computer Science.

Data Models however are often tied heavily to their storage medium, whether that be an SQL database, files on a filesystem or a web-service. The idea of implementing a Model/Mapper system is to decouple the format in which we wish to manipulate data from the format that we store it.

Read more »

Zend Framework in Practice

With all the components available to a developer using Zend Framework, it can definitely be a daunting task working out how best to use all the pieces to build your web applications.

I tend to work best through example, so let me walk-through how we use ZF in our business, and what components I used in this site to build a blogging engine. At the office we’ve been using the Zend Framework in production for about a year now. A lot has changed in the last year, but as most people who use open source software in a production environment will tell you, this is definitely common for a fairly young project like ZF.

Now almost all of our projects are based on ZF, and it’s modular architecture has led us to develop our own internal library which mostly houses extensions to existing ZF Components.

Read more »