[ 
http://jira.amdatu.org/jira/browse/AMDATU-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11717#comment-11717
 ] 

Marcel Offermans commented on AMDATU-435:
-----------------------------------------

Also, I'm seeing a few interfaces that are registered that only contain some 
constants. Don't get me wrong, constants are good, but they are used by the 
compiler, not at runtime, so registering an interface with only constants as a 
service is even misleading:

If at compile time I have access to a Constants interface that defines:

{code}
interface Constants {
  public static final String SOMECONSTANT = "A";
}
{code}

And I compile my implementation against that interface, all uses of 
SOMECONSTANT will be in-lined by the compiler and I will have no import of the 
Constants class.

So, if at runtime there is a different version of Constants available:


{code}
interface Constants {
  public static final String SOMECONSTANT = "B";
}
{code}

You might be tricked into thinking that SOMECONSTANT is "B" where in fact it 
might be anything (depending on what was available at compile time). So for 
constants, I propose we use classes that are actually called Constants or 
WhateverConstants and make sure we use them consistently at compile time.
                
> Small-ish issues after reviewing web.wink
> -----------------------------------------
>
>                 Key: AMDATU-435
>                 URL: http://jira.amdatu.org/jira/browse/AMDATU-435
>             Project: Amdatu
>          Issue Type: Task
>          Components: Amdatu Web
>            Reporter: Marcel Offermans
>
> I reviewed the code in web.wink and have a list of small-ish issues:
> # Why do we register this one as a service? WinkRegistrationService is empty 
> and unused. There are other places where I've seen this, and I would propose 
> we remove all of them. [1]
> # In WinkRegistrationServiceImpl there is a comment that states "Array to 
> prevent dependencyManager from injecting the wrong component". There is a 
> more elegant way to disable injection for a specific type if that's all 
> you're trying to avoid here.
> # Both init() and destroy() clear the map of servlet components. One time is 
> enough.
> [1] In general, if a component needs to be registered in the service registry 
> for other reasons (because it has JAX-RS annotations for example) I would 
> propose we register it as Object instead, and if we really need to further 
> distinguish it, add a property. That saves us lots of marker interfaces, 
> dependencies, etc.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
http://jira.amdatu.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Amdatu-developers mailing list
[email protected]
http://lists.amdatu.org/mailman/listinfo/amdatu-developers

Reply via email to