Flex design pattern for BlazeDS transfer objects

Dear Community,
I have a question regarding the nature of objects transferd from BlazeDS backend to the Flex client.
According to some adobe docs all the presentation logic should be in flex and BlazeDS should provide only services.
The question is what kind of transfer objects should be used? with what level of abstraction?
To make it more clear let's talk about a simple forum application like adobe forums.
I have created a Forum service, which returns a Forum transfer object, which has a List of Threads, with each thread having a List of Messages.
Flex gets the Forum transfer object and does all the presentaiton work.
This is a very nice seperatin of concerns architecture BUT there are two major performance issues:
- when the forum becomes bigger the transfer object will be huge
- the flex will use huge client resources to create the presentation of the forum transfer object.
So my question is what is your strategy/ design pattern for such a problem.
An obvious answer would be create services that include the presentation logic and use transfor objects like ThreadListPage which will include only the first 10 threads.
Thanks in advance

I think you are going to get a few varied types of answers to a general question like this, but I will comment on a few things.  First, you should only be transmitting the data that you need to use or display to the user at the time.  If this forum was implemented in Flex (I wish) you wouldn't transfer the text for all the threads.  You might not transfer the thread text at all (just the subjects), you'd make calls back to the server to fetch that data when and if you need it.
Also, I think you are overestimating the resources required for the Flex "presentation layer".  If you think about it, these workstations we have here are pretty idle most of the time when you're at a website.  Nowadays there's plenty of processing power just sitting there waiting, so as long as your design isn't flawed the CPU or memory are rarely going to be a bottleneck with Flex.
The way I design, BlazeDS (or GraniteDS etc) should mostly just be "serving data".  There is some flexibility available, for example I don't see a problem with putting certain types of business rules (such as a limit on the number of results that can be recieved in a search) within server side code, and validation rules on the Flex side.  So there's not too many "industry standards" in Flex yet beyond maybe what's done in the various standard architectures, at least not that I'm aware of.
You might find it beneficial to look into some of the various frameworks/architectures available like Cairngorm, Mate, Swiz, and so on.  Learning how they work (looking at examples) would probably answer some of your questions too.

