Hello again,
Been sleeping -- this thread sure moves fast
.
PHP Code:
$area = $obj->getAttrContainer()->get('width') * $obj->getAttrContainer()->get('length');
// or
$area = $obj->width * $obj->length.
I have only one motivation for the first of the two approaches. Simply put, the second approach typically only allows a single data namespace per object. For 90% of object applications, this is fine, however, there are many objects that do require more than one datanamespace, therefore acting within a code convention is required.
PHP Code:
Interface DataSource {
...
public hasPath($path);
public setViaPath($path, $value);
public getViaPath($path);
public unsetViaPath($path)
}
I don't see why all of this is necessary -- that functionality can be emulated using a straight set/get routine. If one wanted to extend/decorate the base DataSource class the provide the path-specific queries, shouldn't that be the goal?
PHP Code:
$group = $session->getItem('/path/to/groups/administrators');
$user = $session->getItem('/path/to/users/newAdmin');
$user->setProperty('group', $group->getUUID(), PropertyType::REFERENCE);
// or
$user->setProperty('groups', array($group->getUUID(), etc.), PropertyType::REFERENCE);
// later in the code - possibly a Parameterized Specification
if (!$user->hasProperty('group')) {
// take default action?
}
elseif ($user->getProperty('group')->getValue() == 'administrators') {
echo "Welcome home sir...";
}
This looks something like the way Mojavi current does sessions. Currently, for sessions, you have User class implementations (a front end) and Session Storage Containers (back end). The entire session is loaded in at framework load, then flushed out at framework end.
PHP Code:
$user->getProperty('group')->getValue() == 'administrators'
Shall I just assume that someone has created a "String" object? If so, why? Wouldn't the better approach be to have PHP Internals fellows provide type-hinting on basic variables as opposed to moving towards a heavier, java-esque implementation?
Regards,
Tyler Tompkins
Bookmarks