Association / Aggregation / Composition


    Create a folder called "Links"
    Create a shortcut/link inside this folder and link it to
    Create another shortcut/link instide this folder and link it to
    Ask your friend to do the same on another machine using same links ( and )
    Delete the "Links" folder, and open your browser to check if and  still exist or not

Briefly, Association is a relationship where all the objects have different lifecycles. there is no owner.


    Create a file called file.txt
    Make a simple Application to open the File.txt (rw mode), but don't program it close the connection.
    Run an instance of this application (it should work ok and can open the file for rw)
    Keep the first instance, and run another instance of this application (In theory it should complain that it can't open the file in rw mode because it is already used by other application).
    Close the 2 instances (make sure you close the connection).

From the above application, we understand that the Application and the File has a separate lifecycles, however this file can be opened only by one application simuletanously (there is only one parent at the same time, however, this parent can move the child to another parent or can make it orphan).


    Open a new Document name it as test.txt
    Write this sentence inside this document "This is a composition".
    Save the document.
    Now, delete this document.

This is what is called composition, you can't move the sentence "This is a omposition" from the document because its lifecycle is linked to the parent (i.e. the document here !!)