What is aggregation and composition of objects?

Hi,
Please tell me What is aggregation and composition of objects?
What are the difference ? Is there anyother type of Object in java ?
Thankzx
MerlinRoshina

Hi,
Composition is developing a single , complex system by combining subparts.
Aggregation :
a composition that encapsulates (hides) the parts . User cant able to access the parts outside .
Association:
a composition of independently constructed and externally visible parts. User can access the parts outside .
To get more detailed information,
http://people.cs.vt.edu/~kafura/cs2704/basic.concepts.html
thanks,
nvseenu.

Similar Messages

  • What is the difference between Aggregation and Composition with example

    plz help me to find the difference between Aggregation and Composition with example

    Dear [email protected]:
    Get back to work.
    August 4, 2007 stalin_gnana asked:
    I would like to know the description about 'is a' ,'has a' ..relationship in java.plz reply me to the above doubt if known
    August 8:
    Can any one encounter the clarification on how and where Observer class and Observable interface can be applied..plz answer me
    August 10:
    May you find a solution on why not have the concept of pointer,opterator overloading,virtual function and destructor in java
    (Also August 10):
    I would desire to apprehend the brief description about usage of Singletone class and where it can be applied.plz help me
    Today:
    I am having the doubt of 'is there any relation among Delegation and composition'.if have,plz answer to regarding question.
    And then this thread today too.
    sniff sniff
    I smell a lazy attempt at getting others to do one's homework for him.

  • Difference between aggregation and composition

    Are they essentially the same thing or is there a subtle difference ?

    Aggregation - "has x"
    class Triangle{
    public Point[] vertices = new Point[3];
    A triangle has three vertices. A Point can exist on it's own but the vertices of a triangle cannot exist without the triangle. So do you describe the relationship between a triangle and one of it's vertices as aggregation or composition.
    Composition - "contains x"
    So can we use this term to describe the relationship between a colelction and it's elements ? An element of the collection has no identity of it's own. So that fits the description. But we also say that a class is a composite type.
    Is is correct to say a class is a user defined data type that is an aggregate of it's component types ?

  • Aggregation - dynamic composition is referred to as aggregation

    Hi,
    This has been in my todo forever
    Need help to understand the statement "dynamic composition is referred to as aggregation"
    Is their an example for this statement. Using an example that most of us work on as part of college project work - WYSIWYG HTML Editor - where the Editor was an aggregation of Text, Paragraph, Bold, Underline etc (the various HTML Tags) and so. Does dynamic composition refers to the fact that the elements to be added to the Editor is determined at Run-time?
    This is a statements from "Thinking In Java - 4th Edition" - Page 32. Appreciate your help in clarification
    Thanks,
    AK

    Hi,
    Both Aggregation and composition are stronger form of Association and it depicts "Has a" relationship between
    classes. The difference between Aggregation and Composition is the lifetime of Composing and composed element.
    If Class A has B and class B has a life time only until A exists it's known as "Composition". If class A has class B and
    Class B has independent lifetime of its own then it's Aggregation.
    public class Editor {
         public Editor()
         public Paragraph getPara() {
              return para;
         public void setPara(Paragraph para) {
              this.para = para;
         public Text getText() {
              return text;
         public void setText(Text text) {
              this.text = text;
         private Paragraph para;
         private Text text;
    }Here i can add any paragraph, any text which is a Sub Type of Paragraph and Text to the editor dynamically.
    Hope i have clarified something.
    Thanks

  • What is the use for lock object and how to use the lock objects

    Hi Guru's,
    I am new to ABAP .Can you please clarify the that what is the use of lock object and how to use the loct object .what is use of the Deque & Enque  function modules .

    hi ,
    below are some minfo about lock objects :
      Lock Objects
    These types of objects are used for locking the access to database records in table. This mechanism is used to enforce data integrity that is two users cannot update the same data at the same time. With lock objects you can lock table-field or whole table.
    In a system where many users can access the same data, it becomes necessary to control the access to the data. In R/3 system this access control is built-in on database tables. Developers can also lock objects over table records.
    To lock an object you need to call standard functions, which are automatically generated while defining the lock object in ABAP/4 dictionary. This locking system is independent of the locking mechanism used by the R/3 system. This mechanism also defines LUW i.e. Logical Unit of Work. Whenever an object is locked, either by in built locking mechanism or by function modules, it creates corresponding entry in global system table i.e. table is locked. The system automatically releases the lock at the end of transaction. The LUW starts when a lock entry is created in the system table and ends when the lock is released.
    Creating Lock Objects
    Lock object is an aggregated dictionary object and can be defined by using the following steps:
    o From initial data dictionary screen, enter the name for the object, Click Lock object radiobutton and then click on Create. The system displays a dialog box for Maintain Lock Objects screen
    o Enter short text as usual and the name for primary table.
    -Save
    -Select Tables option
    From this screen you can:
    Select secondary tables, if any, linked by foreign key relationship.
    Fields for the lock objects. This option allows you to select fields for objects (R/3 system allows locking up to record level). Lock object argument are not selected by user but are imposed by the system and includes all the primary keys for the table.
    1) Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.
    2) Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.
    3) Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.
    Also, last but not the least, locking the object is logical (locking with any enqueue ) .so, you have to use the lock object while trying to access from second program .
    reward if helpful ,
    Regards,
    Ranjita

  • What is the diffrence between extends and creating new object?

    HI ALL,
    what is the diffrence between extends and creating new object?
    meaning
    class base{
    class derived extends base{
    class base{
    class derived {
    derived(){
    base var = new base();
    can u people tell me diffence from the above examples.
    THANKS.
    ANANDA

    When you create a new object you have to supply the class to which that
    object belongs. A class can extend from another class. If it does so
    explicitly you can define the 'parent' class from which the class extends.
    If you don't explicitly mention anything, the class will implicitly extend
    from the absolute base class named 'Object'.
    Your example is a bit convoluted: when you create a Derived object,
    its constructor creates another object, i.e. an object from the class from
    which the Derived class extends.
    Extending from a class and creating an object don't have much in common.
    kind regards,
    Jos

  • What's the difference between a not-initialed object and a null object

    hi guys, i wanna know the difference between a not-initialed object and a null object.
    for eg.
    Car c1;
    Car c2 = null;after the 2 lines , 2 Car obj-referance have been created, but no Car obj.
    1.so c2 is not refering to any object, so where do we put the null?in the heap?
    2.as no c2 is not refering to any object, what's the difference between c2 and c1?
    3.and where we store the difference-information?in the heap?

    For local variables you can't have "Car c1;" the compiler will complain.That's not true. It will only complain if you try to use it without initializing it.
    You can have (never used, so compiler doesn't care):
    public void doSomething()
       Car c1;
       System.out.println("Hello");
    }or you can have (definitely initialized, so doesn't have to be initialized where declared):
    public void doSomething(boolean goldClubMember)
       Car c1;
       if (goldClubMember)
           c1 = new Car("Lexus");
       else
           c1 = new Car("Kia");
       System.out.println("You can rent a " + c1.getMake());
    }

  • What is the best Practice to improve MDIS performance in setting up file aggregation and chunk size

    Hello Experts,
    in our project we have planned to do some parameter change to improve the MDIS performance and want to know the best practice in setting up file aggregation and chunk size when we importing large numbers of small files(one file contains one record and each file size would be 2 to 3KB) through automatic import process,
    below is the current setting in production:-
    Chunk Size=2000
    No. Of Chunks Processed In Parallel=40
    file aggregation-5
    Records Per Minute processed-37
    and we made the below setting in Development system:-
    Chunk Size=70000
    No. Of Chunks Processed In Parallel=40
    file aggregation-25
    Records Per Minute processed-111
    after making the above changes import process improved but we want to get expert opinion making these changes in production because there is huge number different between what is there in prod and what change we made in Dev.
    thanks in advance,
    Regards
    Ajay

    Hi Ajay,
    The SAP default values are as below
    Chunk Size=50000
    No of Chunks processed in parallel = 5
    File aggregation: Depends  largely on the data , if you have one or 2 records being sent at a time then it is better to cluster them together and send it at one shot , instead of sending the one record at a time.
    Records per minute Processed - Same as above
    Regards,
    Vag Vignesh Shenoy

  • What are the differences between PD objects and PA objects?

    can any one tell me What are the differences between PD objects and PA objects?

    PA is based on Infotypes 0000-0999. PD is based on Infotypes 1000-1999, chief being Objects Infotype 1000. Objects Infotype is the source of different Object Types such as Person, Position, Org Unit etc. You can check that through transaction OOOT.
    Regards
    Lincoln

  • What is the best book of objective c and from where i can download it?

    what is the best book of objective c and from where i can download it?

    Before purchasing a book be sure to exhaust the excellent resources on the Apple Developer Site. There are quite a few guides, references, and samples for Objective-C.
    Learning Objective-C: A Primer
    The Objective-C Programming Language
    Object-Oriented Programming with Objective-C
    etc.
    If you are developing for Mac or iOS, there are plenty of other documents describing the frameworks, including the Cocoa Fundamentals Guide,  iOS App Programming Guide, etc.
    If you want to create iOS apps, start here.
    Start Developing iOS Apps Today

  • What is generalization, aggregation and specification in database abstraction ?

    What is generalization, aggregation and specification in database abstraction ?

    The following link might be a start.
    http://cs-exhibitions.uni-klu.ac.at/index.php?id=433

  • What are the differences between inactive and active ABAP objects?

    Can anybody tell me what are the differences between inactive and active ABAP objects?
    In my opinion,  an active object is compiled and system wide available, that means the system do not have to compile the program again before run or use the object. While An inactive object is not system wide available and every time you run an inactive object, firstly the abap runtime will have to  generate a tempory runtime object and this inactive object can not seen by others.
    Am I right? Can anybody kindly tell me other differences?

    Hi,
    "When it is inactive, it is like it would not exist at all:" no - it's like it only exists to you
    "If we just saved that one means it is stored in application server not in database": no - the inactive version is also stored in the database. You can log off and log on and it will still be there, in its inactive status.
    "Only active objects can be executed.": no - inactive objects can be executed by you
    When you create or modify a program, it is inactive until you activate it.
    With a change, there are two versions of the program stored in the database - the active version (as it was before you made your change), and the inactive version. If you attempt to run the program, you'll run the inactive version - the one with your changes. Everyone else on the system will run the active version.
    In this way, you can make changes without affecting anyone else.
    Once you activate your program, then the inactive version becomes the active version.
    With a create, there is no active version, until you hit the activate button. This means ONLY you can run the program.
    An additional benefit of this model, is that if you make a change, save it, and then change your mind without activating, you can recover the active version into the editor, using version management.
    A downside is that sometimes you have to activate your change before you can test it, if it interacts with other, active, programs.
    Regards,
    Kumar

  • What is standard and exception aggregation?

    What is standard and exception aggregation?

    hi there ,
    check out this link for scenarios of exception aggregation :
    http://help.sap.com/saphelp_nw04/helpdata/EN/d2/e0173f5ff48443e10000000a114084/content.htm
    regards,
    Supriya

  • What is the Collection that returns and removes the Object simultaneously

    Hi Java Experts,
    I believe I'm looking for a Collection that will allow me to (a.) return an object and (b.) remove the object from the collection simultaneously (c) without having to specify the index location of the object. Very similar to what you can do when you enumerate through a Properties Object.
    Here is a description of why I think this is the solution that I want. - Perhaps some Design Pattern Experts can help.
    I am making an application that is supposed to loop continuously through a collection while adding more information to the collection (example: in a while(collection.size()>0){ take some action })
    The action taken inside the while loop would add more items to the collection. I'm hoping that fact would be picked up by collection.size()>0 and cause the iteration to continue.
    I am doing this solution within one thread and class. But I'm also going to let this thread feed another Class (A controller thread) with different items which are added to It's collection for it's own loop. That solution will have to handle multiple threads feeding information to it's solution.
    Here is example code below of how i'm proposing this would work in a single threaded class.
    thanks for all the help
    * DESCRIPTION: I want to loop through a collection infinitely by
    * making the thread continually add to the collection.
    import java.util.*;
    public class TESTSOLUTION implements Runnable{
         public static void main(String[] arg){
              TESTSOLUTION tv = new TESTSOLUTION();
              Thread t = new Thread(tv);
              t.start();
              System.out.println("Finished Main");
         public TESTSOLUTION(){
              ACollectionType = new TreeSet();
              ACollectionType.add("BAT");
              ACollectionType.add("BALL");
              ACollectionType.add("MIT");
         public void run(){
              while(ACollectionType.size()>0){
                   //THIS IS WHERE I WANT TO BE ABLE TO REMOVE AN ITEM FROM THIS COLLECTION
                   //WITHOUT SPECIFYING THE index
                   //I just want to call a method and return the object and simultaneously
                   //remove to the object
                   outputString((String)ACollectionType.first());
                   counter++;
         private void outputString(String s ){
              try{
                   Thread.sleep(400);
              }catch(InterruptedException e){
                   System.out.println("interrupted");
                   System.out.println("s = " + s );
                   //I AM TRYING to add to the object and have the result picked up
                   // by (perhaps) the ACollectionType.size()>0 method and run the while
                   // loop infinitly
                   ACollectionType.add("TOY#"+counter);          
         private TreeSet ACollectionType = null;
         private int counter = 0 ;
    }

    woops here is what i mean --- i got this code to work -- you can run it for yourself .
    * DESCRIPTION: I want to loop through a collection infinitely by
    * making the thread continually add to the collection.
    import java.util.*;
    public class TESTSOLUTION implements Runnable{
         public static void main(String[] arg){
              TESTSOLUTION tv = new TESTSOLUTION();
              Thread t = new Thread(tv);
              t.start();
              System.out.println("Finished Main");
         public TESTSOLUTION(){
              ACollectionType = new TreeSet();
              ACollectionType.add("BAT");
              ACollectionType.add("BALL");
              ACollectionType.add("MIT");
         public void run(){
              while(ACollectionType.size()>0){
                   //THIS IS WHERE I WANT TO BE ABLE TO REMOVE AN ITEM FROM THIS COLLECTION
                   //WITHOUT SPECIFYING THE index
                   //I just want to call a method and return the object and simultaneously
                   //remove to the object
                   Object ss = ACollectionType.first();
                   outputString((String)ss);
                   ACollectionType.remove(ss);
                   counter++;
         private void outputString(String s ){
              try{
                   Thread.sleep(400);
              }catch(InterruptedException e){
                   System.out.println("interrupted");
                   System.out.println("s = " + s );
                   //I AM TRYING to add to the object and have the result picked up
                   // by (perhaps) the ACollectionType.size()>0 method and run the while
                   // loop infinitly
                   ACollectionType.add("TOY#"+counter);          
         private TreeSet ACollectionType = null;
         private int counter = 0 ;
    }

  • Aggregation Vs composition

    I got to know that:
    In aggregation we use the object by reference.
    In composition we use the object by value.
    can some one provide me what does this mean to the Java developer. It will be great if you can explain it with simple sample codes for each scenario.

    Java does not do pass by reference.yes it does. object values are passed by reference,
    not by value. it is the passing mechnism that is pass
    by value.
    assuming the famous sayings of jg is true, what he
    was saying is 'java does not pass objects, java
    passes its references, and the references are passed
    by value'.
    as you claimed in the past that you have thirty years
    of experience programming in c++, you should be able
    to comprehend this very well. and by this, i mean
    entry level stuff.Java passes by value. The fact that the value might be a reference itself is irrelevent. Passing a reference by value is not the same as passing by reference.
    I probably didn't actually need to say that since anyone passing by should immediately notice you contradicted yourself to begin with. "object values are passed by reference" and "java does not pass objects". It's amazing how you can sit there and say with a straight face that Java passes something it does not pass through a particular methodology. Yes, I know that's not what you really meant, I understand quite clearly exactly what you meant, the problem it's the same fuckin thing everyone else meant and you're just reiterating the obvious and pretending it's somehow different.
    All you've done is backup jschell. Java doesn't pass objects, it passes their reference by value. Nothing is passed by reference, period.

Maybe you are looking for