You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Peter Ertl (JIRA)" <ji...@apache.org> on 2009/07/17 12:01:14 UTC

[jira] Created: (WICKET-2374) Model's factory methods are inconsistent

Model's factory methods are inconsistent
----------------------------------------

                 Key: WICKET-2374
                 URL: https://issues.apache.org/jira/browse/WICKET-2374
             Project: Wicket
          Issue Type: Improvement
          Components: wicket
            Reporter: Peter Ertl
         Attachments: model-of.patch

When looking at the factory methods of org.apache.wicket.model.Model I think that the naming of the static factory methods is not consistent:

  Model.of(Collection)
  Model.of(List) 
  Model.of(Set)
  Model.ofMap(Map)

I think it would be better to have these:

  Model.of(Collection)
  Model.ofList(List) 
  Model.ofSet(Set)
  Model.ofMap(Map)

Reasons:

 - Naming is consistent

 - When using a concrete type of collection, for example Model.ofList() for feeding a list view you don't want a different type like a Map or Set to be swapped in. From just looking at Model.of(items) you get no indication that list is required but only after getting a compile error later. I think the level of verbosity of having the type after "of" is helpful in most cases. you can get the type of collection from just looking at the method name (otherwise you have to scroll up and look for the type declaration or type some hotkey in your IDE to get the type, how cumbersome :-). if you don't need some concrete collection type you can still use Model.of(Collection).

I attached a patch to implement the proposed naming (and deprecate the previous methods)

would be great to get this in before going final :-)


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


[jira] Updated: (WICKET-2374) Model's factory methods are inconsistent

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

Peter Ertl updated WICKET-2374:
-------------------------------

    Attachment: model-of.patch

> Model's factory methods are inconsistent
> ----------------------------------------
>
>                 Key: WICKET-2374
>                 URL: https://issues.apache.org/jira/browse/WICKET-2374
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Peter Ertl
>         Attachments: model-of.patch
>
>
> When looking at the factory methods of org.apache.wicket.model.Model I think that the naming of the static factory methods is not consistent:
>   Model.of(Collection)
>   Model.of(List) 
>   Model.of(Set)
>   Model.ofMap(Map)
> I think it would be better to have these:
>   Model.of(Collection)
>   Model.ofList(List) 
>   Model.ofSet(Set)
>   Model.ofMap(Map)
> Reasons:
>  - Naming is consistent
>  - When using a concrete type of collection, for example Model.ofList() for feeding a list view you don't want a different type like a Map or Set to be swapped in. From just looking at Model.of(items) you get no indication that list is required but only after getting a compile error later. I think the level of verbosity of having the type after "of" is helpful in most cases. you can get the type of collection from just looking at the method name (otherwise you have to scroll up and look for the type declaration or type some hotkey in your IDE to get the type, how cumbersome :-). if you don't need some concrete collection type you can still use Model.of(Collection).
> I attached a patch to implement the proposed naming (and deprecate the previous methods)
> would be great to get this in before going final :-)

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


[jira] Commented: (WICKET-2374) Model's factory methods are inconsistent

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

Igor Vaynberg commented on WICKET-2374:
---------------------------------------

cant remove Map from ofMap, i added it there for a reason because the compiler was getting confused.

> Model's factory methods are inconsistent
> ----------------------------------------
>
>                 Key: WICKET-2374
>                 URL: https://issues.apache.org/jira/browse/WICKET-2374
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Peter Ertl
>         Attachments: model-of.patch
>
>
> When looking at the factory methods of org.apache.wicket.model.Model I think that the naming of the static factory methods is not consistent:
>   Model.of(Collection)
>   Model.of(List) 
>   Model.of(Set)
>   Model.ofMap(Map)
> I think it would be better to have these:
>   Model.of(Collection)
>   Model.ofList(List) 
>   Model.ofSet(Set)
>   Model.ofMap(Map)
> Reasons:
>  - Naming is consistent
>  - When using a concrete type of collection, for example Model.ofList() for feeding a list view you don't want a different type like a Map or Set to be swapped in. From just looking at Model.of(items) you get no indication that list is required but only after getting a compile error later. I think the level of verbosity of having the type after "of" is helpful in most cases. you can get the type of collection from just looking at the method name (otherwise you have to scroll up and look for the type declaration or type some hotkey in your IDE to get the type, how cumbersome :-). if you don't need some concrete collection type you can still use Model.of(Collection).
> I attached a patch to implement the proposed naming (and deprecate the previous methods)
> would be great to get this in before going final :-)

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


[jira] Commented: (WICKET-2374) Model's factory methods are inconsistent

Posted by "Peter Ertl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732868#action_12732868 ] 

