Loading ...
Sorry, an error occurred while loading the content.

2683Re: Connection Mngr: How many callback objects should be used in an app?

Expand Messages
  • Thomas S. Sha
    Jun 29, 2006
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, "than505" <than505@...> wrote:
      > Each line might list a contacts name, another line the various
      > locations of a given contact. Each of these has 2 buttons, an "edit"
      > button (calls a function which replaces the contact's name on the
      > screen with 2 text
      > boxes for the first/last names) and an "update" button to send to the
      > server.
      > The problem I am finding is that because I have various buttons for
      > editing/updating info, each of these calls a different function which
      > then needs another callback object to deal with the server reponse.

      If you have n number of buttons, but there are only two types -- edit
      and update -- it seems to me you could normalise the edit and update
      functions. Can you provide an example code for a function called on
      button click?

      > I am starting to get over a dozen callback objects. Am I using this
      > Y!CM in the wrong way?

      If you have a dozen disparate tasks within a persistent UI, this
      doesn't seem to be out of bounds, but the task you've described
      suggests perhaps a callback(or a few) can be shared to accomodate
      common tasks?

      > How many callback objects should one be using in a smallish
      > application? And is it recommended to use what I have read are
      > "namespaces" to avoid placing so many functions/callback objects in
      > the global scope?

      If the application is entirely within your purview, then probably not.
      If there is any possibility of the application scaling up, reuse, or
      other developers contributing to the project, then you might consider
      aggregating the callbacks into some sort of "map"; or, namespace your
      application with your callbacks under its scope.

    • Show all 3 messages in this topic