Finding instance from variable design pattern required

Hello guys,
     In my appication I need to get instance of a class from its instance variable.
Let me explain in deep.
I have one class ServerConnection in which I accept connection from client as a SocketChannel..
In the same class I pass this channel variable to new Player construcotr and create one Player class instance.
Now each player has it's own channel.
My problem is that when particular channel closed I have to identify particular Player from so many player..
So how can I identify that instance..
I can do this by comparing socket port but there are so many players instance so it is some burden some.
I need some pattern which can help out me to identify particular player by simply passing Socketchannel as parameter..
Please help me out.

Hello Nina
A very good introduction into design patterns is the book "Head First: Design Patterns". Here you will find many good reasons why and when to use the factory pattern.
You should use the factory pattern when
- you want to prevent "direct" instantiation (i.e. using a public CONSTRUCTOR method) by the developer
- you want to hide the complexity of instantiation from the user of the class
- the instantiation creates an implementation of an interface and you want to keep control of which implementing class is returned
Regards
  Uwe

Similar Messages

  • Get instance method and design pattern

    Hi All,
    1. I New to abap objects and i read the help and some stuff from the forum,
    l like to now more about design pattern in abap objects,
    2. I saw in some abap class the use of method of GET_INSTANCE i think it's from factory pattern , what is the pros. and cons to use this method ,when i should consider to use it ?
    Thanks in Advance
    Nina

    Hello Nina
    A very good introduction into design patterns is the book "Head First: Design Patterns". Here you will find many good reasons why and when to use the factory pattern.
    You should use the factory pattern when
    - you want to prevent "direct" instantiation (i.e. using a public CONSTRUCTOR method) by the developer
    - you want to hide the complexity of instantiation from the user of the class
    - the instantiation creates an implementation of an interface and you want to keep control of which implementing class is returned
    Regards
      Uwe

  • How to study design pattern?

    I have learn java for nearly a year and want to know more about design pattern.Fundemanetal instances of basic design pattern are appriciated.Thanks for your answer.

    The most famous book on patterns is :
    Design Patterns: Elements of Reusable Object-Oriented Software. Gamma et. al.
    You should start there if you are interested in the subject.
    There are tons of books since then on the subject. There is a list at
    http://hillside.net/patterns/books/

  • Does any body have any design patterns of JSF Web Application Developping?

    Can any one answer me some questions?
    #1.I am an amatuar of people who develop Web Application.For some reason,We choose the JSF to develop our item.through some introduction,I know the UI component of JSF is resided in Server side,is it right?but I am a little confused that:if there are many users who are exploring our jsf website.(to simplify my question,image I had just one web page and just one button)How many UI components(buttons) will be there?How it(they?) works?
    #2.Does any body have the success experience (for example design pattern)to develop web applications?if We just concern about the Add,Delete,Modify,Query operations of some data.
    I just do my job according to my feeling.
    I will give every page a pagebean(backing bean),and I am not sure how to combine the business data with the pagebean.some one suggested that I should use delegate pattern to separate my business log and page logic.But I am still confused by following things:
    #2.1 does JSF have the same ability to help us construct the model dialog just like swing to
    help us control the operation flow?
    #2.2 If there is not,Does the following way work?I put every tabledata's property as corresponed component.if user choosed the row in the table,My Listener will syncronize the row data to the components.But
    #2.2.1 if JSF has the components according to the web users' number,how can My Listener tell which component should be update?Should I maintain the map?
    #2.2.2 If the problem I imaged above is false,Does any body can tell me how to custom      the ListDataModel,so I can use it like Swing?because now I can just use some view data to insert into ListDataModel,but after some selection operation,my business object must be find according to the selected data,it is not an interesting job!
         I am waiting for your advice!

    Ok I'll try to explain Step by step please correct me if I make any mistake because I have not played much with shared variables.
    To create a shared variable to an RT target go to the target if tou have already otherwise add an RT target by right clicking the Project>>Add targets and Devices
    Then in the target Right clikc and select the variable as shown below.
    Then once the Shared variable settings window opens Enter a variable name and then Select the type "Network Published"
    In the right side you can select the data type for the shared variable and even you can choose your custome controls.
    After selecting the data type go for the Network and select buffering if required else leave it if you are planning to use the variable just for display purpose.
    Then you can enable the RT FIFO if required (Not able to explain how it works and why it is used).
    Then after completing the Shared variable setup you can access the variable in the VI in both the Host and the RT.
    You can bind the variable to a control so that if any data from the RT is coming you can read the data from that control.
    Once you have placed your shared variable in the BD you can change the access typr to read or write depending on your need.
    This might not explain the complete shared variable concept but I believe that this would defenelty give you a kick off to start using the shared variable. Please correct or add more comments if anybody know better.
    Good luck.
    The best solution is the one you find it by yourself

  • 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

  • Varying result set and binding parameters in sqlcmd from variable

    SSIS  - Support of Multiple versions of our product
    Our Enterprise Data warehouse consolidates data from multiple data sources.  We have a requirement that we should be able to support data collection from different version of these data sources at the same time.
    Ex. Customer has three different versions of our product installed 7.3,  7.3.1 and 7.3.2. The data warehouse would in this case would be on version 7.3.2, but should be able to collect data from prior versions of the data sources.
    We use stored procedures to collect data from sources into our staging area and then we transform and load it on to the warehouse. The design of SSIS packages are that, there is one main package that executes packages for each table that we collect data
    from the source. The main package is invoked per source that we need to collect data from, if there are three sources at run time there will be three instances of the main package running. These packages run on the warehouse machine to pull the data from the
    source system.
    We would like to maintain one version of these packages on the warehouse and support collecting data from different source versions.
    Challenges
    The signature of stored procedures on the source system has changed between versions
    There are some additional fields returned by these stored procedures in the newer release
     Example
     7.3 version signature :
    [dbo].[PDW_GetMediaAgentSummary](@LastVersionID
    AS BIGINT,
    @InitializeDays as
    INT = 60,
    @NextVersionID AS
    BIGINT OUTPUT)
    7.3 Sp1 version signature:  [dbo].[PDW_GetMediaAgentSummary](@LastVersionID
    AS BIGINT,
    @DataStartDate AS
    DateTime2(3),
    @NextVersionID AS
    BIGINT OUTPUT)
     Also, let us say in 7.3 this stored procedure returned 8 fields and 7.3 sp1 it is returning 10 fields.
    The way we are trying to accommodate is to use “SQLCmd from variable” option in the OLE DB source to cover the signature difference, but this option does not allow us to bind parameters
    to variables to get the output value. The second issue of additional fields (or the lack of additional fields from the 7.3 procedure), we tried to turned off the metadata validation, but we get field not found error at run time when we run the SSIS package
    against 7.3 version. Looks like the only way we could solve is to duplicate the data flow tasks, based on the source version. Looking for better way to do this, since this could go out of control as the number of releases increases.
    Appreciate help on this.

    I suggest you branch your package into one route vs another based on some flag that indicates version the package is connected to then it will execute one stored proc or another, this can be done
    using the Precedence Constraints, or make a wrapper stored proc that hides the data differences between the versions.
    Arthur
    MyBlog
    Twitter

  • 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

  • How to remove the entity instances from a decision report

    Please see below the rules and the resulting decision report
    How can I remove, from the decision report, the four lines that say "the persons in the family unit", instance 1, instance 2, instance 3?
    I just can't seem to find a place where the use of silent or invisible will cause the four lines not to appear
    The Rules
    the applicants for income assistance in a family unit have completed (and submitted) to the minister an application for income assistance (part1) form if
    forall(the persons in the family unit, the person satisfies the requirements to complete and submit an application for assistance (part 1) form)
    the person satisfies the requirements to complete and submit an application for assistance (part 1) form if
    all
    the person is an applicant
    s4.1(2)(a)(i)     the person has provided a social insurance number
    s4.1(2)(a)(ii)     the person has provided the information, authorizations, declarations and verifications specified by the minister as required in the application for assistance (part 1) form
    The Decision Report
    EA Regs s4.1(2)(a)(Application - Part1) is satisfied.
    The applicants for income assistance in a family unit have completed (and submitted) to the minister an application for income assistance (part1) form.
    the persons in the family unit
    instance #1
    instance #2
    instance #3
    Abel satisfies the requirements to complete and submit an application for assistance (part 1) form.
    Abel is an applicant.
    Abel satisfies section s4.1(2)(a)(i).
    Abel has provided a social insurance number.
    Abel satisfies section s4.1(2)(a)(ii).
    Abel has provided the information, authorizations, declarations and verifications specified by the minister as required in the application for assistance (part 1) form.
    Edited by: A Gibson on Oct 11, 2010 3:35 PM

    Here are some further details. If images could be attached to this forum then I would have included some screenshots, but this forum only allows text.
    1. Set up regular name substitution (See the sections "Set up substitution" and "Substitute the actual value of a variable for its text" in the OPM Help article "Change the text of an interview question or sentence").
    2. In the Properties file, double-click on the entity. This will open the Edit Entity dialog.
    3. In the Edit Entity dialog, fill in the Identifier field with the variable you're using for the regular name substitution.
    4. Click OK and you're done!
    Cheers,
    Jasmine

  • Design pattern / data loading solution

    Hello all!
    I have been working on a few projects which involve loading data, sometimes remotely, sometimes local, sometimes JSON, sometimes XML. The problem I am having is that due to the speed of development and the changing minds of various clients I am finding my designs are too rigid and I would like them to be more flexable. I have been trying to think of a reusable solution to data loading, and would like some advice as I imagine many of you out there have had the same problem.
    What I would like to do is to create a generic LoadingOperation abstract class, which has member variables of type Parser and Loader, which have parse() and loadData() methods respectivly. The Parser and Loader classed are interfaces and classes that implement these could be XMLParser and JSONParser, LocalLoader and RemoteLoader etc. With something like this i would like to have a new class which extends LoadingOperation for each thing to be loaded, weather thats a local XML file, or remote JSON, or whatever.
    The problem is is that specific Parser implementation cannot return custom data types without breaking the polymorphic behavior of the LoadingOperation class. I have been messing around with generics and declaring subclasses of LoadingOperation like
    class SpecificLoader extends LoadingOperation<CustomDataType>
    and doing similar things with Parser classes, but this seems a bit weird.
    Does anyone have any suggestions on what im doing wrong / could be doing better. I want to be able to react quickly to changing specifications (ignoring the fact that they shouldnt be changing that much!) and have a logical seperation of code etc...
    thanks for any help!
    psi have also asked this question here [http://stackoverflow.com/questions/4329087/design-pattern-data-loading-solution]

    rackham wrote:
    Hello all!
    I have been working on a few projects which involve loading data, sometimes remotely, sometimes local, sometimes JSON, sometimes XML. The problem I am having is that due to the speed of development and the changing minds of various clients I am finding my designs are too rigid and I would like them to be more flexable. I have been trying to think of a reusable solution to data loading, and would like some advice as I imagine many of you out there have had the same problem.
    What I would like to do is to create a generic LoadingOperation abstract class, which has member variables of type Parser and Loader, which have parse() and loadData() methods respectivly. The Parser and Loader classed are interfaces and classes that implement these could be XMLParser and JSONParser, LocalLoader and RemoteLoader etc. With something like this i would like to have a new class which extends LoadingOperation for each thing to be loaded, weather thats a local XML file, or remote JSON, or whatever.
    The problem is is that specific Parser implementation cannot return custom data types without breaking the polymorphic behavior of the LoadingOperation class. I have been messing around with generics and declaring subclasses of LoadingOperation like
    class SpecificLoader extends LoadingOperation<CustomDataType>
    and doing similar things with Parser classes, but this seems a bit weird.
    Does anyone have any suggestions on what im doing wrong / could be doing better. I want to be able to react quickly to changing specifications (ignoring the fact that they shouldnt be changing that much!) and have a logical seperation of code etc...That depends on the specifics.
    The fact that it seems like processes are similar doesn't mean that they are in fact the same. My code editor and Word both seem to be basically the same but I am rather sure that generalizing between the two would be a big mistake.
    And I speak from experience (parsing customer data and attempting to generalize the process.)
    The problem with attempting to generalize is if you generalize functionality that is not in fact the same. And then you end up with conditional logic all over the place to deal with differences dependent on the users. Rather than saving time that actually costs time because the code becomes more fragile.
    Doesn't mean it isn't possible but just rather that you should insure that it is in fact common behavior before implementing anything.

  • Design Pattern / Best Practice Question

    Hi,
    I have been using Flex for a while now, but there is a
    scenario which I still have not found a solution I'm entirely happy
    with. I'm wondering if anyone else out there might have suggestions
    on a design pattern or best practice.
    Suppose I have a view which depends on model data which
    resides in some back end systems. That model data may or may not
    have been loaded (e.g. via a web service or remote object call) at
    the time the view is displayed.
    I don't know if the user will ever visit this part of the
    application so I would prefer to defer retrieval of the data until
    the user actually navigates to this view. Or I want to retrieve the
    data each time the view is displayed because the data is dynamic
    and could change between one presentation of the view and the next.
    Because the data comes from several systems, I cannot simply
    make one service call and display the view when it completes and
    all the data is available. I need to call several services which
    could complete in any order but I only want to display my view
    after I know all of them have completed and all of the model data
    is available. Otherwise, I can present the user an incomplete view
    (e.g. some combo boxes are empty until the corresponding service
    call to get the data completes).
    The solution I like best so far is to dispatch a single event
    (I am using Cairngorm) handled by a single command which acts as
    the caller and responder for all of the services. This command then
    remembers which responses it has received and dispatches another
    event to navigate to the view once all the results have returned.
    If the services being called are used in different
    combinations on different screens, this results in proliferation of
    events and commands. An event and command for each service and
    additional events and commands to bundle the services and the
    handling of their responses in the right combinations for each of
    the views.
    Another approach is to have some helper class listen for all
    of the model changes and only display the view when the model
    enters some state that is acceptable. It is sometimes difficult to
    determine just by looking at the model whether it is in the right
    state (e.g. how can I tell that a collection is the new collection
    that should just have been requested versus an old one lingering
    from a previous call). The logic required can get kind of
    convoluted and brittle.
    Basically, all of the solutions I've come up with so far seem
    less than ideal and a little hackish. I keep thinking there is some
    elegant solution out there that I am just missing ... but so far,
    no luck finding it. Thoughts?
    Thanks.
    Bill

    i think a service class is right - to coordinate your calls.
    i would have 1 event per call (so you could listen to individual
    responses if you wanted to).
    then i would use a flag. if you want to check for staleness,
    you would probably want two objects to map your service flag to
    lastRequested and lastCompleted. when you check, check if it's
    completed, and if it's not stale and that your lastRequested is
    less than lastCompleted (meaning that you're not currently waiting,
    i.e. you've returned since making a request). then make the request
    and update your lastRequested.
    here's a snippet of what i mean.
    ./paul
    public static const SVC1_LOADED:int = 1;
    public static const SVC2_LOADED:int = 2;
    public static const SVC3_LOADED:int = 4;
    public static const SVCALL_LOADED:int = 7;
    private var completedFlag:int = 0;
    then each call would have it's own callback.
    private function onSvc1Complete( evt:Event):void {
    completedFlag |= SVC1_LOADED;
    lastCompleted[ SVC1_LOADED ] = getTimer();
    dispatchEvent( new Event("svc1complete") );
    checkDone();
    private function checkDone():void{
    if( completedFlag == SVCALL_LOADED )
    dispatchEvent(new Event( "allLoaded" ));

  • Dependancy of  Appliacation Performance  on Package Design Patterns ??

    Hi
    Recently one of my collegue have suggested us to change the data base package design pattern ., i.e to design the package as per the database functionality but not as per the application functionality.
    Example to say ., to integrate all the Data retrivel Sp's into a single Package , All the Update functionality into another package so on... i was totally refused to do so as i never find as such practice in my career.,
    We design the packages as per the Application functionality i.e for each module we design one or more packages so that the developer working on that particulor module can access the Packaged objects very easily and also this will improve the Application modularity & effeciancy.
    Can any one say, what will be impacts on the Appliacation Performance prospective if i design the package as per my collegue's suggestion., and which is best approch in the application development area.
    We are working on Oracle 10gR1 and the front end is .Net .,
    Regards
    Sekhar

    I don't think the performance are the biggest problem here. I do think however the code maintenance could be a problem. Especially if your app is large, then somehow logically grouping procedures/functions with similar requirements in packages and having these groups as subsystems/modules in your application is more flexible because as your app grows, you can add another subsystem/module and another package. If you create some fixed number of packages e.g retrieval, update, insert, delete, then what you'll do for a large application? Create package Retrieval1, retrieval2 etc? Seems quite illogical.
    So I doubt there are big gains/losses from pure perfomance point, but the biggest problem is maintainability of your code.
    Gints Plivna
    http://www.gplivna.eu

  • Builder Design Pattern

    Hi,
    I'm trying to implement the Abstract Builder design pattern for a fairly complex object. If I understand correctly, the builder creates the whole object in one shot; as in, the pieces are hidden from the client while the object is being built. So suppose the object that I need to include as an "ingredient" is more complex. I have a class called Route (with different types that extend it) that requires a list of segments and an origin and destination. The part I'm confused on is how to build a route if I can't provide parameters for it. All the examples I've found so far have had simple objects for the ingredients that didn't require any personalization. Sorry if I'm being unclear. Ask if you need clarification.

    Could be. I'm far from a pattern guru. The key here is to find an approach that works. If perusing a catalog of patterns give you and idea of how to solve your problem, great, use it. On the other hand, if you already have a solution, and it happens to fit a pattern, then cool, now you have a name for what you did. The wrong thing to do would be to try to force it into a particular pattern that doesn't fit.
    The value in patterns is twofold: 1) as a means of communication of some fairly complex, commonly used, abstract concepts, as in, "I suggest a Builder Pattern for this," and the other guy knows exactly what you're talking about, or at least has a general idea and knows where to go for details, and 2) as a catalog of common solutions to existing problems, as in, "Dang it, I have this problem with such-and-such interactions among the pieces, I'm not sure how to structure a solution, but I bet somebody else has done it before... Oh, yeah! Builder Pattern! That'll work!"

  • Design pattern for continuous record printing

    The Java printing API requires that during the print process a program retain enough information so that it can draw any page that is requested at any time. The API makes a call to the print method in the Printable interface with a specified index and the program is supposed to handle it.
    I've been able to successfully use this method quite well for some time but now I've encountered a more complex situation and I am hoping someone can help me design a way to do what I need.
    I have a data conversion program that may process millions of database records. I'm writing a conversion report for it where a variety of notification messages will print, possibly hundreds of thousands of messages (I know a report that long isn't very useful but our clients have to print it and file it as a FDA requirment). Because of the potentially large quantities of records involved I don't want to retain all of that information to allow any page can print at any time. I won't have a print dialog so there will be no way to selectively print pages anyway. I want to open the report at the beginning of the conversion and then call functions to write report records. When a page fills up it should print and start another. At the end a close function should be called to tell the Printable to start returning NO_SUCH_PAGE to end the process.
    Does anyone know a design pattern that will accomplish this? The behavior I'm seeing is that the Printable.print method gets called twice per page, once to determine if the page exists, then again to print the page. I could retain enough information to print the one page, but then I'm doing page counting that the API wasn't designed for and I'm afraid it will fail when I put it on other systems.

    Have you thought about separating the two business functions of (1) executing the data conversion, and (2) generating the report(s)?
    You could capture the information about the "report generating" conversion events in an XML file, and then generate your reports from this datastore. You may find some performance benefits in the conversion piece, and have greater flexibility when dealing with the XML information store.
    I want to open the report at the beginning of the conversion and then call functions to write report records. Here you would write report records to an XML file, or many XML files. You also put a counter in the conversion program that will start the reporting program after a specified number of event have occured. This will allow you to generate reports as the conversion program is still running.
    I could retain enough information to print the one page, but then I'm doing page counting that the API wasn't designed for and I'm afraid it will fail when I put it on other systems. You should try to avoid "page counting".
    A

  • Software design patterns

    Dear members,
    As part of a research degree, I am conducting an online survey on the use
    of software design patterns within software design projects, especially
    when used within the scope of integrating applications (e.g. web services,
    EAI etc). The aim is to investigate how use of software design patterns can facilitate software reuse and save time and cost with software development
    The study doesn�t assume the use / knowledge of software design patterns as
    a pre-requisite for filling the online survey as we are collecting views of
    software developers with different background and experience.
    Your response would be treated as confidential and the online survey and
    results are anonymous (no name, address � etc is required).
    All those who completed the survey with valid E-mail address will receive
    copy of the aggregated results and any related publications, though giving
    E-mail is optional.
    The survey is expected to take 5 minutes to complete.
    The link to the online survey is at
    http://integrationsolutions.co.uk/Patterns_may.htm
    Many thanks for helping with this study.
    Contact details: [email protected]
    University of Bolton UK( http://www.bolton.ac.uk)
    Project web site (Under construction http://www.integrationsolutions.co.uk
    ).

    the only problems i could find is...
    1. sensors and display unit may vary...
    2. each measurement should displayn their hi and low values which can b considered as a common function...
    3. the display should vary according to user's request
    this is the scenario...
    could you help me to find the real problems and to apply patterns
    Weather Monitoring Station
    This system must provide automatic monitoring of various weather conditions. The system will have sensors to measure:
    Wind speed
    Wind direction
    Temperature
    Barometric pressure
    Humidity
    The system must also provide the following derived measurements.
    Wind chill(derived from temperature, wind speed and humidity).
    Dew point temperature(derived from temperature and humidity)
    Temperature trend(derived from recent temperature readings)
    Barometric pressure trend(derived from recent pressure readings)
    The user can request the system to report the highest and lowest values of any of the four primary measurements during the previous 24 hour period.
    The user has a screen display that continuously indicates all nine primary and derived measurements, as well as the current time and date.
    The user may direct the system to display the 24 hour maximum or minimum values of one primary measurement, together with the time of that report value.
    The user will be able to calibrate the sensors against known values and to set the current time and date.

  • Could someone explain the Factory Method Design Pattern

    Hi Experts.
    Could someone please explain for me the Factory Method Design Pattern. I read it a little and I understand that it is used in JDBC drivers but i'm not clear on it.
    Could someone explain.
    Thanks in advance
    stephen

    Basically, you have one class that's sole purpose is to create instances of a set of other classes.
    What will usually happen is you have a set of related classes that inherit from some base class. We'll say for example that you have a base class CAR and it has sub-classes FORD, GM, HONDA (sorry Crylser). Instead of having the user call the constructors for FORD, GM, and HONDA, you can give the user a Factory Class that will give him a copy. We'll call our factory class Dealership. Inside dealership, you can have a static function :
    public static Car makeCar(String type)
    if(type.equals("FORD")
    return new FORD();
    else if(type.equals("GM")
    return new GM();
    else if(type.equals("HONDA")
    return new HONDA();
    So when the user needs a car, they will just call
    Dealership.makeCar("FORD").
    This is a good way to hide the implementation of your classes from the user, or if you require complex initialization of your objects.
    Another good example of this is in the Swing library. To get a border around a component, you call static methods on BorderFactory.
    Hope this helped.
    Ed

Maybe you are looking for