Ree wrote:Unfortunately we don't have McGruff here.
A Different View on Front Controller
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
n00b Saibot wrote:This needs elaboration...arborint wrote:You also might want to try composition rather than creating objects internally.
Code: Select all
class User
{
// Variables...
var $_UserID;
var $_Area;
var $_DB;
// Functions...
function User($UserID = '', $Area = '', $db)
{
$this->_DB = $db;
if (is_int($UserID))
$this->setUserID($UserID);
if($Area != '')
$this->_Area = $Area;
}
...
}
$user = new User($userid, $area, new DB($dsn));(#10850)
Here's the first one...Jcart wrote:Ree wrote:Unfortunately we don't have McGruff here.
Jcart, we all know the story and we all know it didn't improve McGruff's reputation, but you do have to give him credit for many helpfull posts in the OOP/unit testing department. Many did find his input very useful, myself included. And that's exactly what I had in mind when posting.
So you don't have to roll your eyes.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
That does have a bit there, only dullified by his own self. OK drop this off-topic rant right now!!!Ree wrote:Here's the first one...Jcart wrote:Ree wrote:Unfortunately we don't have McGruff here.
Jcart, we all know the story and we all know it didn't improve McGruff's reputation, but you do have to give him credit for many helpfull posts in the OOP/unit testing department. Many did find his input very useful, myself included. And that's exactly what I had in mind when posting.
So you don't have to roll your eyes.
Let's move on...
well, arborint thanks to you. I am going some pretty good direction. These were just thoughts in my mind which you materialized in the form of concrete examples. I have had speculated them some time back. Now I have to incorporate these changes in my `system`
You talked about Repository-Factory type impl. can you show me an example on this road.
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
Now after spending about 1-2 hours on phpPatterns.com site and reading Factory pattern, I find it to be most valuable suggestion to use Factory Pattern in my code. It suits me well and will help clear some mess in my library. thanks, arborint & timvw 