Peter Ertl commented on WICKET-2374:
------------------------------------

having the types after of... will avoid any kind of compiler confusion like Igor experienced it. We all know how "great" java's generics are so I would still favor having a verbose and distinct naming

> Model's factory methods are inconsistent
> ----------------------------------------
>
>                 Key: WICKET-2374
>                 URL: https://issues.apache.org/jira/browse/WICKET-2374
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Peter Ertl
>         Attachments: model-of.patch
>
>
> When looking at the factory methods of org.apache.wicket.model.Model I think that the naming of the static factory methods is not consistent:
>   Model.of(Collection)
>   Model.of(List) 
>   Model.of(Set)
>   Model.ofMap(Map)
> I think it would be better to have these:
>   Model.of(Collection)
>   Model.ofList(List) 
>   Model.ofSet(Set)
>   Model.ofMap(Map)
> Reasons:
>  - Naming is consistent
>  - When using a concrete type of collection, for example Model.ofList() for feeding a list view you don't want a different type like a Map or Set to be swapped in. From just looking at Model.of(items) you get no indication that list is required but only after getting a compile error later. I think the level of verbosity of having the type after "of" is helpful in most cases. you can get the type of collection from just looking at the method name (otherwise you have to scroll up and look for the type declaration or type some hotkey in your IDE to get the type, how cumbersome :-). if you don't need some concrete collection type you can still use Model.of(Collection).
> I attached a patch to implement the proposed naming (and deprecate the previous methods)
> would be great to get this in before going final :-)

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


[jira] Resolved: (WICKET-2374) Model's factory methods are inconsistent

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

Igor Vaynberg resolved WICKET-2374.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.1
         Assignee: Igor Vaynberg

> Model's factory methods are inconsistent
> ----------------------------------------
>
>                 Key: WICKET-2374
>                 URL: https://issues.apache.org/jira/browse/WICKET-2374
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Peter Ertl
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.1
>
>         Attachments: model-of.patch
>
>
> When looking at the factory methods of org.apache.wicket.model.Model I think that the naming of the static factory methods is not consistent:
>   Model.of(Collection)
>   Model.of(List) 
>   Model.of(Set)
>   Model.ofMap(Map)
> I think it would be better to have these:
>   Model.of(Collection)
>   Model.ofList(List) 
>   Model.ofSet(Set)
>   Model.ofMap(Map)
> Reasons:
>  - Naming is consistent
>  - When using a concrete type of collection, for example Model.ofList() for feeding a list view you don't want a different type like a Map or Set to be swapped in. From just looking at Model.of(items) you get no indication that list is required but only after getting a compile error later. I think the level of verbosity of having the type after "of" is helpful in most cases. you can get the type of collection from just looking at the method name (otherwise you have to scroll up and look for the type declaration or type some hotkey in your IDE to get the type, how cumbersome :-). if you don't need some concrete collection type you can still use Model.of(Collection).
> I attached a patch to implement the proposed naming (and deprecate the previous methods)
> would be great to get this in before going final :-)

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


[jira] Commented: (WICKET-2374) Model's factory methods are inconsistent

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12732550#action_12732550 ] 

Johan Compagner commented on WICKET-2374:
-----------------------------------------

if you want to make it consistent then remove the map out of model.ofMap

why have it doubled mentioned you can see it on the param.

i dont think this will make it in the final. That one is pretty much already build.

> Model's factory methods are inconsistent
> ----------------------------------------
>
>                 Key: WICKET-2374
>                 URL: https://issues.apache.org/jira/browse/WICKET-2374
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>            Reporter: Peter Ertl
>         Attachments: model-of.patch
>
>
> When looking at the factory methods of org.apache.wicket.model.Model I think that the naming of the static factory methods is not consistent:
>   Model.of(Collection)
>   Model.of(List) 
>   Model.of(Set)
>   Model.ofMap(Map)
> I think it would be better to have these:
>   Model.of(Collection)
>   Model.ofList(List) 
>   Model.ofSet(Set)
>   Model.ofMap(Map)
> Reasons:
>  - Naming is consistent
>  - When using a concrete type of collection, for example Model.ofList() for feeding a list view you don't want a different type like a Map or Set to be swapped in. From just looking at Model.of(items) you get no indication that list is required but only after getting a compile error later. I think the level of verbosity of having the type after "of" is helpful in most cases. you can get the type of collection from just looking at the method name (otherwise you have to scroll up and look for the type declaration or type some hotkey in your IDE to get the type, how cumbersome :-). if you don't need some concrete collection type you can still use Model.of(Collection).
> I attached a patch to implement the proposed naming (and deprecate the previous methods)
> would be great to get this in before going final :-)

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