Interfaces vs classes (performance question)

I have three classes A, B and X.
Both A and B use X but they use different methods so I defined two interfaces for X: XA and XB.
This works fine but is not really necessary - so my question is does this affect performance in any way or is it just a compile time thing?
Thank you

TomsterG wrote:
dcminter wrote:
That's rarely a good design criterion - although if a class is difficult to work with, it indicates that there's probably something wrong with it.yes yes i know, all good points.
I really only wanted to know about the performance issues though :)I think you might want to find another site. I can tell that so far you are really not going to like it here.
You have a design that is broken. I suspected it in reply 1. Other said the same thing and when you said more about your problem it was confirmed. And now your response is "I really only wanted to know about the performance issues"?
Seriously. You are not going to like the replies you get on this site. We don't give a flying whatsit about performance issues when it comes at the cost of having a horrible design with classes with 100 methods. Because nobody here wants to maintain applications built on that abortion of a design so we all do our best to discourage that sort of thinking.
But your replies really suggest that you don't get it, you don't care and you think you are superior in your needs and ideas to anyone who might be interested in responding to your posts.
It's a waste of your time.

Similar Messages

  • Interface Conversion - Java Certification Question

    Hello,
    I am preparing for the Java Programmer Certification.
    On page 115 of the Complete Java 2 Certification Study Guide (Simon Roberts, et al.) 2nd Edition. The author talks about object reference conversion.
    OldType x = new OldType();
    NewType y = x;
    Where OldType could be a class, interface or array.
    Question 1:
    I am not clear on how OldType can be an interface. Per my understanding, you cannot create an instance of an interface.
    Question 2:
    The author goes on further to explain "Converting Rules". i.e for the couple of lines above to be correct, if OldType is an interface, then NewType must be Object. Why?
    Thanks for your time.

    OldType x = new OldType();
    NewType y = x;
    Where OldType could be a class, interface or array.
    Question 1:
    I am not clear on how OldType can be an interface. Per
    my understanding, you cannot create an instance of an
    interface.
    Question 2:
    The author goes on further to explain "Converting
    Rules". i.e for the couple of lines above to be
    correct, if OldType is an interface, then NewType must
    be Object. Why?
    Thanks for your time. OldType cannot be an interface unless the code was
    OldType x = new OldType() {* impl here */};
    OldType could be an interface if
    OldType x = new OldTypeImpl();
    NewType can be an interface
    Either get a better book, or transcribe the author better :)

  • Deleting interfaces from class

    hi to all
    I am trying to delete interfaces from class . But it showing that "You cannot perform this action in modification/enhancement mode". where is the problem.
    thank you

    Hi,
           This error comes up when the object you are trying to edit has original system as something else. This is a protection given by the modification assistant, so that the changes to the objects are recorded. If you know what you are doing(modifying objects in non-original system), go to edit menu and select modifications and select "switch off modification assistant".
    Regards,
    Arun Prakash

  • Simple performance question

    Simple performance question. the simplest way possible, assume
    I have a int[][][][][] matrix, and a boolean add. The array is several dimensions long.
    When add is true, I must add a constant value to each element in the array.
    When add is false, I must subtract a constant value to each element in the array.
    Assume this is very hot code, i.e. it is called very often. How expensive is the condition checking? I present the two scenarios.
    private void process(){
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             if (add)
             matrix[i][ii][iii][...]  += constant;
             else
             matrix[i][ii][iii][...]  -= constant;
    private void process(){
      if (add)
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
             matrix[i][ii][iii][...]  += constant;
    else
    for (int i=0;i<dimension1;i++)
    for (int ii=0;ii<dimension1;ii++)
      for (int iii=0;iii<dimension1;iii++)
        for (int iiii=0;iiii<dimension1;iiii++)
           matrix[i][ii][iii][...]  -= constant;
    }Is the second scenario worth a significant performance boost? Without understanding how the compilers generates executable code, it seems that in the first case, n^d conditions are checked, whereas in the second, only 1. It is however, less elegant, but I am willing to do it for a significant improvement.

    erjoalgo wrote:
    I guess my real question is, will the compiler optimize the condition check out when it realizes the boolean value will not change through these iterations, and if it does not, is it worth doing that micro optimization?Almost certainly not; the main reason being that
    matrix[i][ii][iii][...]  +/-= constantis liable to take many times longer than the condition check, and you can't avoid it. That said, Mel's suggestion is probably the best.
    but I will follow amickr advice and not worry about it.Good idea. Saves you getting flamed with all the quotes about premature optimization.
    Winston

  • Use of events and interface in class

    Dear All,
    Could you please explain why we use events and interface in class.
    Also please tell me the use of TRY and ENDTRY.
    Regards,
    Amar

    Events may be a way of communication b/w classes. Imagine you want to call certain code from one class, you would need for that public method, but you don't want to expose it to external user. So you may use events for that. Also events are used to notify that certain state of class has changed (tiggering event). Then all handlers of this event executes and react accordingly.
    Interfaces are a way of provide a service to class which implements it. Imagine that you have class office and hotel and gas station . They don't seems to have something in common. However, there can be some external energy provider which will be an interface. Each class which want to have a lease with this energy provided can implement it (the implementation can differ in some way), so he can provided energy to different classes. This way you will achieve polimorphism (meaning you call one interface method, but code behind it differs from class to class).
    Interfaces are also means of multiple inheritance. One class can implement several service (interfaces). In contrary it can oly inherit from one class.
    Try endtry are just new way of handling exceptions .
    Try to search a litte bit you will find lots of info on the above.
    Regards
    Marcin

  • BPM performance question

    Guys,
    I do understand that ccPBM is very resource hungry but what I was wondering is this:
    Once you use BPM, does an extra step decreases the performance significantly? Or does it just need slightly more resources?
    More specifically we have quite complex mapping in 2 BPM steps. Combining them would make the mapping less clear but would it worth doing so from the performance point of view?
    Your opinion is appreciated.
    Thanks a lot,
    Viktor Varga

    Hi,
    In SXMB_ADM you can set the time out higher for the sync processing.
    Go to Integration Processing in SXMB_ADM and add parameter SA_COMM CHECK_FOR_ASYNC_RESPONSE_TIMEOUT to 120 (seconds). You can also increase the number of parallel processes if you have more waiting now. SA_COMM CHECK_FOR_MAX_SYNC_CALLS from 20 to XX. All depends on your hardware but this helped me from the standard 60 seconds to go to may be 70 in some cases.
    Make sure that your calling system does not have a timeout below that you set in XI otherwise yours will go on and finish and your partner may end up sending it twice
    when you go for BPM the whole workflow
    has to come into action so for example
    when your mapping last < 1 sec without bpm
    if you do it in a BPM the transformation step
    can last 2 seconds + one second mapping...
    (that's just an example)
    so the workflow gives you many design possibilities
    (brigde, error handling) but it can
    slow down the process and if you have
    thousands of messages the preformance
    can be much worse than having the same without BPM
    see below links
    http://help.sap.com/bp_bpmv130/Documentation/Operation/TuningGuide.pdf
    http://help.sap.com/saphelp_nw04/helpdata/en/43/d92e428819da2ce10000000a1550b0/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/3.0/sap%20exchange%20infrastructure%20tuning%20guide%20xi%203.0.pdf
    BPM Performance tuning
    BPM Performance issue
    BPM performance question
    BPM performance- data aggregation persistance
    Regards
    Chilla..

  • About interface and class[Please read this]

    I writing what I found out:
    myinterface.java
    interface myinterface
    class A
    A()
    {System.out.println("A()
    of interface");}
    A.java
    class A implements
    myinterface
    A(){System.out.println("A()
    of A.java");}
    public static void main
    (String args[])
    A a=new A();
    //this calls A() of interface
    //myinterface.java
    //how come the output of
    // this code is like this

    how come this is possible?Well, it had to pick one or the other, since they
    have the same symbol name. Why are you choosing to
    make up goofy names that collide in the first place?
    If you want to explicitly use one or the other, you
    need to also choose a package name, and fully-qualify
    the class name that you are trying to instantiate.For example:
    package test;
    interface MyInterface // renamed to follow standard naming convention
      class A
        A() { System.out.println("A() of interface"); }
    class A implements MyInterface
      A() {System.out.println("A() of A.java"); }
      public static void main(String args[])
        test.A a = new test.A(); // prints A() of A.java
        MyInterface.A a1 = new MyInterface.A(); // prints the other one
    }

  • Interface or Class based on the Factory

    Hi,
    I want to write a Factory pattern to decide whether the passed parameter is an interface or class ?
    If an interface is passed then validate whether it is an interface using reflection and do the respective operation similarly for the class as well.
    Please provide your opinion on this.
    Thanks.

    Thanks.
    In the main class I am calling the below :-
    mockInterface("com.test.InterfaceTest");
    protected <T> T mockInterface(String className){
    <T> T interfaceObject = null;
    try {
    Class clazz = Class.forName(className);
    if (clazz.isInterface()) {
    interfaceObject = EasyMock.createMock(className.getClass());
    } catch (ClassNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    return interfaceObject;
    Here when I use EasyMock.createMock(className.getClass()) I am getting the below error :-
    "Type mismatch Error saying cannot convert capture#2 of ? extends String to T"
    Here createMock takes class as a parameter as shown below:-
    public static <T> T createMock(Class<T> toMock)
    /* 46 */ return createControl().createMock(toMock);
    What I am doing wrong here? Please clarify.

  • Use Interface of Class object

    Hi Experts,
    I want to use Interface of Class object. But I'dont know how I use it (declaration,call,create etc.)
    There are a lot of exam about using local interface. But I need from Global object.
    Class : CL_TPDA_DIFF_STRUC
    Interface: IF_TPDA_DIFF_SERVICE
    Best regards.

    Firstly ; Your advice book tells the "General OO".
    But I need "Only ABAP OO". The basic logic is the same. But syntax are different.
    If there is a book about ABAP OO and syntax You can advice to me.
    Secondly;
    My code is below.
    I created my interface success . But It give error at runtime. Error mesaage : 'Error during interprocess communication; Debugger will be closed . Message Number TPDA151'
    DATA l_ref_diff TYPE REF TO CL_TPDA_DIFF_STRUC.
    data : xyz  TYPE REF TO IF_TPDA_DIFF_SERVICE.
    data : p_var1 type TPDA_VAR_NAME,
              p_var2 type TPDA_VAR_NAME,
              lv_x type TPDA_DIFF_ATTR.
    data : l_it_value_diff TYPE TPDA_DIFF_VALUE_DIFF_IT,
              l_it_main_diff TYPE tpda_diff_main_diffs_it.
    p_var1 = 'CLIENTDATA1'.
    p_var2 = 'CLIENTDATA2'.
    lv_x-maxhits = 100.
    CREATE OBJECT l_ref_diff.
    xyz ?= l_ref_diff.
    xyz->init( ).
    xyz->DIFF( EXPORTING p_var1 = p_var1
                         p_var2 = p_var2
                         p_diff_attr = lv_x
               CHANGING p_it_value_diff_it = l_it_value_diff
                        p_it_main_diff_it  = l_it_main_diff ).
    Best Regards.

  • Swing performance question: CPU-bound

    Hi,
    I've posted a Swing performance question to the java.net performance forum. Since it is a Swing performance question, I thought readers of this forum might also be interested.
    Swing CPU-bound in sun.awt.windows.WToolkit.eventLoop
    http://forums.java.net/jive/thread.jspa?threadID=1636&tstart=0
    Thanks,
    Curt

    You obviously don't understand the results, and the first reply to your posting on java.net clearly explains what you missed.
    The event queue is using Thread.wait to sleep until it gets some more events to dispatch. You have incorrectly diagnosed the sleep waiting as your performance bottleneck.

  • Ordered & unordered arraylist with interface & abstract class

    you can remove this
    Edited by: Taco_John on Mar 9, 2008 7:38 PM

    http://www.google.com/search?q=java+interface+%22abstract+class%22
    http://www.google.com/search?q=java+method+overloading+overriding

  • Xcontrol: performance question (again)

    Hello,
    I've got a little performance question regarding xcontrols. I observed rather high cpu-load when using xcontrols. To investigate it further, I built a minimal xcontrol (boolean type) which only writes the received boolean-value to a display-element in it's facade (see attached example). When I use this xcontrol in a test-vi and write to it with a rate of 1000 booleans / second, I get a cpu-load of about 10%. When I write directly to a boolean display element instead of the xcontrol,I have a load of 0 to 1 %. The funny thing is, when I emulate the xcontrol functionality with a subvi, a subpanel and a queue (see example), I only have 0 to 1% cpu-load, too.
    Is there a way to reduce the cpu-load when using xcontrols? 
    If there isn't and if this is not a problem with my installation but a known issue, I think this would be a potential point for NI to fix in a future update of LV.
    Regards,
    soranito
    Message Edited by soranito on 04-04-2010 08:16 PM
    Message Edited by soranito on 04-04-2010 08:18 PM
    Attachments:
    XControl_performance_test.zip ‏60 KB

    soranito wrote:
    Hello,
    I've got a little performance question regarding xcontrols. I observed rather high cpu-load when using xcontrols. To investigate it further, I built a minimal xcontrol (boolean type) which only writes the received boolean-value to a display-element in it's facade (see attached example). When I use this xcontrol in a test-vi and write to it with a rate of 1000 booleans / second, I get a cpu-load of about 10%. When I write directly to a boolean display element instead of the xcontrol,I have a load of 0 to 1 %. The funny thing is, when I emulate the xcontrol functionality with a subvi, a subpanel and a queue (see example), I only have 0 to 1% cpu-load, too.
    Okay, I think I understand question  now.  You want to know why an equivalent xcontrol boolean consumes 10x more CPU resource than the LV base package boolean?
    Okay, try opening the project I replied yesterday.  I don't have access to LV at my desk so let's try this. Open up your xcontrol facade.vi.  Notice how I separated up your data event into two events?  Go the data change vi event, when looping back the action, set the isDataChanged (part of the data change cluster) to FALSE.  While the data input (the one displayed on your facade.vi front panel), set that isDataChanged to TRUE.  This is will limit the number of times facade will be looping.  It will not drop your CPU down from 10% to 0% but it should drop a little, just enough to give you a short term solution.  If that doesn't work, just play around with the loopback statement.  I can't remember the exact method.
    Yeah, I agree xcontrol shouldn't be overconsuming system resource.  I think xcontrol is still in its primitive form and I'm not sure if NI is planning on investing more times to bug fix or even enhance it.  Imo, I don't think xcontrol is quite ready for primetime yet.   Just too many issues that need improvement.
    Message Edited by lavalava on 04-06-2010 03:34 PM

  • Interface & abstract class

    1>whats the basic difference between an interface and an abstract class?
    when should one be using an interface or an abstract class?
    2>whats the difference between method overriding and method overlaoding?
    does both of them has any relation with the instance of te class implementing them?

    http://www.google.com/search?q=java+interface+%22abstract+class%22
    http://www.google.com/search?q=java+method+overloading+overriding

  • [svn] 4081: Remove @private from an interface and class

    Revision: 4081
    Author: [email protected]
    Date: 2008-11-12 06:50:02 -0800 (Wed, 12 Nov 2008)
    Log Message:
    Remove @private from an interface and class
    QE Notes: None
    Doc Notes: None
    Bugs:
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/listClasses/ListBaseContentH older.as
    flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/messages/ISmallMessage.as

    System.arraycopy()
    You're almost certainly better off with a List implementation, though. Whether you use LinkedList or ArrayList should depend on your usage specifics, but from the limited information provided it seems that LinkedList would be a better choice.

  • Logic 8/Leop - Performance question in the interface...SLOW???

    Dears,
    just installed Logic Studio.
    I'm running it on the latest G5 Imac, Leopard, 2.5 GB of RAM.
    To note, i installed some of the audio content (actually the ~22GB pack that you can choose where to install) on a fast external HD, connected via FireWire (FW 400 on the old imacs ).
    Audio card is M-Audio Firewire 410.
    Quite simply, in the 20 minutes i could play with it, i noticed the overall interface is really slow.
    For example, i click on the right side on "explore", half-a-second-delay than the tab is highlighted. All like this...it's like when you have the CPU overloaded with something in Windows and every single click get response with a bit of delay.
    Also, when exploring "all" apple loops, i really have to wait some 5-10 secs minimum of "thinking" (this maybe is normal, as they're 1,000s and stored externally). When choosing a sample/instrument and loading it, on the contrary, everything goes fast.
    But it's the overall feeling of browsing, clicking, selecting instruments, choosing effects....wherever i click, there is some sort of delay.
    Obviously on the system i shut down every single other application when i run Logic.
    Audio wise, i only had the chance to gig a bit with a piano, and all was fine (no lag, loads of voices, all regular).
    1- Anyone has noticed the same? Suggestions?
    2- Plus, would you think it's better to keep ALL of the audio samples from Logic in the internal HD, and maybe use the external one for other libraries (i also have Colossus, which streams from HD)?
    3- I final note...i had installed a plethora of demos, VSTs, old AUs, etc. that i want to get rid of. I want to start with a clean setup of Logic (with all of his instruments/effects), and then start adding only the real few that i need. If i cancel the AU placed in library/audio/etc. will i also take out logic instrments/effects, or are they stored in a different place?
    Thanks for your patience and help
    Ciao,
    Vanni

    Hit up a studio earlier this week running L8 and Leopard, just did the Leopard install the day it came out. Guy running the studio definitely noticed a difference; after placing a call to a couple 3-party manufacturers of interfaces and two other computer-recording-expert colleagues (invaluable resources, lemme tell ya), it turns out that there's a lot of little things about the OS update that are contributing to not-so-super performance using Leopard. I've decided to wait at least one, maybe two major updates to 10.5 before I upgrade.
    In the meantime, try verifying and repairing your disk permissions. And actually, there's a little freeware tool out there called Maintenance 3.7 that might help you, it's essentially an Automator Action/Applescript tool that automatically runs a whole bunch of little tasks that help keep the Mac system running smooth and error-free. Check it out here: http://www.apple.com/downloads/macosx/automator/maintenance.html. I don't know if it has any conflicts with Leopard, shouldn't hurt to try it. Hope this helps.

Maybe you are looking for