adfemg
  1. adfemg
  2. ADFEMG-96

[ADFng1-04024] - Bean name [ADFng1-04030] - Bean EL name

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Labels:
      None

      Description

      hi

      Please consider naming guidelines [ADFng1-04024] and [ADFng1-04030] in the "ADF Naming and Project Layout Guidelines v1.00" [1].

      [ADFng1-04024] - Bean name - Do not include the scope of a managed bean in its name as this is already covered by the package it is contained within.
      A bean example which would violate this rule is CreateCustomerPageFlowScope.

      It does not seem clear if the naming guideline [ADFng1-04024] is referring to the Java class name (which it seems to be).
      Because such Java class only "becomes" a managed-bean when it is defined as such, when it will also get a "managed-bean-name" (which seems to be subject of naming guideline [ADFng1-04030]).

      [ADFng1-04030] - Bean EL name - When configuring a managed bean match the EL name of the bean to the class name, using camelcase with the first letter in lowercase.
      For example a pageFlowScope bean ViewBookings.java would be referred to as #

      Unknown macro: {pageFlowScope.viewBookings}

      in EL.

      Because choosing a scope for a managed-bean is very important, I think the (abbreviated) scope should be included in the "managed-bean-name".
      So, instead of "browseEmployees", it would be "pf_browseEmployees", like this:

          <managed-bean id="__1">
            <managed-bean-name>pf_browseEmployees</managed-bean-name>
            <managed-bean-class>com.acme.hr.view.searchdepartmentstaskflow.BrowseEmployees</managed-bean-class>
            <managed-bean-scope>pageFlow</managed-bean-scope>
          </managed-bean>
      

      Sure, it could be argued that this is in conflict with naming guideline [ADFng1-01014], "Don't use Hungarian notation".
      But, the importance of choosing the correct scope warrants such prefix guideline.
      If the scope of a managed-bean should change, and as such the prefix in the managed-bean-name, visiting all places where the managed-bean-name is used (to change its name) will enable (and somewhat force) a review of how the managed-bean is currently used and if all its current features match the new scope (and really design) change.

      many thanks
      Jan Vervecken

        Activity

        Hide
        chriscmuir added a comment -

        Thanks for lodging this issue Jan.

        Regarding your comments on ADFng1-04024, agreed, I've clarified that rule to specifically mention the file name as:

        "• [ADFng2-04024] - Java bean class name - Do not include the scope of a bean in its Java class file name as this is already covered by the package it is contained within."

        Regarding your comments on ADFng1-04030, in this case I've somebody internally who is incredibly experienced like you totally the opposite case. As I don't have a clear winner but two opinions/preferences, I'm not going to change 04030 at this stage. However luckily the change to rule 04024 leaves an out for your preference because now there is no rule specifically discussing the managed bean name.

        Regardless please remember the following paragraph on page 4:

        "Generally the guidelines should be followed but in the cases where it doesn't make sense to do so, where you have your own preference, certainly diverge from the guidelines. However ensure to document why and when this has occurred so your team follows a single guideline rather than an ambiguous set of conflicting guidelines from Oracle and your own efforts."

        This gives you a get-out-of-jail-card if your preferences differ.

        Show
        chriscmuir added a comment - Thanks for lodging this issue Jan. Regarding your comments on ADFng1-04024, agreed, I've clarified that rule to specifically mention the file name as: "• [ADFng2-04024] - Java bean class name - Do not include the scope of a bean in its Java class file name as this is already covered by the package it is contained within." Regarding your comments on ADFng1-04030, in this case I've somebody internally who is incredibly experienced like you totally the opposite case. As I don't have a clear winner but two opinions/preferences, I'm not going to change 04030 at this stage. However luckily the change to rule 04024 leaves an out for your preference because now there is no rule specifically discussing the managed bean name. Regardless please remember the following paragraph on page 4: "Generally the guidelines should be followed but in the cases where it doesn't make sense to do so, where you have your own preference, certainly diverge from the guidelines. However ensure to document why and when this has occurred so your team follows a single guideline rather than an ambiguous set of conflicting guidelines from Oracle and your own efforts." This gives you a get-out-of-jail-card if your preferences differ.
        Hide
        Jan Vervecken added a comment -

        Thank you for the update Chris.

        • about "... agreed, I've clarified that rule to specifically mention the file name ..."
          • Thank you for the confirmation.
        • about "... as this is already covered by the package it is contained within ..."
          • Can you please clarify how "package" and "scope" are related in this context? Maybe with an example?
        • about "... somebody internally who is incredibly experienced like you totally the opposite case ..."
          • It is a choice. To me, including a "scope prefix" seems to value "the importance of choosing the correct scope" more.
            Sure, these naming guidelines include "... where you have your own preference, certainly diverge from the guidelines ...".

        regards
        Jan Vervecken

        Show
        Jan Vervecken added a comment - Thank you for the update Chris. about "... agreed, I've clarified that rule to specifically mention the file name ..." Thank you for the confirmation. about "... as this is already covered by the package it is contained within ..." Can you please clarify how "package" and "scope" are related in this context? Maybe with an example? about "... somebody internally who is incredibly experienced like you totally the opposite case ..." It is a choice. To me, including a "scope prefix" seems to value "the importance of choosing the correct scope" more. Sure, these naming guidelines include "... where you have your own preference, certainly diverge from the guidelines ...". regards Jan Vervecken
        Hide
        chriscmuir added a comment - - edited

        Agreed, 04024 again needs rewriting. Now the rule simply is:

        • [ADFng2-04024] - Java bean class name - Do not include the scope of a bean in its Java class file name.
        Show
        chriscmuir added a comment - - edited Agreed, 04024 again needs rewriting. Now the rule simply is: [ADFng2-04024] - Java bean class name - Do not include the scope of a bean in its Java class file name.
        Hide
        steven.davelaar added a comment -

        Yes, the bean scope is important, but I don't see why we should use prefixes in the bean name to emphasize this.
        Prefixes are ugly and undermine readability, but more important, being an old relational database man, I hate redundancy, so the scope should be defined in one place only: in the bean definition in the task flow XML.

        Show
        steven.davelaar added a comment - Yes, the bean scope is important, but I don't see why we should use prefixes in the bean name to emphasize this. Prefixes are ugly and undermine readability, but more important, being an old relational database man, I hate redundancy, so the scope should be defined in one place only: in the bean definition in the task flow XML.
        Hide
        chriscmuir added a comment -

        Thanks for the feedback Steven. As a result I wont take this issue any further beyond the initial fixes I specified.

        Show
        chriscmuir added a comment - Thanks for the feedback Steven. As a result I wont take this issue any further beyond the initial fixes I specified.
        Hide
        Jan Vervecken added a comment -

        Thank you for the update Chris.

        Thanks for clarifying and simplifying naming guideline [ADFng1-04024].
        As can be found in "ADF Naming and Project Layout Guidelines v2.00" [1] :

        [ADFng2-04024] - Java bean class name - Do not include the scope of a bean in its Java class file name.

        regards
        Jan Vervecken

        Show
        Jan Vervecken added a comment - Thank you for the update Chris. Thanks for clarifying and simplifying naming guideline [ADFng1-04024] . As can be found in "ADF Naming and Project Layout Guidelines v2.00" [1] : [ADFng2-04024] - Java bean class name - Do not include the scope of a bean in its Java class file name. [1] http://www.oracle.com/technetwork/developer-tools/adf/learnmore/adf-naming-layout-guidelines-v2-00-1904828.pdf regards Jan Vervecken
        Hide
        Jan Vervecken added a comment -

        Thanks for your reply Steven.

        • about "Yes, the bean scope is important, ..."
          • Thank you for the confirmation.
        • about "Prefixes ... undermine readability, but more important, ... I hate redundancy, ..."
          • Sure, I can understand that. But, I can also understand that the importance of choosing a scope for a managed-bean is valued more, by making it a part of the name.

        regards
        Jan Vervecken

        Show
        Jan Vervecken added a comment - Thanks for your reply Steven. about "Yes, the bean scope is important, ..." Thank you for the confirmation. about "Prefixes ... undermine readability, but more important, ... I hate redundancy, ..." Sure, I can understand that. But, I can also understand that the importance of choosing a scope for a managed-bean is valued more, by making it a part of the name. regards Jan Vervecken

          People

          • Assignee:
            Unassigned
            Reporter:
            Jan Vervecken
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: