class mapping E10: Avoid serializing JavaScript properties not part of Java class

View: New views
6 Messages — Rating Filter:   Alert me  

class mapping E10: Avoid serializing JavaScript properties not part of Java class

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's a mail thread for Randy's suggestion (included below).
 
One suggestion for how to solve this is adding information about members in our generated mapped classes (see *):
 
    if (typeof db.Person != 'function') { 
        db.
Person = function() {
            this.myProp1 = <initial value>
            this.myProp2 = <initial value>
        }
    }
    db.Person["$dwrclassname"] = "db.Person";
*  db.Person["$dwrclassmembers"] = { myProp1:true, myProp2:true };
 
Then, when engine.js does serialization of an object from a mapped class it can do
    for( element in obj.constructor["$dwrclassmembers"] )
instead of
    for( element in obj )
to only serialize the known members and not everything on the object.
 
Assigning |true| to the properties in the classmembers list is just to have some value that evaluates to true, in case someone wants to do
    if ( db.Person["$dwrclassmembers"].myProp1 )
In the future it could also be extended to carry more information about the fields, f ex data type.
 
Any comments on this?
(I can volunteer to implement this.)
 
Best regards
Mike
 
Randy said:
I’m still working through this in my head, but one other suggestion might be and if the javascript attribute is set on a convert element, in the interface js we put enough information so that engine.js knows what attributes it need to serialized. This could drastically increase performance for instances like mine where my api’s objects have a lot of “private” attributes that don’t need to be sent to the server (and would just be dropped on the floor when they got there).
 
Joe said:
That makes sense to me, there are times when I would have used that.

Parent Message unknown Re: class mapping E10: Avoid serializing JavaScript properties not part of Java class

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've created: http://bugs.directwebremoting.org/bugs/browse/DWR-267
One request: could we call them $dwrClassName and $dwrClassMembers?

Joe.

On Fri, Jul 11, 2008 at 12:54 PM, Mike Wilson <mikewse@...> wrote:
Here's a mail thread for Randy's suggestion (included below).
 
One suggestion for how to solve this is adding information about members in our generated mapped classes (see *):
 
    if (typeof db.Person != 'function') { 
        db.
Person = function() {
            this.myProp1 = <initial value>
            this.myProp2 = <initial value>
        }
    }
    db.Person["$dwrclassname"] = "db.Person";
*  db.Person["$dwrclassmembers"] = { myProp1:true, myProp2:true };
 
Then, when engine.js does serialization of an object from a mapped class it can do
    for( element in obj.constructor["$dwrclassmembers"] )
instead of
    for( element in obj )
to only serialize the known members and not everything on the object.
 
Assigning |true| to the properties in the classmembers list is just to have some value that evaluates to true, in case someone wants to do
    if ( db.Person["$dwrclassmembers"].myProp1 )
In the future it could also be extended to carry more information about the fields, f ex data type.
 
Any comments on this?
(I can volunteer to implement this.)
 
Best regards
Mike
 
Randy said:
I'm still working through this in my head, but one other suggestion might be and if the javascript attribute is set on a convert element, in the interface js we put enough information so that engine.js knows what attributes it need to serialized. This could drastically increase performance for instances like mine where my api's objects have a lot of "private" attributes that don't need to be sent to the server (and would just be dropped on the floor when they got there).
 
Joe said:
That makes sense to me, there are times when I would have used that.


RE: class mapping E10: Avoid serializing JavaScript properties not part of Java class

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sure, no probs.
 
Best regards
Mike


From: joseph.walker@... [mailto:joseph.walker@...] On Behalf Of Joe Walker
Sent: den 11 juli 2008 16:28
To: users@...
Subject: Re: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class


I've created: http://bugs.directwebremoting.org/bugs/browse/DWR-267
One request: could we call them $dwrClassName and $dwrClassMembers?

Joe.

On Fri, Jul 11, 2008 at 12:54 PM, Mike Wilson <mikewse@...> wrote:
Here's a mail thread for Randy's suggestion (included below).
 
One suggestion for how to solve this is adding information about members in our generated mapped classes (see *):
 
    if (typeof db.Person != 'function') { 
        db.
Person = function() {
            this.myProp1 = <initial value>
            this.myProp2 = <initial value>
        }
    }
    db.Person["$dwrclassname"] = "db.Person";
*  db.Person["$dwrclassmembers"] = { myProp1:true, myProp2:true };
 
Then, when engine.js does serialization of an object from a mapped class it can do
    for( element in obj.constructor["$dwrclassmembers"] )
instead of
    for( element in obj )
