Computers

class HelloWorld  {
	private $_sText;
	
	public function __construct()  {
		$this->_sText = 'Hello World!';
	}	
	public function sayHello()  {
		print_r($this->_sText);
	}
}
$hello = new HelloWorld();
$hello->sayHello();

$user = new User();
if($user->interests() == 'Computers')  {
	print_r('Awesome!');
} else  {
	print_r('Awww... ={');
}

Newest Offering

Tuesday, February 9, 2010 - 21:25

This is amazing stuff. These guys hacked into a building's light controls and turned the side of an office building into a game of Space Invaders. This awesomely funny.

Watching this video got me thinking: how would you go about designing and testing something like this prior to actually doing it?

I think I would probably write a super-simple version of the game and test it with a light-board and a couple controllers before trying it on a building. But it couldn't be that much different. How would you do it?

Random Post

Wednesday, June 17, 2009 - 02:10

Download the source for the Composite Pattern.

When dealing with data structured as a tree it is necessary to discriminate between a branch and a leaf, not to mention that the structure may include primitive and complex objects. Handling these structures can require complex code but with an interface we can allow the primitive and complex objects to be treated uniformly and simplify the code. The Composite Pattern allows us to do just that by using the same base component to construct our primitive and higher level objects, making them interchangeable; this sort of structure is used to represent part-whole hierarchies.

A good example of this pattern can be seen in a website’s navigation menu: a typical navigation menu might be made up of buttons and submenus of buttons. In order to build our menu we will first need to create our base object. For this we could use an interface but I have chosen to...