JADE Environment Development Ideas

What's new in the upcoming JADE release?

IMPROVED DEVELOPER EFFICIENCY. ENHANCED SECURITY. SMOOTHER INTEGRATION

The JADE 2022 release meets tomorrow’s business demands.


Start your update to JADE's latest release

Edition updates on objects when not required

It would be nice if Jade could work out if an object needs updating if it has changed. An example of this is attached. Why has the Object increased the edition the attribute is the same. To get around this we have to put in "if oldValue <> newValue then - do the update". It would streamline our code base if we didn't have to do this check first and we could be confident an object won't be changed/locked unless its attribute is changing.


  • Sam Stokell
  • Nov 7 2023
  • Needs review
  • Attach files
  • BeeJay commented
    November 09, 2023 22:49

    Nice idea. In the interim, you can simplify the repeated boiler plate code by creating your own "setValue" method on the Object class:

    setValue( currentValue : Any io; newValue : Any );
    

    begin
    // Only set the new value if it has changed
    // to avoid unnecessary object edition changes
    if currentValue <> newValue then
    currentValue := newValue;
    endif;
    end;


    Repeated boiler plate version of code:

    updateNames( pFirstName : String; pSurname : String ) updating;
    

    begin
    if self.firstName <> pFirstName then
    self.firstName := pFirstName;
    endif;

    if self.surname <> pSurname then
    self.surname := pSurname;
    endif;
    end;


    Simplified code:

    updateNames( pFirstName : String; pSurname : String ) updating;
    

    begin
    self.setValue( self.firstName, pFirstName );
    self.setValue( self.surname, pSurname );
    end;

    Of course, feel free to use a method name which is suitable for your development standards if you don't like setValue as the method name.

    Hope that helps,
    BeeJay.