Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry, wwwxxx jeffs, Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, sed: -e expression #1, char 1: unterminated address regex, procmail + change subject, w2ksp4.exe download

Links

XODOX
Impressum

#1: Tough questions

Posted on 2008-04-24 21:37:57 by UKuser

Studying away for the Zend exam (www.phparchitect.com) and 2 questions
have come up in the mocks which are confusing:

1) The __________ interface implements a useful design pattern which
allows you to overload an instance of an object so it can be accessed
like an array
[Confusion here - because of the overloading - is the answer simply
ArrayAccess?]

2) The following PHP script is an example of which design pattern?

<?php

interface HashAlgorithm {
public function hash($value);
}

class MyClass {

private $value;

public function __construct($value) {
$this->value = $value;
}

public function hash(HashAlgorithm $a) {
return $a->hash($this->value);
}
}

class MD5Hash implements HashAlgorithm {
public function hash($value) {
return md5($hash);
}
}


$obj = new MyClass("John");
$obj->hash(new MD5Hash());

?>
What pattern is this? I've looked through the regulars and not using
patterns regularly - can't see which it is.

A general Q - why is MVC so good? I understand it to be index.php?
page_to_redirect - with just it routing people to various pages. Why
is this such a good idea? I don't see a) how this separates business
logic and b) where the advantages come for say a single designer/
administrated site? To separate business logic - why couldn't I just
use a simple templating system? Maybe its a dumb question.

Thanks in advance.

A

Report this message