to only serialize the known members and not everything on the object.
 
Assigning |true| to the properties in the classmembers list is just to have some value that evaluates to true, in case someone wants to do
    if ( db.Person["$dwrclassmembers"].myProp1 )
In the future it could also be extended to carry more information about the fields, f ex data type.
 
Any comments on this?
(I can volunteer to implement this.)
 
Best regards
Mike
 
Randy said:
I'm still working through this in my head, but one other suggestion might be and if the javascript attribute is set on a convert element, in the interface js we put enough information so that engine.js knows what attributes it need to serialized. This could drastically increase performance for instances like mine where my api's objects have a lot of "private" attributes that don't need to be sent to the server (and would just be dropped on the floor when they got there).
 
Joe said:
That makes sense to me, there are times when I would have used that.


RE: class mapping E10: Avoid serializing JavaScript properties not part of Java class

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is now implemented and I have resolved http://bugs.directwebremoting.org/bugs/browse/DWR-267:
I have now checked in the code that implements this feature. All mapped classes will now use its own known list of properties at serialization, and ignore any other extra properties on the objects.
Best regards
Mike


From: Mike Wilson [mailto:mikewse@...]
Sent: den 13 juli 2008 21:09
To: users@...
Subject: RE: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class

Sure, no probs.
 
Best regards
Mike


From: joseph.walker@... [mailto:joseph.walker@...] On Behalf Of Joe Walker
Sent: den 11 juli 2008 16:28
To: users@...
Subject: Re: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class


I've created: http://bugs.directwebremoting.org/bugs/browse/DWR-267
One request: could we call them $dwrClassName and $dwrClassMembers?

Joe.

On Fri, Jul 11, 2008 at 12:54 PM, Mike Wilson <mikewse@...> wrote:
Here's a mail thread for Randy's suggestion (included below).
 
One suggestion for how to solve this is adding information about members in our generated mapped classes (see *):
 
    if (typeof db.Person != 'function') { 
        db.
Person = function() {
            this.myProp1 = <initial value>
            this.myProp2 = <initial value>
        }
    }
    db.Person["$dwrclassname"] = "db.Person";
*  db.Person["$dwrclassmembers"] = { myProp1:true, myProp2:true };
 
Then, when engine.js does serialization of an object from a mapped class it can do
    for( element in obj.constructor["$dwrclassmembers"] )
instead of
    for( element in obj )
to only serialize the known members and not everything on the object.
 
Assigning |true| to the properties in the classmembers list is just to have some value that evaluates to true, in case someone wants to do
    if ( db.Person["$dwrclassmembers"].myProp1 )
In the future it could also be extended to carry more information about the fields, f ex data type.
 
Any comments on this?
(I can volunteer to implement this.)
 
Best regards
Mike
 
Randy said:
I'm still working through this in my head, but one other suggestion might be and if the javascript attribute is set on a convert element, in the interface js we put enough information so that engine.js knows what attributes it need to serialized. This could drastically increase performance for instances like mine where my api's objects have a lot of "private" attributes that don't need to be sent to the server (and would just be dropped on the floor when they got there).
 
Joe said:
That makes sense to me, there are times when I would have used that.


Re: class mapping E10: Avoid serializing JavaScript properties not part of Java class

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks, Mike - I've just been looking through your check-ins and they all look very good. I've not played yet though.

Have you seen the test-dwr project (alongside dwr in svn)
I'm trying to add tests to that as I make changes.

Joe.


On Tue, Aug 12, 2008 at 1:39 PM, Mike Wilson <mikewse@...> wrote:
This is now implemented and I have resolved http://bugs.directwebremoting.org/bugs/browse/DWR-267:
I have now checked in the code that implements this feature. All mapped classes will now use its own known list of properties at serialization, and ignore any other extra properties on the objects.
Best regards
Mike


From: Mike Wilson [mailto:mikewse@...]
Sent: den 13 juli 2008 21:09Subject: RE: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class

Sure, no probs.
 
Best regards
Mike


From: joseph.walker@... [mailto:joseph.walker@...] On Behalf Of Joe Walker
Sent: den 11 juli 2008 16:28
To: users@...
Subject: Re: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class


I've created: http://bugs.directwebremoting.org/bugs/browse/DWR-267
One request: could we call them $dwrClassName and $dwrClassMembers?

Joe.

On Fri, Jul 11, 2008 at 12:54 PM, Mike Wilson <mikewse@...> wrote:
Here's a mail thread for Randy's suggestion (included below).
 
