vote up
0
vote down

Deciphering Magic Methods in PHP

PHP provides a number of ‘magic’ methods that allow you to do some pretty neat tricks in object oriented programming. These methods, identified by a two underscore prefix (__), function as interceptors that are automatically called when
 
Steve Guidetti
Jul 20 2010 05:52 AM
vote up
0
vote down

Practical Php Patterns: State

This post is part of the Practical Php Pattern series. The pattern of today is the State one: its intent is allowing an object to change its behavior when its state change, while hiding the state-related informations. The main role in this pattern is
tags: oop
Mar 18 2010 05:36 PM
vote up
0
vote down

Prototype vs Class Inheritance in YUI 3

As I mentioned in the post YUI 3.0 – Changes From the Root, YUI 3 is a radical evolvement of the framework. One of the most interesting features it provides with is about much better support for OOP. YUI 3 supports two inheritance patterns via object
 
Jimmy Vu
Mar 15 2010 09:13 PM
vote up
0
vote down

Standard Php Library and coupling

The Standard PHP Library is an object-oriented library, by default always included in the latest versions of php. Leveraging Spl in the right way is crucial to avoid compromising the design of an application and taking advantage of the most portable php
tags: oop
Mar 11 2010 10:52 PM
vote up
0
vote down

Practical Php Patterns: Observer

This post is part of the Practical Php Pattern series. Today's pattern is the Observer one. The intent of this pattern is breaking a [usually one-to-many] dependency between objects by making the set of objects act as Observers of a Subject one, which
tags: oop
Mar 09 2010 05:12 PM
vote up
0
vote down

Practical Php Patterns: Memento

This post is part of the Practical Php Pattern series. The pattern of today is the Memento one, whose intent is storing the state of an Originator object without breaking its encapsulation, which typically consists in a set of private fields. For the
tags: oop
Mar 03 2010 05:59 PM
vote up
0
vote down

Practical Php Patterns: Mediator

This post is part of the Practical Php Pattern series.   The pattern of the day is the Mediator one. The intent of this pattern is encapsulating the interactions of a set of objects, preventing aggressive coupling from each of them towards the other
tags: oop
Mar 01 2010 05:17 PM
vote up
0
vote down

The 50000 feet view and Dependency Injection

