Confusion about observer design pattern

Hi all,
I have a case related to observer design pattern and I feel a bit confusion.
Suppose there is a gui class which consists of 2 buttons connect and disconnect to the network and a socket class handling these two operations. Then socket class will inform the gui class if the operation is success or not. By applying the observer design pattern. gui class is observer and socket class is obserable. however I feel confusion as observer will send a command e.g. connect to observable.

dophine wrote:
my confusion is that the observer is the event source not the listernerIt is an observer but it also takes another role: the controller of the observable.
kind regards,
Jos

Similar Messages

  • Observer Design Pattern: Looking for redesign ABAP OO code example

    Hello folks,
    I am looking for an example for ABAP OO code that has been redesigned by applying the Observer Design Pattern. I would be very interested in both the code before as well as the code after the pattern is being applied.
    Thanks in advance and kind regards, Alex

    Observer can be implemented using the EVENTS.
    I had recently implemented the observer at one of my client's place. I had screen with so many ALVs. One ALV was kind of editable and other were just showing the information of the current row as well as some total information. So, initially I started with the Main ALV and SUB(1 and 2) for other ALVs. Now, when I need to refresh my ALVs based on the main ALV data, I had to explicitly update the data of the each Sub ALV. The code was kind of static and requirement was not yet fixed.
    Later on we need to add one more ALV on the same screen. It was easy to change the existing method where I was doing the explicit refresh of each ALV. But I thought of using the Events.
    I created an event REFRESH_DETAILS for main ALV. so, when data gets changed (which I was catching by DATA_CHANGED event of ALV), I raise the event.
      RAISE EVENT REFRESH_DETAILS
        exporting new_data = it_Data.
    In Sub ALVs, I created the event handler method to handle the event REFRESH_DETAILS of the main ALV.
      methods: handle_refresh_details
          for event REFRESH_DETAILS of ZCL_MAIN_ALV.
    I also had to register the Handler.
      SET HANDLER me->handle_refresh_details FOR ALL INSTANCES.
    I'll soon write a post on my [ABAP Help blog|http://help-abap.zevolving.com/] with all the details.
    Regards,
    Naimesh Patel

  • When I use SmartSync Notifier/ Observer design pattern

    Hi all,
    I have development a simple SmartSync Application with S01 syncBO type.
    I not use SmartSync Notifier/ Observer design pattern  for read the local syncbo and local delta.
    When I have to use and I have to implement the SmartSync Notifier/ Observer design pattern ?

    Hi Rocco,
    <b>SmartSync uses Notifier/Observer design pattern for applications to access inbox/outbox. Application has a read-access to the passed SyncBoOutDelta instance during the notification</b>
    The usage of this API depending upon your custom requirement. If u want to monitor the number of new records(for example sales or like thAT) u have created in the client device , then that delta records will be there in the Smart Sync Outbox. If u want to monitor this new records then u have to use the API related with (Outbox - SyncBoOutDelta)..
    Then comes the Inbox.The new records came from the Server will be there in the inbox of the MI client. This new records may be the response of number of new records u ahve created in the client device . If u want to monitor the number of new records that has downloaded to the MI client , then u have to make use of the SmartSyncInboxDelta..
    Using this APIs , u can also find out the errors happened during the particular synchronization. For this APIs are also available...
    refer these helps also..
    SyncBoChange
    This interface is the base interface to describe SyncBo delta change. Application should not use the interface directly, instead, use its sub interfaces - SyncBoInDelta, SyncBoOutDelta.
    http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/javadoc/com/sap/ip/me/api/smartsync/SyncBoChange.html
    SyncBoInDelta
    http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/javadoc/com/sap/ip/me/api/smartsync/SyncBoInDelta.html
    SyncBoInDelta is used to apply SyncBo delta data from backend to client. The SyncBoInDelta could may be a delta data from either the backend or other devices, or a response to the previously uploaded SyncBoOutDelta from the client, which can be distinguisehd by the SyncReply information included within the SyncBoInDelta
    SyncBoOutDelta
    SmartSync uses Notifier/Observer design pattern for applications to access inbox/outbox. Application has a read-access to the passed SyncBoOutDelta instance during the notification
    http://media.sdn.sap.com/public/html/submitted_docs/MI/MDK_2.5/content/javadoc/com/sap/ip/me/api/smartsync/SyncBoOutDelta.html
    Regards
    Kishor Gopinathan

  • Observer/Observable design pattern

    Is there a way to implement the Observer/Observable pattern in a pure java FX 1.2 desktop Application?
    And if yes how ? :)

    You can use the real stuff, as shown in some threads (eg. in [Cannot bind a string array|http://forums.sun.com/thread.jspa?threadID=5425718] I show an example).
    This is necessary only to bind Java variables to JavaFX code.
    Now, as said above, in pure JavaFX code, you use binding. And the 'on replace' facility is useful too, as changes trigger actions.

  • JavaBean Models, Command Bean and J2EE Design Pattern

    Hello,
    I have read the available "How To", “Using EJBs in Web Dynpro Applications” where the author mentions that one should use a Command Bean (according to J2EE Design Patterns) so that one can invoke business methods in a Session Bean from our Web Dynpro Application. Well, although, I have read some available articles in the internet about J2EE design patterns, I still have some questions about command beans and its usage in Web Dynpro applications.
    I have developed a WD App which uses EJBs to read data from the DB.
    Let's suppose I only have two tables: BOOKS and AUTHORS.
    Let’s also suppose I have to Entity Beans (one for each table) and a Session Bean with two methods: Book[] getAllBooks() and Author[] getAllAuthors();
    I also have a Command Bean which I imported in my WD App.
    My questions are:
    How should I design my Command Bean?
    Can I have only one Command Bean with two methods each calling one of the methods of the Session Bean?
    Or instead should I design two Command Beans, one for each call?
    In the last case do the methods must be named <b>execute</b> or can I name them whatever I want?
    Furthermore, how should I store the data in my command bean? In instance variables?
    If so, can I use array of a class representing a record in the database table (for instance, classes Book and Author) or do I have to store the data in a generic collection (such as ArrayList for instance)?
    I ask this last question because if I try to store the data in an array when I am importing the Command Bean as a JavaBean model I always get an error.
    One last question: Can the Command Bean execute method directly return the data or should I always store the data in an instance variable an then get it using getter methods?
    I know this questions are more about J2EE Design Patterns and JavaBeans specification than they are about Web Dynpro but I also have doubts about the rules that the command bean must obey in order to accomplish a successful JavaBean model import in WD.
    Some guidance or tips would be highly appreciated.
    King Regards

    I have the same problem.
    Does anyone know the solution?
    Thanks
    Davide

  • What is command design pattern? what is the problem that it solves?

    Hi i have been reading few articles on command design pattern but was unable to understand what it is and what problem does it solve. As far as my understanding goes if there is a pre specified method in an object that could execute and perform the necessary activities then it is called as command design pattern. Why is it named as command design pattern, it is because in a shell we use commands to retrieve output. For example when we type "dir" in dos command prompt it returns the list of files. so here we have to remember a preexisting exe file named "dir" which does something when used. So here like we call it command because when "dir" is passed to the computers it returns something that is expected. may be the computer obeys the command issued and return something back. So like wise if there is a method that is defined as as the command, for example in struts framework the action class must have a method "execute()" which is called by the framework to execute the necessary action mapped to it. So if there is a predefined method like "execute" in struts then the object is said to be followed command design pattern. So what actually does it solve?
    What ever i have written is my understanding from the articles i have read about the design pattern. So kindly correct me if i am wrong. Help me understanding what actual problem does this pattern solves. Thanking you in advance.

    This is really off-topic for these forums. You might do better on StackOverflow.com. I'll just say that although the first Design Patterns book came as a revelation to me, it was more for (a) the nomenclature (decorator, factory, facade, etc) which is still with us and (b) about five of the original patterns, which told me things I didn't already know. I've never used any of the others, including Command, and the whole design patterns thing quickly degenerated into farce with what seemed like a sustained attempt to reduce the whole of computer science to design patterns, which really isn't the point. As an example, there is one in another book called Type Object, which is nothing but 3rd normal form, which can be defined roughly in a couple of sentences. This pattern went on for dozens of pages with a very artificial example. I wrote to the mailing list about it: 'Type Object considered hilarious'. I got a rude reply from the original author, which I guess I expected, but also an incredible response from the list owner, saying I should recast my objections in the form of a design pattern. That lost it for me. True story. Moral: don't take this religion, or any IT religion, too seriously. They come around every 18 months or so with the regularity of the next bit of Moore's Law. I've seen dozens of them come and go since 1971, all with something to say, all 90% nonsense.
    See here for a longer version of this incident.

  • Design patterns Tutorial

    Hi friends,
    can any one tell me the good Website for the following design patterns
    Intercepting Filter, Model-View-Controller, Front Controller, Service Locator, Business Delegate, and Transfer Object
    I am planning to take up SCWCD in jan 2005. I would like to know more about these design patterns. If any one having a pdf plz send me.
    Thanks in advance
    bye for now
    sat

    Read here ---> http://java.sun.com/blueprints/patterns/

  • Design Patterns in ABAP.

    Hi,
    I want to know about the Design Patterns in ABAP.
    Regards,
    Sourav

    hi sourdi
    Below are the list of Design pattern in abap .
    Singleton: ensuring single class instantiation
    Adapter: making class interfaces compatible
    Factory: encapsulating object creation
    MVC: decoupling business logic from the view
    Facade: providing a simplified interface
    Composite: treating individual objects and compositions uniformly
    Decorator: forming a dynamic chain of components to be used as one by the client
    regards
    chinnaiya P

  • Design Pattern help needed for MDI application

    Hi,
    I am writing an mdi application which contains a JSplitPane. The left pane contains a JTree and the right contains a JDesktopPane which houses n number of JInternalFrames. The JInternal Frames need access to the JTree. Also both panes (objects w/in) need access to elements of the JFrame. I am currently implemeting access by making most of the JFrame objects static and creating getter/setter methods for access. Does anyone know any desing patterns I might use to solve this dilemma?
    Thanks,
    John

    The observer design pattern causes the child objects to chage state when the parent changes state. The type of pattern I need would allow the child objects of the parent JFrame to be available globally without having to make them static. I am wrong in this? Would the observer pattern solve this issue.

  • Portal design patterns

    I need details about portal design patterns .
    Thanks,
    Venkata Sarvabatla

    Why you are answering for that... Every body knows there are WLS documents..

  • ETL design pattern with Data Integrator

    Hi all
    I have searched a lot on the SAP website and also on the Google to find a reliable document about ETL design pattern which applies to BO Data Integrator, but it was not successful. Most of the links I found was for  SSIS and Informatica,....
    I would be grateful if you could guide me to a good link about ETL design pattern.
    Thanks.

    I would start with these two:
    https://wiki.sdn.sap.com:443/wiki/display/BOBJ/ETLProjectGuidelines
    https://wiki.sdn.sap.com:443/wiki/pages/viewpage.action?pageId=49414406

  • Question about design pattern - business delegate

    hi guys
    i have got a question to ask about the delegate pattern. usually, we use it to decouple between presentation client and businessservice tiers. for instance, the service tier has an session ejb, and delegate wrapps the ejb. and the web client calls delegate to access service. is the delegate only used by the presentation tier? within the service tier, we can have many ejbs that work together to get tasks done. do we still use delegates in the service tier? what is ur suggestion? thanks

    Try the Patterns and OO Design forum.

  • Design patterns,about value object ,how?why?could you give me a soluttion

    design patterns,about value object ,how?why?could you give me a soluttion
    use value object in ejb,thanks
    i want not set/get the value in ejb,find the method to solve it ,use value
    object ?
    how? thanks.

    Hai
    Enter your telephone number here, at the top it will say your Exchange, Phone and cabient number. If it doesn't mention cabinet that means you are directly connected to the exchange and not via PCP.
    If you are connected to a cabinet and it doesn't say FTTC is available, ask your neighbor to-do the same test (they have 2 be infinity connected). If they are, then proceed to contact the moderators here. Though it could not be showing because all the ports have been used up in the FTTC Cabinet.
    If this helped you please click the Star beside my name.
    If this answered your question please click "Mark as Accepted Solution" below.

  • [BOOK] What's the best book about DESIGN PATTERN

    Hi Guys,
    by experience, what's the best book for you concerning the Design Pattern in Abap. I mean :
    Quality,
    Comprehensiveness,
    Clearness,
    Amount of chapter,
    etc.
    Thank for advices.
    Rachid.

    Dear Rachid,
    This is rank 1 book, but u have learn online also. So many websites are there. example search: OO Design patterns ZEVOLVING.
    Regards,
    Abbas.

  • Question about design pattern - business delegate: repost

    hi guys
    i have got a question to ask about the delegate pattern. usually, we use it to decouple between presentation client and businessservice tiers. for instance, the service tier has an session ejb, and delegate wrapps the ejb. and the web client calls delegate to access service. is the delegate only used by the presentation tier? within the service tier, we can have many ejbs that work together to get tasks done. do we still use delegates in the service tier? what is ur suggestion? thanks

    thanks, but i don't think i follow what u said.
    bascially i was asking if it was still a good idea to use delegates to communicate between ejbs the same way presentation tier calls service tier. i.e. SessionEJBA calls DelegateB to access SessionEJBB. or SessionEJBA calls SessionEJBB directly including the lookup, etc.

Maybe you are looking for

  • ORACLE SERVER AND UNIX TP MONITOR-2

    제품 : ORACLE SERVER 작성날짜 : 1995-01-24 Subject: Oracle Server and UNIX Transaction Processing Monitors-2 Page(3/4) This file contains commonly asked questions about Oracle7 Server and UNIX Transaction Processing Monitors (TPMs). The topics covered in t

  • FCP Crashes at Open - Large Project - Help!

    Near end of large 10 minute 24pa video. Total file size is about 60 to 70gb. FCP loads file - then crashes. I believe this started after use of motion for ending credit roll down. Tried trashing preferences, cleaned up main drive (now about 85 gb fre

  • Computer will not boot after 10.6.8 upgrade

    Just did the 10.6.8 upgrade to a computer and not it wont boot. Stuck at the grey start up screen with the apple and the spinning wheel of death. Zapped the PRAM to no avail and reset the SMU and still the same. Any advice?

  • FC Studio 2 - Effects Master Templates

    Gang, a little help on how to use the new Master Templates in FCStudio2 such as the 3D Text Projects, Blocks, Fire, Water, etc. If there's a video tutorial some where this would be cool. Thanks.

  • 2 ipads 1 account how not to show wifes purchases on mine

    wife and I have ipads my account is there a way so that her game purchases don"t show on mine