What does it mean by client in the software design patterns? For instance I see this word has been mentioned a lot in design patterns, such as in this PHP Visitor Design Pattern tutorial. It even has a class called Client.
//Client.php
error_reporting(E_ALL | E_STRICT);
ini_set("display_errors", 1);
// Autoload given function name.
function includeAll($className)
{
include_once($className . '.php');
}
//Register
spl_autoload_register('includeAll');
class Client
{
private static $shapeElement;
private static $color;
private static $package;
//client request
public static function request()
{
self::$shapeElement= array();
self::$shapeElement=$_POST['shape'];
self::$color=$_POST['color'];
self::$package= array();
$obStructure = new ObjectStructure();
$colorVisitor= new self::$color();
//Attach concrete elements to array & accept visitor
foreach (self::$shapeElement as $shapeNow)
{
$obStructure->attach(new $shapeNow,$colorVisitor);
}
//Display selected shapes
self::$package=$obStructure->getElements();
foreach (self::$package as $colorShape)
{
echo $colorShape->showShape();
}
}
}
Client::request();
From wikipedia, the client in client–server relationship, which is what I usually understand it as,
A client is a piece of computer hardware or software that accesses a service made available by a server. The server is often (but not always) on another computer system, in which case the client accesses the service by way of a network. The term applies to programs or devices that are part of a client–server model.
Is this then the definition for client in the software design patterns as well?
If the client is made into a class,
class Client
{
...
}
then, can I have many clients as well and where should I keep these clients in MVC architectural pattern? Should/ can I create a directory called client and keep all client classes in it?
Aucun commentaire:
Enregistrer un commentaire