You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Maarten Billemont (JIRA)" <ji...@apache.org> on 2010/08/13 13:34:19 UTC

[jira] Created: (WICKET-2986) Feedback messages should be String not Serializable.

Feedback messages should be String not Serializable.
----------------------------------------------------

                 Key: WICKET-2986
                 URL: https://issues.apache.org/jira/browse/WICKET-2986
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.4.10
            Reporter: Maarten Billemont


Component#error currently accepts a Serializable as message parameter.  This is inconsistent with #info, #fatal and #warn.  What's more, Serializable is a really bad idea, because a message should always be a String, not a random object that can be toString'ed.

toString is really bad practice for generating messages for user consumption.
1. It (generally) bleeds implementation details.
2. It (generally) isn't localized and often impossible to localize.

That also means FeedbackMessage#message should be a String and not a Serializable, for the exact same reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-2986) Feedback messages should be String not Serializable.

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2986:
----------------------------------

    Issue Type: Improvement  (was: Bug)
      Priority: Minor  (was: Major)

> Feedback messages should be String not Serializable.
> ----------------------------------------------------
>
>                 Key: WICKET-2986
>                 URL: https://issues.apache.org/jira/browse/WICKET-2986
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.4.10
>            Reporter: Maarten Billemont
>            Priority: Minor
>
> Component#error currently accepts a Serializable as message parameter.  This is inconsistent with #info, #fatal and #warn.  What's more, Serializable is a really bad idea, because a message should always be a String, not a random object that can be toString'ed.
> toString is really bad practice for generating messages for user consumption.
> 1. It (generally) bleeds implementation details.
> 2. It (generally) isn't localized and often impossible to localize.
> That also means FeedbackMessage#message should be a String and not a Serializable, for the exact same reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2986) Feedback messages should be String not Serializable.

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902136#action_12902136 ] 

Igor Vaynberg commented on WICKET-2986:
---------------------------------------

this does offer the flexibility to build custom feedback panels that work on more then just text messages.

some examples that come to mind:

error object includes an icon to be shown next to the message
error object includes a category by which errors are grouped

maybe we should change info/rest to take serializable as well.

> Feedback messages should be String not Serializable.
> ----------------------------------------------------
>
>                 Key: WICKET-2986
>                 URL: https://issues.apache.org/jira/browse/WICKET-2986
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.4.10
>            Reporter: Maarten Billemont
>            Priority: Minor
>
> Component#error currently accepts a Serializable as message parameter.  This is inconsistent with #info, #fatal and #warn.  What's more, Serializable is a really bad idea, because a message should always be a String, not a random object that can be toString'ed.
> toString is really bad practice for generating messages for user consumption.
> 1. It (generally) bleeds implementation details.
> 2. It (generally) isn't localized and often impossible to localize.
> That also means FeedbackMessage#message should be a String and not a Serializable, for the exact same reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2986) Feedback messages should be String not Serializable.

Posted by "Maarten Billemont (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898224#action_12898224 ] 

Maarten Billemont commented on WICKET-2986:
-------------------------------------------

If I understand you well, you want to generate a message based on a context object.

Answer me these:

1. Why do you want to put the logic of generating a message for all sorts of different objects in #newMessageDisplayComponent?  Always put logic as near as possible to the object that is responsible for what you're generating.  In this case, put your logic in your context object.

2. Why do you need to evaluate this so lazily?  It makes far more sense to convert your object into a message when you add it to the component, instead of adding a context to a component and converting it to a message later.  This lazy evaluation gains you nothing but makes your code significantly more complex.

3. How are you going to localize this?

I don't think your use case poses any usefulness worth making the API more complex.

> Feedback messages should be String not Serializable.
> ----------------------------------------------------
>
>                 Key: WICKET-2986
>                 URL: https://issues.apache.org/jira/browse/WICKET-2986
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.10
>            Reporter: Maarten Billemont
>
> Component#error currently accepts a Serializable as message parameter.  This is inconsistent with #info, #fatal and #warn.  What's more, Serializable is a really bad idea, because a message should always be a String, not a random object that can be toString'ed.
> toString is really bad practice for generating messages for user consumption.
> 1. It (generally) bleeds implementation details.
> 2. It (generally) isn't localized and often impossible to localize.
> That also means FeedbackMessage#message should be a String and not a Serializable, for the exact same reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2986) Feedback messages should be String not Serializable.

Posted by "Thomas Götz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902137#action_12902137 ] 

Thomas Götz commented on WICKET-2986:
-------------------------------------

I would greatly appreciate that. The usecases you mentioned are exactly what we are already doing with the feedback messages. Currently we are limited to error messages though (including metadata) ;-)

> Feedback messages should be String not Serializable.
> ----------------------------------------------------
>
>                 Key: WICKET-2986
>                 URL: https://issues.apache.org/jira/browse/WICKET-2986
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.4.10
>            Reporter: Maarten Billemont
>            Priority: Minor
>
> Component#error currently accepts a Serializable as message parameter.  This is inconsistent with #info, #fatal and #warn.  What's more, Serializable is a really bad idea, because a message should always be a String, not a random object that can be toString'ed.
> toString is really bad practice for generating messages for user consumption.
> 1. It (generally) bleeds implementation details.
> 2. It (generally) isn't localized and often impossible to localize.
> That also means FeedbackMessage#message should be a String and not a Serializable, for the exact same reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-2986) Feedback messages should be String not Serializable.

Posted by "Thomas Götz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898201#action_12898201 ] 

Thomas Götz commented on WICKET-2986:
-------------------------------------

As already discussed in the #wicket channel, I see your point but also think that Serializable is of more general use. Maybe one could think of some other possibility, e.g. having the ability to attach some metadata to the FeedbackMessage ...

In my usecase, I throw in some specialized object to error(Serializable s), get it back in FeedbackPanel.newMessageDisplayComponent(String id, FeedbackMessage message), which I override for a special feedbackpanel, and then can get the metadata back and do whatever stuff with it.

As I am free to override newMessageDisplayComponent() I think it's also acceptable to go with an own implementation there and do with the message whatever I decide to do. But you are also right if you mention type safety. So maybe some metadata attached to FeedbackMessage? e.g. Component.error(String message, Object data) ...? Just thinking loud, maybe there's also other solutions to this.

> Feedback messages should be String not Serializable.
> ----------------------------------------------------
>
>                 Key: WICKET-2986
>                 URL: https://issues.apache.org/jira/browse/WICKET-2986
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4.10
>            Reporter: Maarten Billemont
>
> Component#error currently accepts a Serializable as message parameter.  This is inconsistent with #info, #fatal and #warn.  What's more, Serializable is a really bad idea, because a message should always be a String, not a random object that can be toString'ed.
> toString is really bad practice for generating messages for user consumption.
> 1. It (generally) bleeds implementation details.
> 2. It (generally) isn't localized and often impossible to localize.
> That also means FeedbackMessage#message should be a String and not a Serializable, for the exact same reasons.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.