One suggestion for how to solve this is adding information about members in our generated mapped classes (see *):
 
    if (typeof db.Person != 'function') { 
        db.
Person = function() {
            this.myProp1 = <initial value>
            this.myProp2 = <initial value>
        }
    }
    db.Person["$dwrclassname"] = "db.Person";
*  db.Person["$dwrclassmembers"] = { myProp1:true, myProp2:true };
 
Then, when engine.js does serialization of an object from a mapped class it can do
    for( element in obj.constructor["$dwrclassmembers"] )
instead of
    for( element in obj )
to only serialize the known members and not everything on the object.
 
Assigning |true| to the properties in the classmembers list is just to have some value that evaluates to true, in case someone wants to do
    if ( db.Person["$dwrclassmembers"].myProp1 )
In the future it could also be extended to carry more information about the fields, f ex data type.
 
Any comments on this?
(I can volunteer to implement this.)
 
Best regards
Mike
 
Randy said:
I'm still working through this in my head, but one other suggestion might be and if the javascript attribute is set on a convert element, in the interface js we put enough information so that engine.js knows what attributes it need to serialized. This could drastically increase performance for instances like mine where my api's objects have a lot of "private" attributes that don't need to be sent to the server (and would just be dropped on the floor when they got there).
 
Joe said:
That makes sense to me, there are times when I would have used that.



RE: class mapping E10: Avoid serializing JavaScript properties not part of Java class

by mikewse :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, and I've seen your mails about the testing framework. Up until feature freeze at end of August all my available time will probably be needed for adding features from my to-do list, but I hope to look at the test stuff in September. I've just started working on a new day-time project, so time is a bit short at the moment.
Best regards
Mike


From: joseph.walker@... [mailto:joseph.walker@...] On Behalf Of Joe Walker
Sent: den 13 augusti 2008 18:53
To: users@...
Subject: Re: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class


Thanks, Mike - I've just been looking through your check-ins and they all look very good. I've not played yet though.

Have you seen the test-dwr project (alongside dwr in svn)
I'm trying to add tests to that as I make changes.

Joe.


On Tue, Aug 12, 2008 at 1:39 PM, Mike Wilson <mikewse@...> wrote:
This is now implemented and I have resolved http://bugs.directwebremoting.org/bugs/browse/DWR-267:
I have now checked in the code that implements this feature. All mapped classes will now use its own known list of properties at serialization, and ignore any other extra properties on the objects.
Best regards
Mike


From: Mike Wilson [mailto:mikewse@...]
Sent: den 13 juli 2008 21:09 Subject: RE: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class

Sure, no probs.
 
Best regards
Mike


From: joseph.walker@... [mailto:joseph.walker@...] On Behalf Of Joe Walker
Sent: den 11 juli 2008 16:28
To: users@...
Subject: Re: [dwr-user] class mapping E10: Avoid serializing JavaScript properties not part of Java class


I've created: http://bugs.directwebremoting.org/bugs/browse/DWR-267
One request: could we call them $dwrClassName and $dwrClassMembers?

Joe.

On Fri, Jul 11, 2008 at 12:54 PM, Mike Wilson <mikewse@...> wrote:
Here's a mail thread for Randy's suggestion (included below).
 
One suggestion for how to solve this is adding information about members in our generated mapped classes (see *):
 
    if (typeof db.Person != 'function') { 
        db.
Person = function() {
            this.myProp1 = <initial value>
            this.myProp2 = <initial value>
        }
    }
    db.Person["$dwrclassname"] = "db.Person";
*  db.Person["$dwrclassmembers"] = { myProp1:true, myProp2:true };
 
Then, when engine.js does serialization of an object from a mapped class it can do
    for( element in obj.constructor["$dwrclassmembers"] )
instead of
    for( element in obj )
to only serialize the known members and not everything on the object.
 
Assigning |true| to the properties in the classmembers list is just to have some value that evaluates to true, in case someone wants to do
    if ( db.Person["$dwrclassmembers"].myProp1 )
In the future it could also be extended to carry more information about the fields, f ex data type.
 
Any comments on this?
(I can volunteer to implement this.)
 
Best regards
Mike
 
Randy said:
I'm still working through this in my head, but one other suggestion might be and if the javascript attribute is set on a convert element, in the interface js we put enough information so that engine.js knows what attributes it need to serialized. This could drastically increase performance for instances like mine where my api's objects have a lot of "private" attributes that don't need to be sent to the server (and would just be dropped on the floor when they got there).
 
Joe said:
That makes sense to me, there are times when I would have used that.


LightInTheBox - Buy quality products at wholesale price