Skip to Content

After almost being scheduled disastrously alongside Thomas Jung presenting an excellent session on UI Stuff, I was luckily moved in an “unconference” manner to a later session where I had a diverse group of people to talk about standards from the perspective of coding.

 

The gist of my session is as follows:

An invitation for all developers of ABAP, JAVA, PI/XI, Portals, BI/BW, etc; to discuss the following topics concerning standards (focus on coding standards):

    +Do you believe you have good standards and if so, does your company benefit significantly from these? </li><li>Where were your standards sourced from?</li><li>Should standards include scope and type for variables (i.e. local integer, global character)?</li><li>Should/Could SAP supply more detailed Customer (Z namespace) standards based on their internal standards?+*FUNCTION ZCS_RFC_VC_COURSE_LIST5. </div><div>*”–


    </div><div>“Local Interface: </div><div>*”  IMPORTING </div><div>*”     VALUE(COURSE_ID) TYPE  ZCS_COURSE_ID OPTIONAL </div><div>*”  EXPORTING </div><div>*”     VALUE(E_VALUE_HELP) TYPE  ZCS_COURSE_ATT_RFC_TBL </div><div>*”


    </div><div>  DATA model TYPE REF TO zcl_cs_main_model. </div><div>  CREATE OBJECT model. </div><div>  TRY. </div><div>      DATA courses TYPE zcs_course_att_tbl. </div><div>      model->read_course_listing( </div><div>         IMPORTING </div><div>           e_courses = courses ). </div><div>      FIELD-SYMBOLS: <wa_course> LIKE LINE OF courses, </div><div>                     <wa_help>   LIKE LINE OF e_value_help. </div><div>      LOOP AT courses ASSIGNING <wa_course>. </div><div>        APPEND INITIAL LINE TO e_value_help ASSIGNING <wa_help>. </div><div>        MOVE-CORRESPONDING <wa_course> TO <wa_help>. </div><div>      ENDLOOP. </div><div>    CATCH zcx_course_system . </div><div>  ENDTRY. </div><div>  SORT e_value_help BY course_id. </div><div>ENDFUNCTION. </div></div><p> </p><p>And compared it to how this code would look in my company (approximately):</p><div>FUNCTION Z_RFCHTE__VC_COURSE_LIST5. </div><div>*”


    </div><div>“Local Interface: </div><div>*”  IMPORTING </div><div>*”     VALUE(IC_COURSE_ID) TYPE  ZDE_CS_COURSE_ID OPTIONAL </div><div>*”  EXPORTING </div><div>*”     VALUE(OTB_VALUE_HELP) TYPE  ZTT_CS_COURSE_ATT_RFC </div><div>*”


    </div><div>  DATA lo_model TYPE REF TO zclhte_cs_main_model. </div><div>  DATA ltb_courses TYPE ztt_cs_course_att_rfc. </div><div>  FIELD-SYMBOLS: LIKE LINE OF ltb_courses, </div><div>                                     LIKE LINE OF otb_value_help. </div><div>  CREATE OBJECT lo_model. </div><div>  TRY. </div><div>      lo_model->read_course_listing( </div><div>           IMPORTING </div><div>              otb_courses = ltb_courses ). </div><div>         LOOP AT ltb_courses ASSIGNING . </div><div>         APPEND INITIAL LINE TO otb_value_help ASSIGNING . </div><div>          MOVE-CORRESPONDING . </div><div>     ENDLOOP. </div><div>  CATCH zcx_course_system . </div><div>  ENDTRY. </div><div>  SORT otb_value_help BY course_id. </div><div>ENDFUNCTION.</div><p> </p><p> </p><p>Unfortunately, I couldn’t get online at the time, but others stated it was pretty evident that if I grab code from an existing SAP function, the standards would look dramatically different again (even looking at 2 different modules within SAP would look different typically).</p><p> </p><p>I know there’s not a great difference above (both pieces of code are written well), but consider debugging the code and jumping around hundreds of different functions/methods.  Or consider being a developer team lead and having to review every developer’s code (try spotting an inappropriate global variable in the middle of code if not named such). </p><p> </p><p>I then went on to discuss coding conventions in other areas of SAP like:</p><ul><li>JAVA – java.sun.com – Quite light on for actual coding, mainly focussed on formatting and high-level naming.  Also, using NWDI and modifying SAP standard was an issue if, for example, each developer liked the location of their opening { to be in a different position (would make looking at deltas quite difficult)</li><li>SLD – For people starting with XI/PI and Sol Man, the SLD is overlooked for quite some time until you realise how bad it is to give developers full access to create any product/software component they look, and develop wherever they like.  i.e. This area is really easy to get wrong.</li><li>Web Dynpro – SAP actually have standards developed for Web Dynpro JAVA, but as Peter McNulty stated, since Web Dynpro is so model driven, naming standards for objects don’t make much sense.  Most Web Dynpro developers I work with agree, and hence why I’m not sure SAP can ever win if they do publish standards (we complain both ways it seems).</li><li>XI/PI – Bill Li also published some XI standards but unfortunately, XI/PI is one of those tools where I don’t think any XI developer quite agrees where mappings and ccBPM’s really fit and again is something where rather than embrace the standards, we want to discuss them in more detail.</li></ul><p> </p><p>So at this point, we all agreed to various degrees that wouldn’t it be great to have a global standard.  The big problem now was:</p><p>How do we do this in such a way that everyone considers adopting it including SAP?*

     

    So assuming we just start with ABAP standards/guidelines to begin with; there were 2 key ideas discussed that I thought just may work:

      1. Develop this in the same way that a standards body would develop a messaging standard.  i.e. Identify the right target audience to compile this and get sponsorship.  Could be similar to the focus groups approach used for ES development (giving SAP ultimate control).
      2. Similarly, use SDN and a WIKI or similar to develop the coding conventions globally.  Obviously we would need a small group to define the initial proposal for standards including what level we go to; but I believe the critical task for this to work is for SAP to say that they will adopt the final conventions for all future work. Again, SAP will hold ultimate control, but hey, I’m happy to be told there are no coding conventions and just come up with a class, function group, etc definitions if everyone thinks this is best. 

     

    Anyway, I’ve proposed a further BoF session for TechEd 2008 for determining an approach – https://wiki.sdn.sap.com/wiki/x/CICUAQ  – but in the mean time – it seems more people than just me care about this – so let us know your thoughts on how you think we could actually get this to work.

     

    For those who attended, apologies for not capturing the entire conversation and possibly missing many good points, and thanks everyone for the good discussion.  It was very refreshing.

     

    As an after thought and another example, we just had a session from Tom about UI Strategy and it was evident that SAP is doing a lot to unify the visual experience.  This is clearly an area where SAP could and should publish clear UI guidelines just like what has been done for the iPhone to gain consistent user experiences when dealing with business applications…

    To report this post you need to login first.

    3 Comments

    You must be Logged on to comment or reply to a post.

    1. Paul Hardy
      Mr Matt
      As you are well aware (as I was sitting next to you when uou ran your session) I am wholeheartedly behind you. The trouble with standards is that since that do not seem to matter some companies e.g. SAP let every developer choose their own naming conventions, and even when companies do have standards they adhere to no two are ever the same.
      As I mentioned there needs to be some control over a wiki type approach otherwise the naming standard for, say, global objects will keep flipping between GO_ (for object) and GR_ (for reference variable) every two minutes. Some peopl even like to start global variables with a W_. As long as the end result is not ridiclous (e.g. starting global variables with an L) then we get to the “any standards are better than none” stage. It would be downright weird if we got to the stage where “customer” development across different companies had more uniform naming standards then you get bewteen standard SAP function modules.

      Cheersy Cheers

      Paul

      (0) 
    2. Leonardo De Araujo
      Hi Matt, Thanks for taking this initiative.
      I tend to agree with Paul. It is hard to follow a set of standards if even SAP doesn’t follow one.
      Another thing is that I find that standards like G_* L_* for global and local variables tend to loos a lot of its importance with use of global classes.
      What I wanted to propose is a discussion around standards for global classes, mostly related to Business classes (I avoid using the word Business Objects since it means something else nowadays).
      Ex: Should we promote singleton and make instantiation private? How do we call the method to generate an instance of a SAP business object? (Read() ?)
      Are we calling the attributes HEADER and ITEMS?
      Are we using object orientation for both as well or living as simple attributes?
      Are we living the attributes all as Private and provide GET_HEADER() methods?

      It is not simply around the naming conventions but around best practices in OO programming in ABAP.

      Since you already started this discussion, would you like to join forces and take on this together?

      Let me know.

      Leonardo De Araujo

      (0) 
      1. Matt Harding Post author
        Thanks Leonardo.  I whole heartedly agree that this is more than just naming standards, but anything is a start.  What I’ve actually discovered since posting this is that SAP do in fact have standards internally (fairly recent change so that’s why it’s hard to see standards in SAP code).

        Now an interesting view point I found out was that many consulting companies sell their standards as a free part of their service, so SAP releasing standards may be a bit of a slap in the face to these companies however, with the Generation Y world coming upon us quickly, this type of thinking is antiquated and we really should see collaboration as something to embrace in the community (what’s a standard if it is only standard per consulting organisation).

        Hence I’m thinking the next step is to get the highest SAP Technical leads in the Accentures, IBM’s, Deloittes, etc; space to commit to allowing SAP to release standards without being upset and then definitely it’s time to join forces to work with SAP to release something publically (at least for ABAP initially).

        Hopefully the BoF Session gets accepted and if so, I hope to meet you there to get this started.  I actually think getting a core group together from various backgrounds to refine what’s good and bad would be fun but without SAP sponsorship I feel this is going to be a struggle.

        Out of interest, Tom Jung just twittered a complaint about developers not using class constants in code – so here’s another really obvious mandatory guideline to add.

        Cheers,
        Matt

        (0) 

    Leave a Reply