Inheritance vs Aggregation

I have an abstract class A that has a couple of concrete extensions B and
C. Now I need to extend B and C as well, not to add additional persistent
attributes but merely to alter behavior. While I could simply derive B and
C directly (yeilding derived classes B' and C' respectively), a cleaner
implementation from a design perspective is to create a new abstract class
A' that inherits from A and then use that class as the base of the new
concrete classes, let's call them A'B' and A'C'. These classes would then
be implemented in terms of the other concrete classes B and C respective.
Assuming a flat inheritance mapping my question then is, from a
performance perspective, should I prefer alternative #1 (ex. A<-B<-B), or
alternative #2 (ex. A<-A'<-A'B').
It seems that since alternative #2 requires that an explicit object
reference be stored in class A'B', which implies a join even if it is
within the same table, that alternative #1 would be preferred from a
performance standpoint.
Is my rough analysis of the situation correct? If so, what mechnism could
I utilize such that the performance impact of the aggregation is
removed/minimized?
Scott

You've not made clear which one is the interface, but I don't think it does. This does not mean, however, that you should duplicate code.
http://en.wikipedia.org/wiki/Unified_Modeling_Language
these are free and very useful for drawing UML diagrams (better than M$ Paint which is what you seem to have used):
Umbrello http://uml.sourceforge.net/
Dia http://live.gnome.org/Dia and for Windows http://dia-installer.de/index_en.html

