What's the difference between component & a class?

Discussion in 'C++' started by orangepic333, Dec 17, 2004.

  1. orangepic333

    orangepic333 Guest

    Could someone tell me what's the difference between the two?


    Is it that a class is used within an OO language while a component can
    be exported between OO languages?


    Are there other differences?


    Thank you for your help.
     
    orangepic333, Dec 17, 2004
    #1
    1. Advertising

  2. orangepic333

    Phlip Guest

    orangepic333 wrote:

    > Could someone tell me what's the difference between the two?
    >
    >
    > Is it that a class is used within an OO language while a component can
    > be exported between OO languages?


    Yes. A class has a public interface, and a component has a published
    interface.

    > Are there other differences?


    Only in context.

    --
    Phlip
    http://industrialxp.org/community/bin/view/Main/TestFirstUserInterfaces
     
    Phlip, Dec 17, 2004
    #2
    1. Advertising

  3. orangepic333

    Howard Guest

    "orangepic333" <> wrote in message
    news:...
    > Could someone tell me what's the difference between the two?
    >
    >
    > Is it that a class is used within an OO language while a component can
    > be exported between OO languages?
    >
    >
    > Are there other differences?
    >
    >
    > Thank you for your help.
    >


    C++ does not define "component", as far as I know.

    In the MAC world, a component is actually a folder (directory) containing
    sub-folders and specific types of files that represent an application the
    user can run. The actual application is stored somewhere in the folder
    tree. The operating system's Component Manager handles locating and loading
    such applications (as requested through Finder actions by the user or via
    other processes).

    In the Windows COM world, a component is a loadable object, with a specific
    interface derived from the standard IUnknown interface specification, which
    is constructed such that external processes can query the object (via the
    Windows registry), and make use of its published properties and functions
    through an instance of a class that implements the derived interface.

    Or, the term component may simply mean a part of a larger system, such as
    the user-interface component or the audio processing component or the user
    log component.

    A class, on the other hand, is very specifically defined in C++ terms,
    (although I don't have the formal specificaion for the term handy). Read
    your C++ book for more info on classes.

    -Howard
     
    Howard, Dec 17, 2004
    #3
  4. orangepic333

    Casper B Guest

    orangepic333 wrote:
    > Could someone tell me what's the difference between the two?


    A component is generally bigger and more abstract than a class. While a
    class is a relatively low-level blueprint for an object instance, a
    component might be a set of classes which together forms an encapsulated
    module you then interface with. A component might even contain no
    classes at all!

    Components are usually proven domain solvers, also known as packages,
    toolset etc. depending on language. If a component has proven itself it
    can significantly simplyfy the architecture (reduce complexity) as it is
    viewed as a black-box, focusing only on the interfaces.

    > Is it that a class is used within an OO language while a component can
    > be exported between OO languages?


    Yes that's not far off, since you might have your component in a .dll
    file which you link to externally. Strictly speaking a class can also be
    exported, .NET adds a lot of functionality for cross language mixing.

    A component might be compiled into the source tree (static component) or
    linked at runtime (dynamic component). COM/COM+/ActiveX, EJB, CORBA are
    all frameworks for Component Based Software Engineering (CBSE). In
    general a component is much more tolerent than a class when it comes to
    language independance, platform independance and configurability - and
    usually you do not touch the code of a component at all, if you do, the
    component has a bad design.

    /Casper
     
    Casper B, Dec 17, 2004
    #4
  5. orangepic333

    Malcolm Guest

    "orangepic333" <> wrote
    > Could someone tell me what's the difference between the two?
    >
    > Is it that a class is used within an OO language while a component can
    > be exported between OO languages?
    >
    > Are there other differences?
    >

    You are sort of right.

    "class" is a keyword in both C++ and Java. In both languages, a class
    consists of data members grouped together, and functions or methods that act
    on them. Usually the data members are made "private", so only the class
    methods have direct access to them.
    Where C++ and Java differ is the way in which classes can enter into
    relationships with each other. Both allow inheritance, though Java calls it
    extension. C++ allows multiple inheritance, whilst Java allows classes to
    implement interfaces.

    Now "component" doesn't have a defined meaning in either language. So you
    need to know what context the person is using the term in. He may mean
    simply a library, or a visual window on a GUI. In Java, he probaly means a
    Java "bean", which is a special sort of Java class that can serialise
    itself, and can be instantiated without source code. In a Microsoft context,
    he probably means COM, the Microsoft component interface. This is basically
    a C++ interface but is formally language-independent. Essentially
    applications use a third party library by querying for supported
    "interfaces". Direct X is built round COM, so that different graphics
    hardware devices can be accessed by the same game without the need to
    compile for all platforms.
     
    Malcolm, Dec 19, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SoftLion
    Replies:
    2
    Views:
    1,776
    =?Utf-8?B?TmVpbA==?=
    Jul 8, 2004
  2. jakk
    Replies:
    4
    Views:
    12,614
  3. RC
    Replies:
    6
    Views:
    6,756
    Chris Smith
    Sep 27, 2005
  4. Replies:
    4
    Views:
    865
    Rolf Magnus
    May 17, 2006
  5. rmn190
    Replies:
    1
    Views:
    320
    Alex Hunsley
    Apr 6, 2007
Loading...

Share This Page