Uploaded image for project: 'Grouper'
  1. Grouper
  2. GRP-140

setters on business objects should not have database side effects

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 1.4.0
    • 1.3.0
    • API
    • None

    Description

      calling some setters (e.g. group.setExtension()) will store the data to the database inside the setter.

      This is not ideal because:

      1. It is generally not expected that setters store data
      2. It could be more efficient to have one store method, e.g.

      group.setAttribute("something", "whatever");
      group.setExtension("ext");
      group.setDisplayExtension("disp ext");
      group.store();

      3. For hooks, the hooks would fire with each setter, instead of potentially one hook for all the activity
      4. Although there are still methods that cause database side effects, generally it is better to explicitly kick that off with the DB api or a store() method
      5. Multiple calls to setters should occur in one transaction

      Attachments

        Activity

          People

            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            chris.hyzer@at.internet2.edu Chris Hyzer (upenn.edu)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: