Classes which inherited from the same abstract class calling each other

I have a design that contains such classes.
1) Media - defines some methods to get data which business logic wants and some others to deal with data
media.java
public abstract class Media {
   public abstract Object getSomeData(String type);
   public void methodForMedia() {
       // do something here...
}And certainly, a lot of classes derive from it to function differently.
etc,
DynamicMedia.java
public class DynamicMedia extends Media {
   public Object getSomeData(String type) {
      // get some data here...
      return somedata;
   public void methodForMedia() {
       // inherits and overrides here
   public void methodForDynamicMedia(String data1, Object data2) {
       // do something here...
}FixedMedia.java
public class FixedMedia extends Media {
   public Object getSomeData(String type) {
      // get some data here...
      return somedata;
   public void methodForMedia() {
       // inherits and overrides here
   public Object getFixedMediaData(String type) {
       // get some fixed data here
       return someFixedData;
}2) Business - which implements business logic
public class Business {
     public void transactionOne() {
           FixedMedia fm = getMedia(FixedMedia.class);
           Object fixedData = fm.getFixedMediaData("fixedDataType");
           DynamicMedia dm = getMedia(DynamicMedia.class);
           dm.methodForDynamicMedia("somedata", fixedData);
}Calling methods defined in DynamicMedia might need
many data that can only be retrieved through FixedMedia
(or any similar class just as FixedMedia - derived from Media and handle "fixed" data).
So we decide to define a field to contain a reference of FixedMedia or its container (a list, map)
in DynamicMedia to reduce the codes.
But it results the coupling between DynamicMedia and FixedMedia(s).
Which design is better on testing, quality?

Why not just use an interface?
And why does methodForDynamicMedia() exist only there?
So we decide to define a field to contain a reference of FixedMedia or its container (a list, map)
in DynamicMedia to reduce the codes.Sounds like a muddled design. Sometimes you might make an implementation decision that adversely impacts the design but you better have a better reason than just because it reduces some code. Maybe it reduces a lot of code, but if so then that might suggest something is wrong with the design.

Similar Messages

  • Delete Data in Infocube which come from the same datasource before loading

    Hi,experts
    We would like to delete the data in infocube which come from the same datasource--0CO_OM_CCA_1  before we load it again.
    and would like to using a process chain to do it.but it seems difficult in BI7.0
    Could you give some suggestion,thanks
    Best Regards
    Jero

    Hi Ian,
    have you tried to use the "Get Delta only Once" flag in the DTP.
    Please see for example thread
    <a href="https://forums.sdn.sap.com/thread.jspa?threadID=370427">https://forums.sdn.sap.com/thread.jspa?threadID=370427</a>
    for some details.
    Nevertheless, the process type 'Delete overlapping requests' is most of the times needed in conjunction with this flag and should work. If in doubt please send me a private EMail containing the customer problem number. Maybe you have a specfic scenario.
      Cheers
         SAP NetWeaver BI Organisation

  • N my house we have 2 iphone 4, and everytime we get the same contact list freom each other, how can we unsync the contacts so each user keeps thir own contact list?

    n my house we have 2 iphone 4, and everytime we get the same contact list freom each other, how can we unsync the contacts so each user keeps thir own contact list?

    Hi user 1724, before icloud, we had the same issue.... 
    so yes,  the solution was to  each log  into the mac separately.
    i kept the main itunes library and apple id, and my son made his own itunes library (which linked to the main itunes/apple id)   - so we were able to maintain separate contacts lists.
    but then w/ the cloud i guess we assumed the cloud would know we each have different contact lists on diff. phones, but it seems the cloud just lumped it all together -

  • How can I have two PDFs open at the same time next to each other?

    How can I have two PDFs open at the same time next to each other?

    Moved to Adobe Reader for iOS.
    The only way I know how to do that is with two iPads.

  • 3 iphones on the same iTunes account receiving each other's calls

    I have 3 iPhones on the same iTunes account and they were receiving each other's texts.  I adjusted the numbers to send and receive under messages in settings, but now they are receiving each other's calls.  Which settings do I need to go to?
    Thank you

    The phone calls going to other phones/iPads is a new feature described in Connect your iPhone, iPad, and iPod touch using Continuity
    You can turn it off by going to Settings > FaceTime and changing "iPhone Cellular Calls" to off.

  • Can I have two LANs with the same IP route to each other

    Hi there,
    I have a customer who has a televantage voip network on a private 192.68.0.0/24 network but has two sites connected via a wireless tower that wants to enable QOS over between the two sites by using a 2621XM router at each end. I've enabled QOS on both routers for voice and video but haven't deployed this yet since I'm not sure if I need to change one of the sites networks to a different network number since I'll have the routes in place with a 192.168.1.0 on the WAN side. If both remote networks stay with the same number scheme of 192.168.0.0/24 will they be able to find each other when requesting where a remote 192.168.0.0 host is or do I need to change of the offices networks to a 192.168.2.0 network to make this work? Sounds kind of basic but before deploying I wanted to get some input...thanks.

    Routers cannot route unless the address blocks for each interface are different.
    If you have two sites connected by any kind of link, and you'll use one site as a gateay to the Internet, then you'll need at least four different addresses/ blocks:
    The 'b' site LAN, i.e., fa/0/0:192.168.0.0/24
    The 'b' site WAN (interconnecting link), i.e., fa0/1: 192.168.1.1/30
    The 'a' site WAN (interconnecting link), i.e., fa0/1:192.168.1.2/30
    The 'a' side LAN, i.e., fa0/0:192.168.2.0/24
    (assumes that your wireless link is acting as a bridge or non-routing link) - the fa0/1 device connects to the wireless devices).
    If you use the same router on the 'a' side for the interconnecting link for both the 'a' LAN and the Internet gateway, then the third interface would be your Internet WAN address.
    The 'b' side LAN interface is your 'b' side default gateway for you clients
    The 'a' side LAN interface is the 'a' side default gateway for your clients
    Set a default gateway on the 'a' router to the ISPs Default gateway / next hop address.
    If you're using a third router for an Internet gateway, then the LAN interface address becomes the default gateway for the clients on that LAN, and you'll need to set up a static route pointing to the other LAN in the routers that connect the two LANs..
    A routing protocol may be useful but, depending on your actual bandwidth available, it's probably better to just set up static routes (no routing protocol bandwidth utilization).
    The /30 for the WAN link gives some economy of address usage, but it may also secure the link better, since there are no additional addresses for the intruder to use; they'd have to spoof one of the two valid addresses (.1 & .2) as well as crack your encryption (and / or other security).
    There's an armload of other possible configurations / topologies / address schemes, I believe this one would be reasonably common.
    The bottom line is that a router can only route from one address block to another. In order to pass traffic between two segments with the same address block, you need a bridge / switch, or some other layer one/two device (like a wireless transceiver pair).
    Good Luck
    Scott

  • Two Telnet read VI's running at the same time interfere with each other

    I have a situation where multiple tests must test multiple UUT’s on the same computer. To send commands to and get responses from the UUT's I use a telnet session. The telnet read VI uses a semaphore. Therefore when two separate top level VI's are running, each calling the Telnet read VI, if one Top Level VI is using the Telnet Read VI the other Top Level VI waits for the first one to complete before it can use the Telnet Read VI. This VI is setup for reentrant execution but because of the semaphore it cannot truly be used as a reentrant function. This causes severe problems when trying to communicate with two different telnet sessions simultaneously.
    In the past I have avoided this problem by compiling everything into an executable. Then each Top Level program runs completely independently with no interdependences. However, now I am implementing Teststand and I need to call the same Top Level VI's. I need to be able to get information into them and back out of them from Teststand. This means that I can no longer compile them into stand alone executables. I did compile each top level VI into its own Share DLL thinking that then each top level program would have its own library to call upon. This did not work. Even though both top level programs are compiled into their own DLL there is still interdependency when calling the telnet read VI. One program waits for the other to finish reading from its telnet connection before it can read from its own telnet connection. Since I have to continuously read from the telnet connection, sometimes for up to half and hour, the tests do not function simultaneously. How can I get around this? Is there a solution?
    Josh
    PS The Telnet Read VI I am refering to came with the Internet Toolset package. Attached is a copy of the VI I use to communicat with the UUT's.
    Attachments:
    GUI_Telnet_W-R_Auto.vi ‏64 KB

    Sorry about the confusion.
    The file I attached is in the hierarchy of two separate top-level VI's. The telnet connect is opened once and closed once in each top-level program. The ref number is then passed into and out of the VI that I attached. I use this VI to repeatedly send commands via telnet and wait for the appropriate responses. The telnet read VI is given a read line separator and reads from the telnet connection until it matches the read line separator with a text string read back from the telnet connection. If not match is found it times out and creates an error.
    I am not sure how to provide an example of the overall scheme since the problem occurs when both top level VI's are compiled each into their own shared DLLs. Those DLLs are then call from Teststand and at some points they are both running at the same time on the same computer connected to two different UUT's.
    The question I have is why does one DLL share functions with the other? When one DLL is using the telnet read VI the other DLL waits for the first one to finish with it before it can it use the telnet read VI. If they were both compiled separately each into their own DLL shouldn't they each have their own set of functions to call upon instead of having to share? I know that if the two top-level VI's are not compiled they cannot both execute the same sub-VI at the same time. The only way to get around this is to set the execution property on the sub-VI to reentrant.
    I actually fixed the problem by setting the VI I attached and the Telnet Buffered Read.VI (called by Telnet Read.vi) execution properties to reentrant. However, I am still concerned about two separate DLLs sharing sub-VIs. Why does it do this?
    Joshua

  • Logo and text required in the same window adjacent to each other

    Hi experts,
    Kindly provide a solution to get logo and some text adjacent to each other inside a single window using SAP SCRIPTS.

    pass th logo in to paint and add the text u want in to it.......
    and make it as a image file ...
    and use that image in ur script................
    Regards
    Anbu B

  • Trying to use super class's methods from an anonymous inner class

    Hi all,
    I have one class with some methods, and a second class which inherits from the first. The second class contains a method which starts up a thread, which is an anonymous inner class. Inside this inner class, I want to call a method from my first class. How can I do this?
    If I just call the method, it will use the second class's version of the method. However, if I use "super," it will try to find that method in the Thread class (it's own super class) and complain.
    Any suggestions?
    Code:
    public class TopClass
         public void doSomething(){
              // do something
    =============================
    public class LowerClass extends TopClass
         // overrides TopClass's doSomething.
         public void doSomething(){
              // do something
         public void testThread(){
              Thread t = new Thread(){
                   public void run(){
                        doSomething();               //fine
                        super.doSomething();          //WRONG: searches class Thread for doSomething...
              t.start();
    }

    Classes frequently call the un-overridden versions of methods from their superclasses. That's that the super keyword is for, if I'm not mistaken.You're not mistaken about the keyword, but you're not calling the superclass method from a subclass. Your anonymous inner class is not a subtype of TopLevel. It's a subtype of Thread.
    Here it is no different, except that I happen to be in a thread at the time.It's vastly different, since you're attempting to call the method from an unrelated class; i.e., Thread.
    I could also be in a button's action listener, for example. It seems natural to me that if I can do it in a method, I should be able to do it within an anonymous inner class which is inside a method.If you were in an button's action listener and needed to call a superclass' implementation of a method overridden in the button, I'd have the same questions about your design. It seems smelly to me.
    ~

  • Two remote objects calls on the same php class

    Hi to all,
           I've encountered a strange issue while developing with remote objects.
    I've a mxml component with an init() method inside which is called by a menu.
    When the init() method is called it makes 7 remote object calls which are bound to some components' dataprovider.
    Among this calls I've got 2 remote object which refer to the same remote class. This because I have to call the class twice and the bind the result to two different combobox. Below you find the code:
    <mx:RemoteObject id="myFile" source="myRemoteClass" destination="amfphp"  showBusyCursor="true" makeObjectsBindable="true" fault="traceFault(event)"/>
    <mx:RemoteObject id="myXls"  source="myRemoteClass" destination="amfphp"  showBusyCursor="true" makeObjectsBindable="true" fault="traceFault(event)"/>
    in the init function I make this calls:
    myFile.listDir("dir_1")
    myXls.listDir("dir_2")
    then in the mxml code I bound the result of myFile to combobox1 and the result of myXls on combobox2.
    The problem arise when I call the myXls' listDir method. When I call it I receive the following error:
    code:
    Client.Error.DeliveryInDoubt
    Message:
    Channel disconnected
    Detail:
    Channel disconnected before an acknowledgement was received
    The strange thing is that not only the myXls object returns this error, but also all the other 6 remote object return the same error above.
    I'm not sure, but I guess that the error could be caused by the two remote object which call the same php remote class. If I comment one of the two calls everything works fine.
    Do you have any suggestion about?
    Thanks!!
    Bye
    Luke

    Hi Jan.
    1) We have the 2 VO, each with 3 rows to fill in data. What I mean is that when i just fill in all the fields for the first row of the first VO, and the value of one of these fields is bigger than 50, then after the exception is thrown and the message is displayed, the fields for the first VO are duplicated and shown in the second VO as if the user had inserted them.
    2) We tried yesterday the validateEntity and a Method and Atributte Validator approaches after reading that white paper with the same results.
    The validation is correctly done using any of the those methods.
    I will try to reproduce this issue with the HR schema.
    Thanks in advance once again.

  • Which tables, apart from the tables of class UPC, are used by STS ?

    Hello, all,
    does anybody know which tables, apart from the tables of class UPC, are used by STS in BW-BPS?
    Merry X-Mas and best regards
    Nina

    Hi Nina,
    there are 20 tables starting with UPS_* that are used by STS.
    Regards,
    Marc
    SAP NetWeaver RIG

  • Transition from the front-end class to the back-end class(Composition)

    Hi there,
    I have a program that is using 2 classes in the same package.Oneis called Add_Word,the other is Edit_Word.Both have a seperate GUI.I have created one class(Add_Word) with a reference to (Edit_Word).The idea is to allow the user to enter a list of words through a text field and pressing a button after each one.Each newly entered word is added to a combo box in the same window.When the user misspells a word,he should click on the word in the combo box and another window (Edit_Word) should appear.Edit_Word has a text field and a button.The user should type the edited word inthe text field and press the button.Whenthe button is pressed the Edit_Word window should disappear and the edited word should replace the old word in the combo box.
    so the flow of data is as follows:
    1)Add_Word window appears
    2)user adds words,one by one
    3)words appear in combo box as they are added
    4)user misspells a word,he clicks on it in the combo box
    5)Edit_Word window appears
    6)user types edited word in text field
    7)user clicks OK button
    8)user returns to Add_Word window which created the Edit_Window in the first place.
    9)new word replaces old word in Combo box
    I am having a problem with step # 8?I need to return to the same object so I retain the information?
    Any help?
    class Edit_Word{
    JTextField edit_field;
    JButton ok_button;
    class Add_Word{
    Edit_Word app;
    JTextField add_field;
    JButton add_button;
    JComboBox  list_combo;
    }

    Thank you for your reply.I am familiar with the built-in JOptionPane dialogs,but I'm just surfing around to learn how to create user defined modal dialogs.I solved the problem yesterday,although a modal dialog seems more controlled.I added a Window listener to Add_Word,which is deactivated when edit_word appears on the screen and activated again when the edit_word window is set to invisible(in the code).So when the window is activated again,it updates the combo box.
    Once again,thank you for your reply.

  • Overloading constructor of a child that inherits from a class that inherits from Windows.Forms

    The title might be a bit confusing so here is the layout.
    - classHForm inherits System.Windows.Forms.Form
    - frmDoStuff inherits classHForm  (written by someone else and used in several applications)
      - does not have a constructor specifically defined, so I added the following thinking it would override the parent
    Sub Public New()
    End Sub
    Sub Public New(byval data as string)
    'do stuff
    End Sub
    In my code, I want to instantiate frmDoStuff, but I need to overload it's constructor and populate fields within this form. The problem I'm running into is that when I run this, it is using the constructor from classHForm and ignores any constructor in frmDoStuff.
    I guess you can't override the parent constructor? Is that why it won't work?
    I didn't want to overload the classHForm constructor, but I will if that's the way to go.
    my code:
    dim frm as new frmDoStuff(myString)
    Note: I would love to show actual code, but not allowed. Against company rules.

    Your code is similar. The value I pass into frmDoStuff is supposed to set a value for a textfield.
    Public Class frmDoStuff
    Inherits classHForm
    Public Sub New(ByVal s As String, ByVal gridData() as String)
    txtMyTextField.text = s LoadGrid(gridData)
    End Sub
    I also have a datagridview I need to populate in frmDoStuff and thought I would have another string or string array as a second parameter to the constructor and then call a routine from the constructor to populate the datagrid.
    of course, when I run it this way, the code is not being reached. I'll build an example as COR suggested and maybe someone will see where I'm going wrong.
    [UPDATE]
    I created a simple example and it worked. So, now I need to try to understand what is different in the actual code.
    Here is my example:
    Parent Class inherits form
    Imports System.Windows.Forms
    Public Class classMyForm
    Inherits System.Windows.Forms.Form
    Sub New()
    ' This call is required by the designer.
    InitializeComponent()
    ' Add any initialization after the InitializeComponent() call.
    End Sub
    End Class
    Public Class frmDoStuff
    Inherits classMyForm
    Public Sub New()
    ' This call is required by the designer.
    InitializeComponent()
    ' Add any initialization after the InitializeComponent() call.
    End Sub
    Public Sub New(ByVal sStuff As String)
    MyBase.New()
    InitializeComponent()
    'Populate the textbox
    TextBox1.Text = sStuff
    End Sub
    End Class
    Public Class frmMyForm
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim frm As New frmDoStuff(TextBox1.Text)
    frm.Show()
    End Sub
    End Class
    Just to recap. The actual parent was created a few years ago and the child form that I'm calling, "frmDoStuff" was created a couple years back and is used in several applications. I need to use it in my application, but I need to populate a couple
    controls when the form is loaded. As you can see in this example, I successfully overloaded the constructor to populate the textbox in frmDoStuff.
    In my real life situation, my overloaded constructor seems to be getting ignored when i step through the code. I'll go back and do some more testing.

  • Two different accounts to be posted for the same valuation class on PGI

    Hi Experts,
    Please note that we want to post two different accounts for the stock offset entry( based on the nature of customer ) in the transaction of PGI in SO. However the valuation class is the same as the nature of the material is same (only the nature of customers is different). We have put one of the two accounts in OBYC GBB - VAX and GBB - VAY.
    Is it possible to have two offset accounts on PGI for the same valuation class.If yes, how will the system identify which one to be posted to.
    Thanks in advance for answers..
    KJU

    hi
    why not create two asset class to easily to separate two situations for two company codes? just a suggestion
    or
    maintain one depreciation key for asset class as a default, if for another company code, just change the depreciation key manual when creating asset master. it is not very complicate.
    or
    create two depreciation areas, one for each company code, then, you will have one useless depreciation for each company code -- not a resonable way
    and, yes, that is the limitation of substituion in AA.
    best regards, Lawrence

  • Two pages binds on the same bean class problem

    i'm developing an HR application
    at the end of application
    the customer asked us for some requirements
    the requirements needed us to use some main forms that insert data
    as popup dialoges from other forms
    we pass the object to be inserted from another form
    its ok we took a copy from the jspx
    and made another form that is used as a dialog
    and binds to the same bean class of the original page
    components and action ... etc
    its all good
    but a problem occurred
    when we tried this with pages of session scope
    when we popup the dialog form
    and navigate to the original form
    i find some parts of the dialog form at the bottom of the main from
    i find many extra components at the bottom
    you can say when i go to dialog and return to original
    i find the dialog form at the bottom of the original form that binds to the same class
    and vice versa
    what's the problem
    i'm waiting

    I second Simon. Try not to put such stuff in sessions. See if you can achieve the same with either requestScope or to the most pageFlowScope.
    Vik
    http://adfjsf.blogspot.com
    http://www.linkedin.com/groupSharingMsg?displayCreate=&connId=-1&groupID=1801839

Maybe you are looking for

  • Ipod shuffle wont add songs, repeatedly asked to reformat

    so i had my ipod shuffle working no problem. i was using itunes 9 with windows vista. recently over break, i rebuilt my computer, including installing windows 7 ultimate onto another hard drive. i have my comptuer booting in windows 7, but also have

  • Campaing management channel telephony automatic call list

    Dear Gururs, On my current project we have integrated SAP CRM 2007 ICI with Genesys. From the campaign management we are using the channel "Telephony" and a call list is generated. This call list is syncronized with Genesys and in Genesys we are usin

  • ERROR: An event session cannot be started without any providers?

    I was trying to get the storport provider that Yong posted and I get the above error despite checking to ensure the log mode is FILE.   Not sure if the provider names are case sensitive, changing the provider name from Microsoft-Windows-Storport to M

  • Print preview screen always appears in IW38 while printing order.

    Hi Experts, I have a user who always gets a print preview screen while printing orders from orders list page in IW38 T-Code. Now we have tried to set his printer as default in SU3 T-Code, Also we have  selected the Print Immediately Option, In additi

  • Setting "Open With" for files in specific folders?

    Hello -- I cannot figure out how to have some of my .html files open in DreamWeaver (for when I'm working on my website) while having other .html files open in my web browser (for normal viewing). I know I can set an individual file to open with a sp