Plex 2E

Expand all | Collapse all

Commenting out code in AD - Best Practice?

  • 1.  Commenting out code in AD - Best Practice?

    Posted Jun 18, 2009 06:20 AM
    All,  I'm wondering if other out there routinely comment out code in the AD for a Plex function and your opinion on rather or not this is a best practice.  With standard RPGLE/Jave/ect. and a CMS/SCM, I don't comment out code, if I want to see/compare what the code use to be that's why the SCMarchives the older versions.  However, with Plex, that's not possible unless you're making use of versions/levels.  We don't so it's pretty routine to comment out the code.  The problem, which recently bit us, is that Plex still treats commented out code as there as far as dependancies.   So for example, if you comment out a function call, Plex considers the call to still be there but even worse is that the OUTPUT variables from the function are still there to be used someplace else.   An as far as I know, there's no good way to find out where they might be being used.  Thoughts and/or Comments?Charles


  • 2.  Re: Commenting out code in AD - Best Practice?

    Posted Jun 18, 2009 08:20 AM
    Charles,  One point to note is that  you can switch on the generation of usage triples so that  FNC generated call to FNC triples will document the dependencies between functions and ignore commented out calls. This is what drives the Dependency Browser. See help topic "Impact Analysis" in Chapter 1 of the User Guide  for more info.  [As an aside  I nevertheless would urge people to consider using  source management with Plex (and 2E come to that). There is a lot a value in the source, not only for impact analysis but also for supporting more efficient build practises. Being able to re-build any version of any component of your application without necessarily having to re-generate the code has a lot of advantages. For example it  supports modern software development practises like [url=http://]continuous integration.]  Regards,  Daniel Message Edited by DanielLeigh on 06-18-2009 01:32 PM [left]


  • 3.  Re: Commenting out code in AD - Best Practice?

    Posted Jun 18, 2009 10:05 AM
    Daniel,  Actually I do have the generation of usage triples turned on.   The big issue in my mind is that Plex is perfectly happy to allow me to use an OUTPUT variable/field from a function call that's been commented out.  Additionally, we do use an SCM/CMS (Aldon) with Plex generated source.   Of course given that Plex doesn't bother to take advantage of the capabilities of the RPGLE language, specifically long names, the SCM part of Aldon is all but useless with Plex generated code.    Charles Message Edited by CharlesWilt on 06-18-2009 02:12 PM [left]


  • 4.  Re: Commenting out code in AD - Best Practice?

    Posted Jun 18, 2009 10:55 PM
    Hi Charles,  I think you have answered your question. I think it is best to delete old code, commented out code seems a good idea but in practice I don't find it that useful  and more of a hindrance. If I was the only developer within a model then I might remember the commented out code, the project it was involved in, the reason why but usually the developer has to understand the existing code let alone the commented out code. I have never reinstated a bit of commented out code from a past project that I can remember, of course I find it useful to comment out code during development but after a function has been tested I clean it up with deleting commented out code and add narrative, comments and refine the code. Keep historic local  models which is always useful for  quick referencing.  My present employer has a standard of deleting commented out code after two version releases which brings me to my final point:  Not using versioning/level is a strange decision as it adequately does what it sets out to do which is simplify a complex business problem, it is not plex that makes the process complex it is the process of software development, lifecycle management, deployment management etc which is complex and Plex luckily for us has functionality to help us simplify the complex business lifecycle. This came up in a meeting the other week where people were saying plex was too complicated but I think they failed to understand that if you want to software development requirements of multiple languages variants, multiple projects, multiple delivery dates, multiple platform deployments its not plex that is complex but our business needs which are complex and plex luckily provides us with versioning, levelling, language variants to help us meet our complex business requirements. I'd look at least version control and delete that commented out code, remembering to delete the call triples on the function of deleted calls. Commenting out code is after all its own basic form of versioning.  I don't have access to plex and it has been a while but isn't there a setting in the gen and build for long names maybe of use but I don't have plex at hand to check its relevance to your problem  (well that's my excuse for  looking stupid). [left]CheersGeorge Message Edited by GeorgeJeffcock on 06-19-2009 02:57 AM [left] Message Edited by GeorgeJeffcock on 06-19-2009 03:01 AM [left] Message Edited by GeorgeJeffcock on 06-19-2009 03:06 AM [left]


  • 5.  Keep and archive of your action diagrams

    Posted Jun 19, 2009 02:18 AM
    Here is a suggestion which you might like to try in addition to the other tips.   With the introduction of the Plex 6.0 feature "Full Action Diagram Export" I am now able to take a regular snapshot of the action diagrams as text files which I then check that into Subversion source control.   I use Windows Desktop Search to index the exported text files and am then able to perform an additional level of impact analysis on the current version, as well as perform a conveinient to previous versions using Subversion.   It's an additional housekeeping task to manage these source files (dump weekly?), but I have found it a very convenient resource.   In this way, you can keep your current code clean and view the changes over time.


  • 6.  Re: Keep and archive of your action diagrams

    Posted Jun 19, 2009 04:34 AM
    Matthew,  Yeah, I'm looking forward to 6.0+   but right now we're still on 5.5.  We should be upgrading by the end of the year....  Charles


  • 7.  Re: Keep and archive of your action diagrams

    Posted Sep 26, 2009 05:33 AM
    Just a quick note to say that the full AD export is available in Plex 5.5.   Looks to have been added as a PTF, the earliest we saw it was Plex 5.5 Build 026.  I included information on the use of dumped AD text for the purpose of impact analysis in a presentation at the Ft Lauderdale conference, session 6A CA Plex Upgrade Study.   The slides should be available on the conference site soon, I will post a copy on Desynit.com also.  We have a script which can format the raw AD as HTML, if anyone is interested in using this send me a message.


  • 8.  Re: Keep and archive of your action diagrams

    Posted Sep 28, 2009 05:07 AM
    Hi Matthew,I ´m interested...I have sent a message to your user account.With RegardsJorge Ubeda


  • 9.  Re: Keep and archive of your action diagrams

    Posted Sep 28, 2009 06:02 AM
     This used to do the trick.. trying to track it down   http://www.adcaustin.com/forums/forum_entry.php?id=70202&page=181&category=0&order=time


  • 10.  Re: Keep and archive of your action diagrams

    Posted Sep 28, 2009 06:25 AM
    Hi George,  The script Matt's referring to   was based on Steve's Javascript.    This has been  implemented in PHP as an extension for the wiki allowing users to paste AD code nearly directly into the wiki.   We've now wrappered this up a bit to process the AD dump files and produce a corresponding html file for each AD.  I have a copy of Steve's original script somewhere too..


  • 11.  Re: Keep and archive of your action diagrams

    Posted Sep 28, 2009 07:07 AM
    George, that's the one.   Indeed, we credit Stevers in the comments of our script code.   These days it's PHP rather than VBScript and we use the same code for formatting AD example text in the Plex Wiki.Let me catch up with post conference some admin and I will post the scripts for all.


  • 12.  Re: Keep and archive of your action diagrams

    Posted Oct 13, 2009 03:07 AM
    I've emailed a copy of the scripts to the people who contacted me.  if anybody else would like a copy, you know where to find me.  


  • 13.  Re: Commenting out code in AD - Best Practice?

    Posted Jun 19, 2009 04:43 AM
    Hi George,  I don't disagree with anything you've said....which is why I basically answered my own question in the first place.  :smileywink:  Basicaly, looking for agreement from the users here to use as ammo to effect a change to "the way it's always been".  Part of our trouble is that we use Aldon CMS to handle movement of objects to production and there's no Plex Aldon integration.   As far as I know, CMS software for Plex has been a pretty recent development.      As far as generating long names...that option doesn't affect RPGIV or DDS   generation.   Allow both do support long names, CA choose to generate RPGIV as if it was RPGIII.  Charles