Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

udp high ports, d-link extract firmware dsl-2750u, wwwwxxxxx.2G, yxxxcom, WWWXXX, ftp://192.168.100.100, wwwxxx 100, www.xxxcon, wwwxxx, oom killer misbehaves postgresql

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