Jump to content

Association, aggregation & composition


MelodyMaker

Recommended Posts

HI!

I'm a bit confused about the associations between objects, so I would like to ask you about it, by using the following example:

 

 

class DatabaseManager{     
     
    private function __construct(){} 
    private function __clone(){} 
     
    static public function getInstance(){ 
        switch (Configuration::getInstance()->DBMS){ 
            case "mysql": 
                return MySqlDB::DBgetInstance(); 
                break; 
            default: 
                return MySqlDB::DBgetInstance(); 
        } 
    } 
} 

Class Configuration{ 
    private $DBconn     = "localhost|myUser|myPwd|myDB"; 
    private $sessionExpiration = 3600; 
    private $DBMS = "mysql"; 
    private static $confInstance; 
         
    private function __construct(){} 
     
    public static function getInstance(){ 
           if (!self::$confInstance){ 
            self::$confInstance = new Configuration(); 
        } 
        return self::$confInstance; 
    }   
             
    public function __GET($property){         
        if(isset($this->$property)){ 
            return $this->$property; 
        } 
        return false; 
    } 
     
    private function __clone(){} 
} 

Class MysqlDB{ 
private $conf; 
public function __construct(){ 
  $this->conf = Configuration::getInstance(); 
  ... 
} 

...bla bla 
} 


I just would like to know what kind of association ther is between 

I just would like to know what kind of association ther is between the configuration and the other two classes. I've just started to draw UML diagrams, and I'm getting mad about it...

 

Thanks in advance!

 

Davide

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.