One criticism of Dependency Injection is the supposed unnecessary abstraction over collaborators that it is imposed by the constructor and setter injection techniques. Writing: class Computer {     public function __construct(Cpu $cpu) {  
tags: oop
Feb 23 2010 05:54 PM
vote up
0
vote down

Objects to Unify Type Classes and GADTs

Objects to Unify Type Classes and GADTs, by Bruno C. d. S. Oliveira and Martin Sulzmann: We propose an Haskell-like language with the goal of unifying type classes and generalized algebraic datatypes (GADTs) into a single class construct. We treat
Feb 23 2010 03:18 AM
vote up
0
vote down

Practical Php Patterns: Iterator

This post is part of the Practical Php Pattern series.   The behavioral pattern of the day is the Iterator pattern, which provides an abstraction over a very common process: the iteration over a collection of objects [or scalars] located in an
tags: oop
Feb 22 2010 06:58 PM
vote up
0
vote down

The Number one rule of design

The post on php's foreach construct raised a discussion about the design of the language and of userland code, so I'm recollecting my thoughts here. However, note that I was not discussing the utility of the construct, only the use of array functions
tags: oop
Feb 19 2010 09:24 PM
vote up
0
vote down

Practical Php Patterns: Interpreter

This post is part of the Practical Php Pattern series.   The behavioral pattern of today is the Interpreter pattern, which consists in a representation of a grammar with a Composite class hierarchy, where rules are mapped to classes. An expressio
tags: oop
Feb 18 2010 05:06 PM
vote up
0
vote down

Testing protected members

This is a follow-up to Testing private members. In the previous post, we discussed how to make sure that code in a private method is tested without accessing it directly, since that would imply the use of reflection and a violation of the class contract
tags: oop
Feb 16 2010 09:08 PM
vote up
0
vote down

Joe-E: A Security-Oriented Subset of Java

Joe-E: A Security-Oriented Subset of Java. Adrian Mettler, David Wagner, and Tyler Close. To appear at ISOC NDSS 2010. We present Joe-E, a language designed to support the development of secure software systems. Joe-E is a subset of Java that makes it
Feb 16 2010 12:42 PM
vote up
0
vote down

Practical Php Patterns: Command

This post is the second one in the behavioral patterns part of the Practical Php Pattern series. The behavioral pattern we will discuss today is the Command one, a mechanism for encapsulation of a generic operation. If you are familiar with C or Php, you
tags: oop
Feb 11 2010 06:29 PM
vote up
0
vote down

Testing private members

Yesterday, Sebastian Bergmann, the author of PHPUnit, posted his response to a question he is asked frequently, How do I test private members of a class? He summarizes the ways to access private fields and methods of an object from a PHPUnit test case,
tags: oop
Feb 10 2010 07:15 PM
vote up
0
vote down

Practical Php Patterns: Chain of Responsibility

This post starts the behavioral patterns part of the Practical Php Pattern series. The first behavioral pattern of this part of the series is named Chain of Responsibility. Its intent is organizing a chain of objects to handle a request such as a method
tags: oop
Feb 09 2010 03:44 PM
vote up
0
vote down

Design Patterns - The Command Pattern

There's a lot of knowledge in the book Design Patterns (Gang of Four). Developers should know the material in there to write efficient and maintainable code, but the book is pretty dry. I'd say it's quicker and easier to just point curious folks at the
 
Dean Jackson
tags: oop
Feb 08 2010 08:41 PM
vote up
0
vote down

Practical Php Patterns: Structural patterns summary

This post is part of the Practical Php Pattern series. The GoF book says there is a lot of similarity between structural patterns because of the few kinds of relationships in object model structures: inheritance and implementation between classes plus
tags: oop
Feb 08 2010 06:41 PM
vote up
0
vote down

Practical Php Patterns: Proxy

This post is part of the Practical Php Pattern series.   The structural pattern of today is the Proxy pattern, an enhancement on the simple handler (or pointer) used as a reference to an object: this pointer is substituted by a Proxy object which
tags: oop
Feb 04 2010 07:57 PM
vote up
1
vote down

Practical Php Patterns: Facade

This post is part of the Practical Php Pattern series. The structural pattern of today is the Facade one. A Facade is a class that provides a unified interface to a subsystem, totally abstracting away the concrete classes which compose it. The Client is
tags: oop
Jan 29 2010 09:38 PM
vote up
0
vote down

Practical Php Patterns: Decorator

This post is part of the Practical Php Pattern series. Today we will explore the Decorator pattern, an alternative to subclassing which favors object composition over class inheritance. A common issue of subclassing is its rigidity: when different
tags: oop
Jan 25 2010 06:04 PM
vote up
0
vote down

Practical Php Patterns: Composite

This post is part of the Practical Php Pattern series. One of the most important structural patterns is the Composite one: its goal is managing a hierarchy of objects where both leaf objects and composition of other objects conform to a common interface.
tags: oop
Jan 20 2010 08:38 PM
vote up
0
vote down

Relationships between objects

This article implements the beginner pattern, but it can also be useful to recap the terms we use lightheartedly in discussions about object-oriented programming. In the definitions, we will talk about a relationship between a Source and Target objects,
tags: oop
Jan 19 2010 07:10 PM
vote up
0
vote down

Practical Php Patterns: Bridge

This post is part of the Practical Php Pattern series. Today we will explore the Bridge pattern, whose intent is separating an abstraction from its implementation to improve decoupling and allowing them both to change independently. Commonly an
tags: oop
Jan 18 2010 09:40 PM
vote up
0
vote down

Practical Php Patterns: Adapter

This post starts the Structural patterns part of the Practical Php Pattern series. Structural patterns are concerned with the structure of the object graph, and influence the hierarchy of subclassing, and where to introduce interfaces and associations.
tags: oop
Jan 15 2010 06:14 PM
vote up
0
vote down

Practical Php Patterns: Creational patterns summary

This post is part of the Practical Php Pattern series. It's useful to dedicate a post to summarize the various creational patterns we have studied so far. The goal of this recap is to outline differences between patterns to analyze each one's
tags: oop
Jan 14 2010 06:28 PM
vote up
0
vote down

Practical Php Patterns: Singleton

This is the fifth post from the Practical Php Pattern series, which will touch the majority of the known design patterns, with a special look at their application in a php context and code samples. Today we will discuss the Singleton pattern, the most
tags: oop
Jan 13 2010 09:04 PM
vote up
0
vote down

Practical Php Patterns: Prototype

This is the fourth post from the Practical Php Pattern series, which will touch the majority of the known design patterns, with a special look at their application in a php context and code samples. Today we will discuss the Prototype pattern. The
tags: oop
Jan 12 2010 05:36 PM
vote up
0
vote down

Practical Php Patterns: Factory Method

This is the third post from the Practical Php Pattern series, which will touch the majority of the known design patterns, with a special look at their application in a php context and code samples. The third creational pattern we will study is the
tags: oop
Jan 11 2010 06:20 PM
vote up
0
vote down

Encapsulation in JavaScript

Encapsulation is a useful technique in programming which allows you to separate an abstraction’s implementation from its interface, thus enabling future changes to the implementation without affecting the interface. There are other benefits of
 
James
Jan 09 2010 06:57 PM
vote up
0
vote down

Practical Php Patterns: Builder

This is the second post from the Practical Php Pattern series, which would touch the majority of the known design patterns, with a special look at their application in a php context. A running code sample will be provided for each part of this series.
tags: oop
Jan 08 2010 05:32 PM
vote up
0
vote down

Practical Php Patterns: Abstract Factory

This is the first installment of the Practical Php Patterns series, which would touch the majority of the known design patterns, with a special look at their application in a php context. A running code sample will be provided for each part of this
tags: oop
Jan 07 2010 06:19 PM
vote up
0
vote down

OOP: Behavioural and Structural constraints

A few months ago I wrote a post describing how we should test the behaviour of code rather than the implementation whereby we would write tests against the public API of an object rather than exposing other internal data of the object and testing against
 
Mark Needham
tags: oop
Dec 31 2009 09:23 PM
vote up
0
vote down

OOP: Behavioural and Structural constraints

A few months ago I wrote a post describing how we should test the behaviour of code rather than the implementation whereby we would write tests against the public API of an object rather than exposing other internal data of the object and testing against
 
Mark Needham
tags: oop
Dec 31 2009 08:44 PM
vote up
0
vote down

Super and Inner - Together at Last!

Super and Inner - Together at Last! by David S. Goldberg, Robert Bruce Findler, and Matthew Flatt, 2004. In an object-oriented language, a derived class may declare a method with the same signature as a method in the base class. The meaning of the
tags: oop
Dec 22 2009 03:16 PM
vote up
0
vote down

How to implement OOP Polymorphism in Rebol

According to Wikipedia: Parametric polymorphism is a way to make a language more expressive, while still maintaining full static type-safety. A function that can evaluate to or be applied to values of different types is known as a polymorphic
 
admin
Dec 19 2009 01:06 AM
vote up
0
vote down

How to group related Global Objects / Functions into "Modules"

When program grows, best practice is to organize source code by modules. There’s no explicit concept of “Module” per se in Rebol 2 unlike other languages like Ruby and of course Java, .NET, etc. but Rebol could have the same kind of
 
admin
Dec 19 2009 12:03 AM
vote up
0
vote down

How Dynamically Extend an Object

Dynamic Languages are hot today since people now realize that static language properties are less suitable for some kind of tasks like Behavior Driven Development. Javascript Framework like Prototype has a method for extending an object, and even now
 
admin
Dec 17 2009 09:08 PM
vote up
0
vote down

The object graph

Stefano wrote to me with the intention to expand the discussion on the object graph concept, which I referred to earlier. As always, I think that sharing my thoughts can help other readers and also provide some feedback about these ideas. A bit of theory
tags: oop
Dec 16 2009 03:54 PM