Abstract factory

A class who is responsible for creating objects, and hide concrete class names from the client, removing the dependency between client code and concrete implementations, and providing a single point in client code that can be switched out to provide a different set of objects to utilize.

The terms i use in this article can be described in a previous post i wrote “Basic terms of object oriented programming“.

For example we have system that provides some components, our components need a way to store data, and we like to provide our client with multiple choises, in how the data should be stored, to do that we provide two sets of components one that stores its data in a database and one that stores via the filesystem.

No Comments
February 24, 2010 in Object oriented programming, design patterns
Tagged , , , ,

Inheritance and composition.

A great thing about object oriented programming is the ability to reuse code from existing objects. This helps maintaining the system, because duplicated code is eliminated. There are two techniques in object oriented programming for reusing objects, both have their advantages and drawbacks, I will try to explain some of them in this post, and hopefully help you in your future design decisions.

Continue Reading »

No Comments
January 30, 2010 in Object oriented programming
Tagged , , ,

Basic terms in object oriented programming.

Object oriented programming (OOP), is a model that can provide structure to complex systems, this allow us to build systems that is maintainable.  Changes can be made to isolated parts of the system without breaking the rest of the system.

This is done by splitting the system up into objects, each object is focused on a single part of the system. This makes working in a team easy because different developers can concentrate on different parts and scopes of the system.

Some of the advantages OOP has over procedural, is the ability to create units that contain both the data and the methods that operates on the data,  in a single unit called an object, this makes code more readable, because data does not need to be passed back and fourth functions that operator on the data. With object’s you are given the ability to reuse code, by allowing one object to inherit methods and properties from another object.

One way to think about objects, is that you can look at practically any items in the real world as a collection of objects. Take a house for example, a house is built from many small individual objects, these object’s represent a single part of the house, Windows, Doors, Kicthen etc, and combined they form a house.

Think of objects as the nouns of your system. where the object methods is the verbs.

Continue Reading »

1 Comment
December 28, 2009 in Object oriented programming
Tagged , , ,

Mail from Zend Technologies

Today i got my certificate for my Zend Framework exam, and it comes with a giant sticker :)

Zend Framework certificate

2 Comments
December 2, 2009 in Uncategorized, Zend framework
Tagged ,

Late static bindings with PHP 5.3+

In previous versions of PHP before 5.3, its not possible to call derived static properties and methods from parent class methods. You could call it by the derived fully qualified class name, but this would require the parent class to know all classes that would ever extend it.

PHP 5.3 comes with a solution. A new keyword for the scope resolution operator called “static::”. The difference between “self::” and “static::” is “self::” will use the context of where the method is defined, to find its methods and properties, where “static::” will use the resolved context.

Continue Reading »

No Comments
November 22, 2009 in PHP
Tagged , , ,

Introduction to Iterators in SPL

The Standard PHP Library has a collection of predefined interfaces, by implementing these interfaces your objects sign a “contract” to expose the methods declared in the interface, just like any other interface would, the difference is the PHP engine recognize these interfaces, and have granted additional features for objects implementing them.

One feature is to control the process of how an object is to be iterated over, in PHP5 when iterating over an standard object all public properties are exposed, no other control is given. By implementing the Iterator interface from SPL you will gain “hook” points to control how a object is to be iterated over, another feature can add “syntactic sugar” and make your object callable like an array would, this is done with the ArrayAccess interface.

Continue Reading »

2 Comments
November 20, 2009 in Standard PHP Library
Tagged , , ,

Migrating my one.com mail to gmail

ive been for a while living with two personal emails, i decided today to migrate to gmail, the problem was the “Google Email Uploader” isnt for personal gmail accounts and required a google app’s account. So i couldnt find eny way to import all my outlook mails to gmail.

The solution was to:

  • Enable IMAP for my gmail mail (under settings).
  • Setup a new outlook account.
  • dragged all my old emails to the newly created account.
  • logged into one.com control panel, to setup my current email accounts to forward all mails to my gmail.

Quick and dirty but it worked!.

1 Comment
November 19, 2009 in Uncategorized
Tagged ,

Hello wordpress

just installed wordpress as blog for my website, installation was rediculess easy.
also added the first plugin called “google-syntax-highlighter”, and a custom theme found at

http://wordpressthemesbase.com/

echo "Hello world";
1 Comment
November 19, 2009 in Uncategorized
Tagged