Similar Messages

  • Mapping Database using Oracle Toplink 10.1.3.3.0

    Hi everybody, I'd like to use Oracle TopLink to do mapping my database and here is the database's script
    1F.sql
    ==========
    @@case1F.typ
    @@case1F.tab
    @@case1F.con
    1F.typ
    ==========
    CREATE TYPE TCUSTOMER
    CREATE TYPE TMEMORY
    CREATE TYPE TPHONE
    CREATE TYPE TNAME
    CREATE TYPE TMOTHERBOARD
    CREATE TYPE TADDRESS
    PROMPT Creating Object Type 'TNAME'
    CREATE OR REPLACE TYPE TNAME AS OBJECT
    (FIRST VARCHAR2(240)
    ,LAST VARCHAR2(240)
    SHOW ERROR
    PROMPT Creating Object Type 'TMOTHERBOARD'
    CREATE OR REPLACE TYPE TMOTHERBOARD AS OBJECT
    (KODE VARCHAR2(240)
    ,SERIES VARCHAR2(240)
    ,MERK VARCHAR2(240)
    ,VGA VARCHAR2(240)
    SHOW ERROR
    PROMPT Creating Object Type 'TMEMORY'
    CREATE OR REPLACE TYPE TMEMORY AS OBJECT
    (KODE VARCHAR2(240)
    ,MERK VARCHAR2(240)
    ,TIPE VARCHAR2(240)
    ,UKURAN VARCHAR2(240)
    SHOW ERROR
    PROMPT Creating Object Type 'TADDRESS'
    CREATE OR REPLACE TYPE TADDRESS AS OBJECT
    (STREET VARCHAR2(240)
    ,CITY VARCHAR2(240)
    SHOW ERROR
    PROMPT Creating Object Type 'TPHONE'
    CREATE OR REPLACE TYPE TPHONE AS OBJECT
    (CODE VARCHAR2(240)
    ,DIGIT VARCHAR2(240)
    SHOW ERROR
    PROMPT Creating Object Type 'TCUSTOMER'
    CREATE OR REPLACE TYPE TCUSTOMER AS OBJECT
    (USERNAME VARCHAR2(240)
    ,NAME TNAME
    ,ADDRESS TADDRESS
    ,PHONE TPHONE
    ,TYPE NUMERIC(1)
    ,EMAIL VARCHAR2(240)
    SHOW ERROR
    1F.tab
    ==========
    PROMPT Creating Table 'DTRANSAKSI'
    CREATE TABLE DTRANSAKSI
    (CPU_KODBERG VARCHAR2(6) NOT NULL
    ,HTI_NONOTA VARCHAR2(4) NOT NULL
    ,JMLBRG NUMERIC
    PROMPT Creating Table 'CPU'
    CREATE TABLE CPU
    (KODBERG VARCHAR2(6) NOT NULL
    ,NAMA VARCHAR2(240)
    ,MEMORY REF TMEMORY
    ,MOTHERBOARD REF TMOTHERBOARD
    ,HARGA NUMERIC
    ,KET CLOB
    ,VERSI VARCHAR2(240)
    PROMPT Creating Table 'HTRANSAKSI'
    CREATE TABLE HTRANSAKSI
    (NONOTA VARCHAR2(4) NOT NULL
    ,USERNAME REF TCUSTOMER
    ,TGLTRANS DATE
    ,VERSI VARCHAR2(240)
    ,CONSTRAINT HTI_PK PRIMARY KEY
    (NONOTA)
    ORGANIZATION INDEX
    PROMPT Creating Table 'MEMORY'
    CREATE TABLE MEMORY OF TMEMORY
    (KODE NOT NULL
    PROMPT Creating Table 'MOTHERBOARD'
    CREATE TABLE MOTHERBOARD OF TMOTHERBOARD
    (KODE NOT NULL
    PROMPT Creating Table 'CUSTOMER'
    CREATE TABLE CUSTOMER OF TCUSTOMER
    ALTER TABLE CPU
    ADD (SCOPE FOR (MEMORY) IS MEMORY)
    ALTER TABLE CPU
    ADD (SCOPE FOR (MOTHERBOARD) IS MOTHERBOARD)
    ALTER TABLE HTRANSAKSI
    ADD (SCOPE FOR (USERNAME) IS CUSTOMER)
    1F.conn
    ===================
    PROMPT Creating Primary Key on 'DTRANSAKSI'
    ALTER TABLE DTRANSAKSI
    ADD (CONSTRAINT DTI_PK PRIMARY KEY
    (HTI_NONOTA
    ,CPU_KODBERG))
    PROMPT Creating Primary Key on 'CPU'
    ALTER TABLE CPU
    ADD (CONSTRAINT CPU_PK PRIMARY KEY
    (KODBERG))
    PROMPT Creating Foreign Key on 'DTRANSAKSI'
    ALTER TABLE DTRANSAKSI ADD (CONSTRAINT
    DTI_HTI_FK FOREIGN KEY
    (HTI_NONOTA) REFERENCES HTRANSAKSI
    (NONOTA))
    PROMPT Creating Foreign Key on 'DTRANSAKSI'
    ALTER TABLE DTRANSAKSI ADD (CONSTRAINT
    DTI_CPU_FK FOREIGN KEY
    (CPU_KODBERG) REFERENCES CPU
    (KODBERG))
    I found an error in ORACLE TOPLINK while adding table CUSTOMER, MOTHERBOARD and MEMORY from database to workbench. Any idea how to solve that error?
    And other questions:
    1. Does Toplink support inheritance and aggregation object table modelling? If it doesn't, what should I do?
    2. Is there any example or tutorial using Toplink Foundation Library?
    Thanks a lot.

    What error do you get in the MW?
    TopLink does support object-relational data-types, but the Mapping Workbench does not have support for object-relational data-types, so you may need to define your mappings through the TopLink Descriptor and Mapping Java code API. There is a section on object-relational data-type mappings in the TopLink User Guide.
    -- James : http://www.eclipselink.org

  • OR between groups in Row-Restrictions, priority - Universe Design

    Old School Univers Design, no SAP source, but plain Oracle
    Two Questions here
    1 - Priority in rowrestrictions
    from documentation:
    u201CYou can specify which restriction to apply to a user that belongs to multiple groups using a universe. For example a user belongs to two groups, Sales with a restriction to view 5000 rows of data, and Marketing to view 10000 rows. When the user refreshes a report, the restriction associated with the lowest level group is applied. In the example above, if the Sales group had order 1 and Marketing had order 2, the restriction from marketing (10000) would be used.u201D
    I read in the documentation for Rowrestrictions, that the restriction on top of the order list will be the one kicking in, in case of a huser having two conflicting restrictions.
    Does anyone have experience with this ?
    Does it work ?
    My experience is that its not working.  Both rowrestrictions gets into the SQL with AND between as shown
      AND  ( FLEX_SEGMENT5.FLEX_VALUE IN (030,033,090,805,041,062,048)
      AND  FLEX_SEGMENT5.FLEX_VALUE IN (041,048,062)
    the first line is my new restriction with priority 1,
    the second line is the other restriction with priority 6
    2 - OR between groups
    there is a Restriction option in Manage Rowrestrictions , where you can spesify Rowrestriction Combinations using AND or OR.
    I have not been able to have this working.
    Anyone having a positive experience here ? Or have I misunderstood what this actually means.
    I would expect 
      WHERE  ( FLEX_SEGMENT5.FLEX_VALUE IN (030,033,090,805,041,062,048)
      OR FLEX_SEGMENT5.FLEX_VALUE IN (041,048,062)
    What I get is
    ( FLEX_SEGMENT5.FLEX_VALUE IN (030,033,090,805,041,062,048)
      AND  FLEX_SEGMENT5.FLEX_VALUE IN (041,048,062)
    Is this a known bug ?
    I have tried this in WEBI 3.1 and R2

    Hello,
    In fact, Priority is used for universe overload where only one overload among several might apply. This is the case for connection overloads, table mappings..., but not for row restrictions.
    For row restrictions, you have AND/OR aggregation operators. In Universe design tool, you have the option to choose how Row restriction will aggregate (click the "cog" icon):
    + Combine row restrictions using AND
    + Combine row restrictions using AND within group hierarchies and OR between groups
    In the first case, all row restrictions that might apply to a user will be aggregated with AND operators.
    In the second case, row restrictions that are inherited are aggregated with AND operators and the ones coming the user groups a user belongs to are aggregated with OR operators.
    Ex with the following user groups organisation:
    G1
      G11 (G11 belongs to G1 group)
    G2
      G21 (G21 belongs to G2 group)
    and user U belongs to G11 and G21 user groups.
    Final row restriction that applies to the user U is:
    (G1 AND G11) OR (G2 AND G21)
    Hope it helps.
    Cheers
    ~~cas

  • JWAX UI Framework for AJAX (Swing Like)

    Wanted to pass this along to Swing Developers.
    http://www.ajaximpact.com/detail_news.php?id=113
    JWAX is a event driven component framework modeled after Swing, SWT and other component based systems for AJAX development. It can be leveraged from client side AJAX or dynamic UI systems for development. JWAX has Object Oriented Architecture.
    It utilizes a render kit model for client code generation and provides a set of common base UI components with plans to support complex components in the future.
    JWAX Features
    - Object Oriented Architecture
    - Event Delegation Model
    - Component Inheritance and Aggregation Support
    - Cross Browser Compatibility w/ RenderKits
    - Aspect Oriented Rendering of Components
    JWAX architecture
    JWAX architecture is a component framework much like Swing, SWT, etc. It leverages an event delegation model to trigger and listen for component events. The underlying component model is rendered based on the client output type. So it's easy to customize the component view to a browser, technology or look and feel based on the renderkit chosen.

    Wanted to pass this along to Swing Developers.
    http://www.ajaximpact.com/detail_news.php?id=113
    JWAX is a event driven component framework modeled after Swing, SWT and other component based systems for AJAX development. It can be leveraged from client side AJAX or dynamic UI systems for development. JWAX has Object Oriented Architecture.
    It utilizes a render kit model for client code generation and provides a set of common base UI components with plans to support complex components in the future.
    JWAX Features
    - Object Oriented Architecture
    - Event Delegation Model
    - Component Inheritance and Aggregation Support
    - Cross Browser Compatibility w/ RenderKits
    - Aspect Oriented Rendering of Components
    JWAX architecture
    JWAX architecture is a component framework much like Swing, SWT, etc. It leverages an event delegation model to trigger and listen for component events. The underlying component model is rendered based on the client output type. So it's easy to customize the component view to a browser, technology or look and feel based on the renderkit chosen.

  • Exact difference betwteen aggregation and Inheritance with example

    hi everybody
    Just I got some doubt regarding the difference betwteen aggregation and Inheritance and where we can differntiate the use of each other. I am little bit confused with the two usages when refering to objects.
    Thank you

    ramsy wrote:
    hi everybody
    Just I got some doubt regarding the difference betwteen aggregation and Inheritance and where we can differntiate the use of each other. I am little bit confused with the two usages when refering to objects.
    Thank youIt's the difference between the "is-a" and "has-a" relationship. A Car is-a Vehicle. A Car has-a Engine.

  • When to use inheritance and when not to?

    I've just been trying find out when to use inheritance and when not to use inheritance? I know that inheritance gives advantages such as code reuse and maintainability. But when are their times not to use inheritance that may effect the design of a project?
    Also when should one consider aggregation over inheritance(is-a relationship)?
    thanks,
    plandis

    Hi
    Answering this question usually requires a few books, so, I'm sorry, it's not really as simple as choosing between using a screwdriver vs. a hammer.
    But, very short, inheritance should ideally only be used when there exist a strict 'is-a' relationship. However, sometimes it may be clever to inherit when you have a 'is-almost-a' relationship... And sometimes this is a stupid move. This depends on the context/circumstances.
    Aggregation is normally considered a 'has-a' relationship, thereby differing clearly from inheritance. The old 'car' model says "a car is-a vehicle and has-some (at least) wheels."
    The wheels are aggregated to the car class, that itself is inherited from vehicle.
    However, this is just a good rule-of-thumb and there may be circumstantial reasons for not following these guidelines.

  • Logical Column Aggregation

    I have CurrentDollars and CurrentUnits in my measures table, and I"ve created PriorDollars and PriorUnits logical columns utilizing the AGO function. Since 'Use existing logical columns as the source' is checked, I don't have access to the Aggregation tab, and everything I've read leads me to believe that this is OBIEE's way of forcing inheritance of the aggregation rule of the 'source' column.
    Problem is, the Prior* columns don't aggregate (sum). If I create a report with Year, CurrentDollars, CurrentUnits, I get three rows... one row for each year that has data. That's what I want. But when I add either of the Prior columns, I get 52 rows per year (since my data is at the week level). If I wrap either of the Prior columns in SUM, it sums all Prior* column values. If I check the box that says I want it to use Sum aggregation, nothing changes. I get similar bogus results if I add a SUM function around the original AGO function.
    This is a real drag. Am I missing something obvious? Some blogs lead me to think that this is a known bug. Does anyone have a workaround?
    Edited by: Tom G. on Aug 26, 2009 11:30 AM

    Hi,
    What is the source for AGO measures PriorDollars and PriorUnits?
    AGO(CurrentUnits, '?',?)
    AGO(CurrentDollars, '?',?)
    Have you set up hierarchy correctly (because you said that the granularity in your fact table is at week grain) and it should be like this:
    Fiscal Year > Fiscal Quarter > Fiscal Month > Fiscal Week
    It depends on how did you define your TIME dimension.
    Try maybe like this:
    PriorYEARDollars = AGO(CurrentUnits, 'YEAR',1)
    and the same for
    PriorYEARUnits =AGO(CurrentDollars, 'YEAR',1)
    Now, if you put in the report
    YEAR
    CurrentUnits
    CurrentDollars
    PriorYEARUnits
    PriorYEARDollars
    you'll get only three rows (for 3 years) with PRIOR YEAR measures.
    Try it.
    A good reference for understanding AGO:
    http://obiee101.blogspot.com/2008/11/obiee-ago-and-todate-series.html
    Also you need to set chronological key correctly for TIME dimension.
    Regards
    Goran
    http://108obiee.blogspot.com

  • Inheritance in EJBs

    I am trying to find out if Weblogic supports functionality that TOPLink provides to
    represent inheritance.
    (http://www.webgain.com/products/toplink/mapping_workbench/demos/
    check the "Using Advanced Descriptor Functions", "Inheritance").
    I want to have a parent class which has multiple children (i.e. an Account class,
    subclasses as Checking, Savings, Loan, etc.). These would all be stored in one database
    table. A single 'findAccountsForCustomer' method could return a mixed collection
    of the specific child objects.
    Is this something available in a current version of Weblogic, or something planned
    for the future? Or, is this something that requires a 3rd party mapping tool?

    How does this differ from the second option I listed?
    Thanks,
    Bob
    "Nick Minutello" <[email protected]> wrote
    in message news:[email protected]...
    >
    >
    You can achieve inheritance using Entity Beans. Its not the simplest ofthings -
    but its do-able. (Although I will admit I havent done this for aproduction application).
    >
    You would create an AccountBean - which is the base-class implementation.Your other
    Checking, Savings, Loan Beans inherit from it. (Strictly they dont haveto - this
    is only so you have implementation inheritance.)
    Then, you would also create an AccountLocal - which is the base-classcomponent interface.
    Your other CheckingLocal, SavingsLocal, LoanLocal Interfaces inherit fromit. (this
    is so you get polymorphism at the client level)
    Your PK classes must be the same all. (though, I forget why at the moment)
    You need to create a home for each Bean (this makes sense - you have tohave a factory
    that knows what its creating/finding).
    You need to list all of them in the DDs. (the CMP mapping duplication is apain)
    >
    Its all a bit dicky doing it by hand. But if you can get your hands onWSAD4, it
    will automate this all for you (Sadly, it only supports EJB1.1.... but youcan see
    how it does it)
    The thing to remember is that if they are in the same table (I wouldreconsider that
    decision) then your findByPrimaryKey method will never be able todistinguish between
    them.
    The finders are a bit tricky - you need to do the aggregation of thesub-types.
    >
    -Nick
    "Bob Lee" <[email protected]> wrote:
    EJB does not support inheritance. You are limited to standard Java's
    inheritance capabilities.
    If you want to use entity beans, you have the following two options:
    1) Have a generic Account entity bean with an account type field (rather
    than subclassing).
    2) Use Java inheritance, set up an entity bean for each type (Savings,
    Checking, etc.) and use a session facade. The findAccountsForCustomer()
    method in the session facade will hit each entity bean type and combine
    the
    results.
    I would probably go with the first option. You can use the Strategy
    pattern
    or something comparable to handle the implementation differences between
    the
    Account types.
    Bob
    "Howard Webb" <[email protected]> wrote in message
    news:[email protected]...
    I am trying to find out if Weblogic supports functionality that TOPLinkprovides to
    represent inheritance.
    (http://www.webgain.com/products/toplink/mapping_workbench/demos/
    check the "Using Advanced Descriptor Functions", "Inheritance").
    I want to have a parent class which has multiple children (i.e. an
    Account
    class,
    subclasses as Checking, Savings, Loan, etc.). These would all be
    stored
    in one database
    table. A single 'findAccountsForCustomer' method could return a mixedcollection
    of the specific child objects.
    Is this something available in a current version of Weblogic, or
    something
    planned
    for the future? Or, is this something that requires a 3rd party
    mapping
    tool?
    >

  • Replacement for multiple inheritance in MovieClip class

    Hello
    I need your opinion about a problem.
    Commonly, when you need to replace multiple inheritance, you do it by making an aggregation with one of the class involved.
    But in case of MovieClip attached class, there is one more class involved in the process : the MovieClip class, and this class can't be the one aggregated because every class attached to a MovieClip need to inherits from it.
    The problem is if the other class can't be also aggregated because it has some abstract class behaviour, for instance, call of a virtual function.
    A solution could be making the abstract class inherit from the MovieClip class, but what if you want to reuse its behaviour in a class which have nothing to do with MovieClip ?

    This is Not Supported in WebLogic that the Remote Interface extends other Interfaces. Because Annotation Processor just looks up inside the implemented interface methods. The actual interface which is Implemented by the Bean Class. So the Methods declared inside the Interface B and Interface C will be ignored and will not be available as part of the generated Stubs. Thats why u are getting NoSuchMethodError.
    You can even contact Oracle Support on this...there are 3-4 Cases on it. And the Solution is Work As Designed.
    Workaround is : edit your interface A as following
    Declare all the Business Methods only in the Remote Interface and not inside it's Super Interfaces.
    Example:
    @Stateless(name="A")
    @Remote({A.class})
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class AImpl implements A {
    @Override
    public void writeA() {
    System.out.println("A");
    @Override
    public void writeB() {
    System.out.println("B");
    @Override
    public void writeC() {
    System.out.println("C");
    @Remote
    @JNDIName(A.JNDI_NAME)
    public interface A extends B, C {
    public static String JNDI_NAME = "A_JNDI_NAME";
    void writeA();
    void writeB();
    void writeC();
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com (WebLogic Wonders Are Here)

  • Creating an Aggregation Layer

    I am trying to create an aggregation layer which is to built off a multi provider which has a real time info cube.  When I try and create the aggregation layer I get the message:
    Aggregation Level <level name>: Infoprovider <Info provider name> cannot be used for definition
    Why am I getting this message and how can I resolve it? Thanks

    At least one key figure and one characteristic have to be included in the aggregation level.
    ●     The key figures used have to have the database aggregations SUM, MIN or MAX. With MIN or MAX, key figure values can only be displayed. They cannot be changed using manual planning or planning functions.
    ●     For key figures of type date or time, only the data type u2018DECu2019 is supported.
    ●     Referencing key figures (and thus also non-cumulative key figures or elimination of internal business volume) are not supported in aggregation layers.
    ●     If a characteristic is compounded and used in an aggregation level, the aggregation level must also contain all compounding "parent" characteristics.
    ●     If a key figure is used in an aggregation level and does not have a fixed unit of measure or currency, the aggregation level must contain the associated characteristic for the unit.
    ●     If a key figure with exception aggregation is used in an aggregation level, the aggregation level must also contain the characteristic for exception aggregation if it occurs in the underlying InfoProvider
    ●     The aggregation level inherits a navigation attribute from the underlying InfoProvider if it includes the basic characteristic of the navigation attribute. Note that the navigation attribute for an aggregation level is not visible in the Planning Modeler. It is only visible in the Query Designer.
    ●     An aggregation level cannot be created on MultiProviders if a characteristic of an InfoProvider contained in the MultiProvider supplies two different characteristics in the MultiProvider.
    ●     If a characteristic on the InfoProvider that serves as the basis for an aggregation level is constant, this characteristic has to be included in the aggregation level.
    Hope this helps.

  • Dynamic inheritance: wouldn't it be useful sometimes?

    Hey, you ever have this problem?
    You are holding a reference to an object of some class that was given to you by an external source. However you'd like to override one of the methods to do something else, and then perhaps call the original method. Wouldn't it be nice if you could somehow dynamically inherit from an already existing object.
    An example might be, you get a ldap DirContext object from somewhere, It's possible under some circumstance you don't want to close it. What you'd like to do is override close, and possibly call the original objects close depending on some setting.
    I realize the answer is 'use aggregation', not inheritance, but that can be a royal pain if the base object has alot of methods.
    Hmm, maybe that's what java.lang.reflect.proxy is all about....
    anyone?

    Ok, first i agree with what you are saying (all), i'm just not happy about it. Here's an example.
    I've got a class that provides an LDap DirContext, through a "get" type method. Sometimes I'd like this class to maintain a persistent connection to the ldap server (through this DirContext) other times I wan't the connection to be recreated each time. Either way, the user uses the same interface to get this objects so:
    interface LDAPProvider
    DirContext getDirectoryContext();
    When it's in persistent mode, it just returns a member variable, when not it creates a new one.
    Well, I certainly don't want the user calling close on this returned object, as it may be that i'm maintaining a persistent connection. I also do want them to call close in the case that it is not a persistent connection.
    So, i do
    interface MyLDAPProvider
    DirContext getDirectoryContext();
    void releaseDirectoryContext( DirContext ctx );
    and hope the user calls my method and not close... Which is just plain ugly and dangerous.
    Alternately i create a DirContext implementing object (luckily i can cause this is an interface, what to do if this is a class that's final) and use aggregation, and implement all the DirContext methods, yuck, just to get the one close behavior. Also oogley
    I really just want to do, (get out the mallots)
    ctx.extendInterface( new DirContext()
    private MyLDAPProvider lp = getTheAboveProviderSomeHow();
    public void close()
    if (!lp.isPersistent())
    super.close();
    }

  • Notes on Object Aggregation.

    It seems that the object aggregation mechanism vis-a-vis the Decorator pattern has some issues. Method propogation works only for those methods which are defined in an implemented interface. Specialized behavior of the "inner" classes is inaccessible. Let me illustrate.
    I want to create an aggregate object out of the java.io.PushbackReader and the java.io.LineNumberReader classes. Each of these have specialized behavior, unavailable in the other. PushbackReader has unread() while LineNumberReader has getLineNumber(), et al. If I aggregate LineNumberReader inside PushbackReader, I lose access to the getLineNumber() method. Conversely, if I aggregate PushbackReader inside LineNumberReader, I lose access to the unread() method.
    Clearly my goal is to have the best of both worlds but, it seems I can only have one or the other.

    So, I'm wondering if there have been any attempts to address this issue. I'm considering checking out the OpenJDK and writing in a small language extension which would attempt to fix this problem. Consider the following:
    interface Common {
      public void doCommon();
    class Base implements Common {
      public Base() { ... }
      public void doCommon() { System.out.writeln("Base"); }
    class A extends Common {
      private inherited Common common;
      public A(Common c) { this.common = c; ... }
      public void doCommon() { this.common.doCommon(); System.out.writeln("A"); }
      public void doA() { System.out.writeln("A"); }
    class B extends Common {
      private inherited Common common;
      public B(Common c) { this.common = c; ... }
      public void doCommon() { this.common.doCommon(); System.out.writeln("B"); }
      public void doB() { System.out.writeln("B"); }
    public class Aggregate {
      Common b;
      public static void main(String[] args) {
        b = new B(new A(new Base()));
        b.doCommon();  // result: "BaseAB"
        b.doA(); // result: "A"
    } Here I have a class extending an interface and a new keyword, inherited. Since I haven't done any work on the javac compiler, I am assuming that using extends in the context of a class definition extending an interface would signal to the compiler that all class extending that interface may be aggregated. The keyword inherited then, does the work of aggregation by only allowing variables of the type of the extended interface to be inherited. This nicely solves the problem of aggregation without exposing class hierarchy to multiple inheritance or bloating.

  • Hiding inherited methods

    hi,
    I need to know how to hide a method from a subclass because it doesn't need it at all. I think using aggregation will solve the problem but how? do you have any examples regarding this please?
    For example, if the class Dog defines the properties "bark," "fetch," and "eat food" then a class Cat can be derived from Dog by hiding "bark" and "fetch" and adding "purr" and "sleep." And then "bark" shouldn't appear in the Cat class, is using aggregation solve the problem? by putting the class Cat as "whole" and class Dog as its "part".

    Poor design, poor use of inheritance. Cats aren't dogs, simple as that. This relationship is meaningless. Cat and Dog could be subclasses of Animal, which could have a method 'makeNoise' that both Cat and Dog could implement with their own noise. But a cat isn't a special kind of dog, so inheritance makes no sense here. Further, if you think something should be a subclass, but you have to find some way of getting rid of some methods from the superclass, chances are it isn't a subclass at all

  • Aggregator TOC

    In Captivate 6, can the table of contents in an Aggregator project be collapsed and expanded?

    As Aditya hints, pretty much every Aggregator setting is inherited from the settings of the first published SWF you add to the Aggregator project. If a given setting is not effected by the first imported SWF or is not directly settable in the Aggregator interface, then it's simply not supported (i.e. SCORM settings, not supported at all).

  • IR: aggregation result in report footer

    Hello!
    This quote from "Beginning Oracle Application Express 4.2" at page 174 (about aggregation in IR):
    "The results are displayed at the end of the report."
    There is a simple method to print the results of aggregation to the report footer on each page?

    I asked - and I answered
    For making this I create on-Demand process for calculation results of aggregation (using APEX_IR_PKG) and make ajax request to him in "After Refresh" event of IR.
    There is the detailed manual with sample http://devsonia.ru/2013/11/14/oracle-apex-aggregation-in-interactive-report-on-each-page-en/.

Maybe you are looking for