Similar Messages

  • What is the best design pattern for this problem?

    No code to go with the question. I am trying to settle on the best design pattern for the problem before I code. I want to use an Object Oriented approach.
    I have included a basic UML diagram of what I was thinking so far. 
    Stated simply, I have three devices; Module, Wired Modem, and Wireless Modem.
    In the Device Under Test parent class, I have put the attributes that are variable from device to device, but common to all of them.
    In the child classes, I have put the attributes that are not variable to each copy of that device. The attributes are common across device types. I was planning to use controls in the class definition that have the data set to a default value, since it doesn't change for each serial number of that device. For example, a Module will always have a Device Type ID of 1. These values are used to query the database.
    An example query would be [DHR].[GetDeviceActiveVersions] '39288', 1, '4/26/2012 12:18:52 PM'
    The '1' is the device type ID, the 39288 is the serial number, and the return would be "A000" or "S002", for example.
    So, I would be pulling the Serial Number and Device Type ID from the Device Under Test parent and child, and passing them to the Database using a SQL string stored in the control of the Active Versions child class of Database.
    The overall idea is that the same data is used to send multiple queries to the database and receiving back various data that I then evaluate for pass of fail, and for date order.
    What I can't settle on is the approach. Should it be a Strategy pattern, A Chain of Command pattern, a Decorator pattern or something else. 
    Ideas?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Is there a design pattern for this?

    I'm looking for a solution to a design problem I have.
    For a restaurant booking system I need a number of different opening times describing when you can and cannot book. These opening times are essentially Jodatime Period objects. There's a set of opening times spanning a week and these are repeated for every week (a default set of opening times) however it's possible to override these opening times say for a specific day.
    The domain model would be something like a Restaurant class holding 2 Lists of OpeningTime objects one for defaultOpeningTimes and the other for overiddenOpeningTimes the overidden ones get used if they exist for the requested time period. However the database model would be a bit messy as I'd have 2 lists mapping to the same table (OpeningTime). Is that a good idea? Perhaps there's a design pattern for this, if someone could point me in the right direction I'd be very grateful, or perhaps this is the best solution? Thanks!

    jduprez wrote:
    But why do you put the logic in the database too (I'm no DB expert and I didn't know these concepts until I read your post, but that's what a dynamic view based on derived values looks like to me): performance (1 round-trip instead of two)?Hi jduprez. Long time no speakee.
    I guess part of it is that I spent many years as a DBA and modeller, and really appreciate what it's taught me about design. Also, databases are (or should be) designed from the ground up to provide data-directed requests optimally, and include all sorts of nice stuff like transaction handling that aid consistency, as well as speed.
    That said: I HATE SQL. Think Coliseum, with that emblazoned in 60-foot high letters around its walls, and it might come close to just how much I hate that so-called "language". I hate its form; I hate it's inconsistencies; I hate the fact that something like what OP is trying to do is NOT an easy task (and might involve the creation of a table that simply contains Dates, just in order to satisfy Boolean logic).
    However, once you work it out, a database view (at least from the database's standpoint; JDBC I'm not so sure about) is just like any other Table - and that I DO like.
    Programs are good at processing parameterized (ugh) temporal information; databases are good at persistence and high volume. Those two may meet at some point, but I reckon it's going to take another Codd (or Joda) before it does.
    - that's clearer to 90% of the dev team (my biased numbers, based on 50% of Java developers having decent knowledge of SQL and much less than that having the advanced SQL knowledge which I rank your suggestion at)Sounds to me like you'll get the solution that matches the skills you have then. Is that what you really want, if a better one is available?
    - that doesn't require investigating the if of your suggestion (JDBC support)Agreed, but only because my JDBC knowledge isn't what it could be. I'd also be surprised if it doesn't support access to a named view, since they were designed to be equivalent to Tables.
    - the Op is using DAOs, so it's possible, if profiling does show this is hampering performances, to change that with no impact on the client code that calls the DAO.There's no doubt that a database solution is much higher level than a programming one; but, as I said, it's what they were designed to do. And tinkering around with program optimization has the feel of a "hacker's solution" to me. Not that there's any particular problem with that - I do it quite often when I have no control over my source - but I also try to keep in mind what the "actual" problem is.
    Winston

  • Design Pattern for Controlling Uniqueness

    Hi,
    I'm looking for a good design pattern for controlling uniqueness. E.g. I have classes representig a particular database relation. The constructor has the database key(s) as parameter(s). For the other attributes there are corresponding setter and getter methods.
    How can I make sure, that I have only one instance with key(s) foo in my system?
    Of course I have some ideas but I'm not sure if that is the best thing I could do. So I could use a map, to map the keys to the tuples.
    This map could be in another class foo2 which creates the objects of foo1 (which has only a protected or package-private constructor).
    Or I could place the map into foo1 itself as a static variable, and add a static factory method. The constructors would then be protected or private. Are these solutions good? Which one to prefer?
    How can I handle other unique attributes (not part of the key)?
    The equals method for such a class could then test the keys only, since there is only one object with such a key in the system, right?
    Thanks for any help.
    Greets
    Puce

    The class could have only private constructors and a public static getter method, which would decide based on some collection of the object created so far, whether to create a new one or give an old one.

  • Flex design patterns

    Hi ,I would like to convert a existing struts application to
    flex ,the current application has different modules,ie different
    screens when converting to flex should the UI just be one mxml or
    how should the segragation of module based UI's be done.
    Are there any resources available for design patterns for
    Flex 3.

    I think you should look at this '
    http://www.davidtucker.net/category/cairngorm/'
    an excellent tutorial for 'Cairngorm' framework

  • Design pattern for IFS

    Hi,
    I am new to Oracle IFS. I just want to know Is there any proven design pattern for IFS application development.

    The class could have only private constructors and a public static getter method, which would decide based on some collection of the object created so far, whether to create a new one or give an old one.

  • Choice of design pattern for data acquisition system

    Hello all
    I have a trouble about selecting the suitable design pattern / architecture for a data acquisition system. 
    Here is the details of the desired system:
    There is data acquisition hardware and I need to use it by observing parameters on User interface. 
    the data acquisiton period, channel list to scan should be chosen on User interface. Besides, there are many user interface interactions. e.g. if user selects a channel to add scanlist, then I need to enable and make visible some other parts on user interface. 
    When user completes the channel selection, then he will press the button to start data acquisition. Then I also need to show the scanned values on a graph in real time and log them in txt file.
    I know that I cannot use producer consumer pattern here. because the data acquisition loop should wait for parameters to scan channels. and it works in a given period by user. so the user interface loop performs higher rate then consumer loop (data acquisition loop). it means queue will be bigger bigger. if I use notifier it will loss some data come from user interface. 
    is there any idea about that ? is there any suitable design pattern for this case ? 
    Thanks in advance
    best regards 
    Veli BAYAR
    Embedded Systems Software and Hardware Engineer 
    "You live in a graphical world. Why not program in one?"
    Solved!
    Go to Solution.

    johnsold wrote:
    Veli,
    I recommend the Producer/Consumer model with some modifications.
    You might need three loops.  I cannot tell for sure from your brief description.
    The User Interface loop responds to the user inputs for configuration and start/stop of acquisition.  The parameters and commands are passed to the Data Acquisition loop via a queue. In this loop is a state machine which has Idle, Configuration, Acquisition, and Shutdown states (and perhaps others). The data is sent to the Processing loop via a different queue. The Processing loop performs any data processing, displays the data to the user, and saves it to file. A notifier can be used to send the Stop or shutdown command from the User Interface loop to the other loops.  If the amount of processing is minimal and the file write times are not too long, the Processing loop functions might be able to occur in the Timeout case of the UI loop Event structure.  This simplifies things somewhat but is not as flexible when changes need to be made.
    I am not sure that a Design Pattern for this exact setup exists but it is basically a combination of the Producer/Consumer (Events) and Producer/Consumer (Data) Design Patterns.
    Lynn
    Check out this thread: http://forums.ni.com/t5/LabVIEW/Multiple-poll-case-structures-to-event-help/td-p/2551309
    There are discussions there about a 3-loop architecture that may help you.
    Jeff
    Jeffrey Zola

  • Design Pattern for execution queue

    Anyone know of any good design patterns for using a JMS Queue and MDB's
              as async
              execution queue which maintains execution order by some key
              

    Enforced ordering on redelivery will be supported in the
              next release, but only if the application clamps the pipe-line
              size down to its minimum and the MDB pool size down to one.
              I don't think enforced ordering is supported in the current release.
              We are looking at least partially addressing the general design
              pattern below in the release after next. I don't think I can
              get away with being more specific. (Sorry.) Currently, I
              think something along the line of Larry's solution is the only way to
              accomplish it. Interestingly, the recent thread started
              by "[email protected]" on correlating requests and responses
              seems to be somewhat related.
              Tom, BEA
              Larry Presswood wrote:
              > Well you are both correct however we have something which works
              > however it does involve some threading primitives which generally is not
              > a good idea
              > inside wlas but seems to work.
              >
              >
              > Generally have a singleton on the server which has slots for each key
              > with message
              > numbering for each message and force a wait if message for key is out of
              > order
              > during fifo processing rules. IE do what things you can do in parallel
              > but gate for
              > the last step.
              >
              > I think there is a general remote execution pattern out there.
              >
              > The general problem to solve is this:
              >
              > In a messaging system you want to process messages for each key/session
              > in order however
              > with a large number of sessions its possible to parallel messages for
              > different sessions
              >
              > Otherewise you can either create custom queues or a topic with a
              > selector and then
              > create custom consumers which does not behave as well from a resource
              > perspective
              > as MDB's do.
              >
              >
              >
              >
              >
              >
              >
              > Nick Minutello wrote:
              >
              >>I may be completely wrong - but I think that Larry is referring to the inherant
              >>out-of-order message consumption that you get when using MDB pools to consume
              >>from a Queue.
              >>
              >>In short, the only design pattern here is to deploy the MDB to only one machine
              >>in the cluster - and set the pool size to 1.
              >>
              >>In-order execution is incompatible with the parallel execution that MDB's give
              >>you.
              >>
              >>-Nick
              >>
              >>
              >>
              >>Tom Barnes <[email protected]> wrote:
              >>
              >>
              >>>Hi Larry,
              >>>
              >>>Generally, I think it is best to have a seperate queue per key if the
              >>>
              >>>number of keys is small. This prevents starvation of a particular
              >>>message. For example when handling message-priority, low priority gets
              >>>
              >>>an MDB pool of size 1, high priority gets and MDB pool of size 10.
              >>>
              >>>Note that WebLogic JMS allows a queue to specify a sort-order keys based
              >>>on arbitrary message fields. Note that the in-flight message pipe-line
              >>>
              >>>between server and asynchronous clients is unsorted.
              >>>
              >>>Tom, BEA
              >>>
              >>>Larry Presswood wrote:
              >>>
              >>>
              >>>>Anyone know of any good design patterns for using a JMS Queue and MDB's
              >>>>
              >>>>
              >>>>as async
              >>>>execution queue which maintains execution order by some key
              >>>>
              >>>>
              >>>>
              >>
              >>
              >>
              >
              

  • Design pattern for unprotecting and reprotecting sheets with VBA?

    Many macros can't run when a worksheet is protected, so when I develop an Excel workbook that has protected worksheets, I have to unprotect worksheets when macros are called and then reprotect the worksheets once the macro has completed.
    The current design pattern I use for this is the following:
    I look at each procedure individually and consider which sheets need to be unprotected for it to run. Then in each procedure I write:
    Sub Test()
    Dim bSheet1Protected as boolean
    Dim bSheet2Protected as boolean
    bSheet1Protected = Sheet1.ProtectContents
    bSheet2Protected = Sheet1.ProtectContents
    bSheet1Protected.Unprotect
    bSheet2Protected.Unprotect
    '''The rest of my code
    if bSheet1Protected then Sheet1.Protect
    if bSheet2Protected then Sheet2.Protect
    End Sub
    But I imagine that maybe there are better ways of doing this. What is your preferred design pattern for unprotecting and reprotecting sheets with VBA?

    Hi JP3O,
    I think it is a good practice to unprotect the worksheet before execute some code and protect it back after the code execute finished.
    >>But I imagine that maybe there are better ways of doing this. What is your preferred design pattern for unprotecting and reprotecting sheets with VBA?<<
    I am not able to find a better way since we always need to unproect the worksheet if some code didn't not executed successful when the worksheet is proected.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • What is the best design pattern for top-down ws development..?

    Hi,
    What is the best design pattern for top-down development+ wsdl2service....?

    elrathia wrote:
    Hi Ben,
    I haven't much idea of how override works and when you would use it and why. I'm the newest of the new here. 
    Good. At least you will not be smaking with a OPPer dOOPer hammer if I make some gramatical mistake.
    You may want to look at this thread in the BreakPoint where i trie to help Cory get a handle on Dynamic Dispatching with an example of two classes that inherit from a common parent and invoke Over-ride VIs to do the same thing but with wildly varying results.
    The example uses a Class of "Numeric"  and a sibling class "Text" and the both implement an Add method.
    It is dirt simple and Cory did a decent job of explaining it.
    It just be the motivation you are looking for.
    have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Design Pattern For Web Services.

    I tried asking siomilar questions in WebService Forum but didn'y got any replies.
    Can anybody tell me what should be the Design for Web Services.
    I have understanding that there can be just 1 Interface/Implementation class for each Web Service, and which will have 1 end point.So for evry such Interface we will have to have 1 Web Service.
    Can someone please clarify wheather I'm correct or not ?
    I guess that If my application has many Interfaces and I have to expose the application as Web Service.Then I will have to expose all methods from one Interface and then expose this new Interface as Web Service.
    Is this how WS will work.
    Any pointers to design PATTERNS for Web Service will be highly appreciated.
    Thanks
    Rahul

    I don't know if anyone has documented new patterns specifically aimed at web services but the old ones definitely apply. Like you were alluding to, there is a letter-envelope decoupling of interface and implementation with the XML WSDL interface and coded implementation.

  • Design pattern for converting multiple complex Java objects to XML

    What is the traditionally accepted high performance mechanism for converting Java objects to XML? Some options I have explored are:
    1. SAX-JAXP
    2. DOM-JAXP
    3. JAXB
    4. Castor
    Which of these usually performs the best for large, complex objects which contain multiple subobjects?
    Thanks.

    Take a look at XStream. It will simplify your life considerably.
    Typical code snipped
    XStream xStream = new XStream();
    xStream.toXML(someJavaObject);That's it. Regarding the others...
    1. SAX-JAXP
    Can be used for XML -> Java Objects, but you have to write significant amounts of ugly, high maintainenance code
    2. DOM-JAXP
    Slower and more memory intensive than SAX because you need to read the whole object into memory first. Just as ugly and high maintenance.
    3. JAXB
    Actually very good for going from a POJO to XML, but rubbish in the opposite direction. The worst part is it adds an extra step to your build process as you need to tell it to generate and compile the source for doing this.
    4. Castor
    Not used it since JAXB came out. Works pretty much in the same way but also supports XML -> POJOs.

  • Design patterns for Dynamic Class Loading

    Hi,
    I have to develop a program for uni that dynamically loads classes based on names in a text file. All the classes subclass an abstract class with a constructor that takes one argument. This means I can't use the Class.forName(className).newInstance() method of class loading. I have researched some design patterns I could use and have come up with the following 3:
    Factory pattern; "Robocode" pattern (not it's real name, but Robocode uses it); and, the "one I made up myself" pattern.
    The robocode pattern instantiates a class using the default no-argument constructor then immediately sets all properties that shoud have been provided in the constructor:
    Object o = Class.forName(myClass).newInstance();
    o.setProperty(property);Personally I think this is ugly and a cheap fix instead of doing it properly.
    My own pattern finds the constructor that takes the arguments I need then calls it to create the object:
    Class c = Class.forName(myClass);
    Constructor cons = c.getConstructor(new Class[]{Class.forName("java.lang.String")});
    Object o = cons.newInstance(new Object[]{"hello"});What's the best to use? Are there any other patterns I should consider?

    My own pattern finds the constructor that takes the
    arguments I need then calls it to create the object:
    Class c = Class.forName(myClass);
    Constructor cons = c.getConstructor(new
    Class[]{Class.forName("java.lang.String")});
    Object o = cons.newInstance(new Object[]{"hello"});
    I have followed this basic 'pattern' several times though I would use
    Constructor cons = c.getConstructor(new Class[]{String.class});
    It works great.

  • Possible design patterns for base function with possible additions

    I have various interfaces i have to implement. Let's assume ITypeA, ITypeB. They have following methods:
    ITypeA
    Connect
    Disconnect
    GetData
    SetData
    ClearData
    ITypeB
    Connect
    Disconnect
    GetData
    SetData
    Start
    Pause
    Stop
    They have some base functionality: Connect, Disconnect, GetData and SetData.
    If I want to add ITypeC in the future, it will have these base functionality too.
    I want to access to the base functionality and if there is additional functionality, I want to get this too. What design patterns are available that are capable of this situations?
    I found one here: Extension Interface. In this, you create a base
    interface and multiple extension interfaces that are implementing the additional functions. In the base interface you can ask for the available extension interfaces of the component. But this approach seems complicated: I have to create interfaces for each
    type, factories for the interfaces, I need some tables to save what Interface belongs to what Factory...
    What is the basic solution for this problem? Extension Interfaces? Are there any other possible alternatives for my problem?

    You may have more joy dividing your interfaces by behaviour and deciding on the types later.
    interface IConnectable
    Connect
    Disconnect
    interface IDataTransferrable
    GetData
    SetData
    interface IPlayable
    Start
    Pause
    Stop
    class TypeA : IConnectable, IDataTransferrable
    class TypeB : IConnectable, IDataTransferrable, IPlayable
    And then how can discover if your object supports these interfaces?
    here's one way:
    if (ob is IPlayable)
    Playback(ob);
    where you have a function:
    void Playback(IPlayable ob)

  • Design Pattern for multithreaded client server program

    I asked this question in another post, but with other stuff, so I'll distill this one.
    I am creating a multi-threaded client server program (just for learning - a chat program at this point). I built the server and client in swing, and I'm wondering what the best design pattern is for this setup. Right now all the swing stuff is in the MyServer class. In that class I have a loop accepting client connections to the serverSocket and creating a new MyServerThread (threaded client connection).
    The problem is that all the work of creating input streams, interacting with the server, all that stuff is done in the MyServerThread class, but I want that text to be written up to the Swing objects - which is in the MyServer class. So right now in the MyServerThread class I pass the MyServer object into it, but I'm not sure if that is really the most robust thing to do. Does anybody have any suggestions as to how this should be done. If somebody has an article they'd like to point to I'll check it out too. But if it's just the run-of-the-mill multithreaded client-server article, I've read alot and most don't specifically address my question.

    Thanks for the reply Kaj, and I think I'll keep my design for now, since it's just quick and dirty. I've read the MVC concept a while ago and I'll revisit it again when I get more serious. But I have a question, why should I be using a callback interface, why an interface at all? And then make MyServer implement that interface...why not just pass MyServer to the thread object? Or is there something down the line that I did not forsee?

Maybe you are looking for