Home
User Guide - Computer Science
Contents
1. Install AnyWHETEIBY zero G P g 7 de 46 CARE Users Guide SOFTWARE After the installation procedure is completed the CARE tool is ready to be launched by the corresponding entry in the Program Menu Configuration External files During the execution of CARE when using COBOL projects the location of some external files may be prompted to the user with the following dialog lt dialog image gt You should select the folder containing the external executable files typically located in a folder named extbin under the installation folder If the installation procedure didn t create it copy the files from the CD to that location or any other and configure the dialog accordingly CARE Users Guide P g 8 de 46 Ark SOFTWARE 3 Features CARE is primarily an open reengineering environment but is capable of supporting other activities in the software process development SPD It was created as an environment hosting several known re engineering techniques The architecture used is based on uniform representations enabling the support of several programming languages with little effort to integrate new ones CARE supplies several basic libraries for the reengineering techniques namely transformations but promotes and supports the use of user defined elements incorporating project specific knowledge and requirements The following activities of the SPD SQA may use the support of CARE e
2. CARE Users Guide AMX SOFTWARE What is a Patch Template A Patch template is a parameterized block of text When instantiated by the transformation process generates a patch modification that will be applied to the original program A patch template has several attributes Text Location Unique flag Keep The text that defining the modification to apply In this text place holders may be used to represent e specific parameter values that are assigned by the transformation e named marking entry values see Marking Entries A place holder has the form name Example In the example presented in What is a Marker we refer marker VAR_12 that may produce markings with the VarName and Format entries A patch template used by a transformation that uses marker VAR 12 may use in its text VarName to represent the variable name of each marked declaration eg 01 VarName ALT PIC X 16 to produce 01 NUM REG ALT PIC X 16 A unique template will be applied only one in a program transformation This is useful when several transformations require a given modification but that modification can only appear once in the final result e g the declaration of a given variable an include copy instruction etc the text will be applied respecting the indentation of the indentation preceding line flag Creating Patch Templates Create a Patch template El Select the option New gt New Patch
3. Locate the lt project_dir gt Choose a name for the project with extension tpr Click on the New button The project explorer appears with an empty project The project is saved at creation time After creating a project you may add folders to your project The folder and all the files with a valid source file extension for the project s language will be added to the project hierarchy recursively Adding removing programs from a project EH Choose Add Folder from the project context menu Locate the directory to CARE Users Guide P g 12 de 46 Ark SOFTWARE insert Click on the Select button A The selected directory appears know as a folder inside the project If you want to add all valid sub directories and files for a given project folder use the Refresh option in that folder context menu Once the files folders are added you may remove one or many using multiple selection and the corresponding Remove entry in the file folder context menu Note 1 When you add a folder that is located under the project directory tree a relative path is stored which allows the whole project to be moved and transfered to other machine without any problem If you add a folder outside the project tree you will have to make shure the locations are the same if you move to another machine Note 2 Please note that context menus for multiple selections are only available if the selected concepts are of a similar type Projec
4. the users who define the transformations to apply Typically these users are aware of the code patterns of source programs and the requirements for the transformation They have the knowledge and skills to write the transformation definitions that produce the required results the users who apply the transformations Typically these users know the source programs very well and are able to validate if a transformation is well applied or not They should also be able to identify the cases where transformations should not be applied even if the definitions signal those cases This is often the case when the marking rules have a loose matching for optimization or complexity purposes Transformation is a technique for transforming a program based in 3 simple concepts Markers Transformations and Patches Patch Templates In order to execute a transformation process a set of transformation definitions has to be configured in a project P g 19 de 46 CARE Users Guide AMX SOFTWARE The picture shows a general view of the transformation process and the data and activities involved The following sections describe in detail the definition and application of transformations Transformed Program Source Program APPLICATION Internal Program Representation Validation amp Tuning DEFINITION Defining Transformations A transformation definition includes e one or several markers that
5. Template on the Project context meni or the antian New Patch Temnlate an the Patch Temnlates CARE Users Guide P g 26 de 46 Ark SOFTWARE folder context menu A The Editor dialog for a new patch template appears Editing a patch template requires the user to supply the previously described information e name e text e location e template attributes unigue keep indentation E Select the OK button 4 The patch template appears under the project s Patch Templates folder Advanced patch template definition Loading stored data The previous sections described how to create new elements markers transformations patch templates inside a project It is also possible to load these elements from another projects data file tpr xml or an xml library file Loading stored elements EB Select the option Load Load Markers on the Project context menu or the option Load Markers on the Markers folder context menu Fl A File dialog appears Select the file to import the definitions from E A selection dialog appears listing all the Markers defined in the import file Select the ones you want to import El Select the OK button B The chosen Markers appear under the project s Markers folder The above loading operation is similar for Transformations and Patch Templates Note Currently the tool doesn t provide facilities to build independent libraries of these elements However that can be easil
6. allows to identify patterns in the program where transformations will occur atransformation mapping the result of the markers to patches that can be instances of more generic patch templates apatch template that is a parametric change of the original program What is a Marker A marker identifies patterns in the program structure and gives as result a set of markings A marking includes one or more labelled entries which represent program structure nodes or simple data like a string or a number A program node is an entity of the program to which is associated Example A marker VAR 12 that identifies all the declarations of variables of size 12 may retrieve the following result CARE Users Guide P g 20 de 46 Ark SOFTWARE Var_12 results DecInst line 43 10 37 NUM REG X 12 line 45 14 38 NUM CONT 9 12 Two markings were found one for the instruction in line 43 and other in line 45 with the corresponding variable name and format entries VarName Format lt code gt How is the marking information relevant for the transformation process The entries that represent program nodes are valid anchors to produce modifications via patches see Program Anchors The data entries may be used to supply additional data to the modifications As an example a transformation using the VAR_12 marker could apply patches to produce the following modifications e replace the declaration 4
7. containing a statements s and a subset of variables V of the program Given a criterion the slice consists of all statements in the program that potentially affect variables in V at position s Slices are computed by finding the transitive closure of indirectly relevant statements according to data and control dependencies Working with Slicing In the following we describe how to create and execute a slice in CARE The following COBOL program is used for demonstration of the technique This program calculates simultaneously the sum product and average of a sequence of numbers 000151 LINKAGE SECTION 000151 01 MN PIG 999 e 052 OH pre VOS 000153 01 SUMR BIC SS 000154 01 PRODUCT pue 99 000155 01 AVERAGE PIC 999 000160 PROCEDURE DIVISION 000161 THE SECTION 000162 INIT 000163 OVE 10 TON 000164 Owe JL 10 Mo 000165 OVE 0 TO SUMR 000166 OVE 0 TO AVERAGE 000167 OVE 1 TO PRODUCT 000168 MAIN 000169 IF I lt N 000170 GO TO LOOP 000171 COMPUTE AVERAGE SUMR N 000172 DISPLAY I 000173 DISPLAY SUMR 000174 DISPLAY PRODUCT CARE Users Guide P g 32 de 46 000175 000176 COOU TOO 000178 000179 000180 000190 DISPLAY AVERAGE EXIT PROGRAM ADD TO SUMA MULTIPLY 1 BY PRODUCT NDID IL AO To GO TO MAIN Creating a slice Ark SOFTWARE E With the given file selected choose the menu option Tools Program Slicing The slicing view of a file appears Se
8. for applying transformations on a single open file this setup activity is not required since the required files are generated automatically or after user confirmation Set up a project 1 With the one file several files selected in the project view or the project itself choose the menu option Process gt Setup Auxiliary Files A a dialog is open requiring the selection of which files to create AST program structure CFA DFA Control Data flow Select both or at least the AST option El The files that are not yet created or up to date are created while a progress window displays the file being processed E Choose now the menu option Process gt Create Analysis Files E A dialog is open requiring the selection of which files to create Select only the Interface option Files are generated in a way similar to 3 P g 17 de 46 CARE Users Guide SOFTWARE CARE Users Guide P g 18 de 46 Ark SOFTWARE 4 Transformations Definition Transformations Transformation is basically a process that performs modifications in programs This process relies on the identification of code structure patterns in the source program and the production of related modifications into the transformed program New code EE all Changed Removed code Original Transformed source code source code When working with transformations the CARE environment may be used by two different groups of users
9. for the program The outline includes the following program information and navigation shortcuts Includes The copybook instructions in the program Paragraphs The existing paragraphs of the program Declarations The declared variables Procedures The existing procedures A procedure is a set of paragraphs that are excuted as a whole thus behaving like an isolated logical unit See Procedures for details Performs All the perform instructions in the program Goto s All the goto instructions in the program Dead Code The statements that are not reachable by the control flow of the program lt The outline information description must be updated to the different laguages available gt The outline also allows the access to information that may be expressed by graphs like paragraph dependencies control flow etc See Program Graphs for the details CARE Users Guide Pag 16 de 46 Ark SOFTWARE Setup of the project The setup activity for a project is the generation of all the required files that enables the project to be ready to define and apply program transformations Since in large projects this task may take a few minutes we recommend it to be performed before using the other CARE techniques The description of all the files that can be generated will be explained later in this manual We present here the minimum information that has to be available for transforming groups of files in a batch process Please note that
10. note that the batch processes work with the saved definitions of the project If changes are made to the project they have to be saved prior to execution of marking and generation activities lt picture with a process result gt CARE Users Guide P g 44 de 46 SOFTWARE 9 Advanced Features lt chapter to be detailed gt Rule Libraries Loading rules from a library Managing a rule library Analysis Data Documentation Site P g 45 de 46 CARE Users Guide 10 Examples lt to be detailed gt CARE Users Guide P g 46 de 46
11. 0000 A lt gt gy Transformations Slicing J iE T D AWorkjCAREJOLD VERSION 3lExamplesisiicingisourcelslicingl cob P g 33 de 46 CARE Users Guide AMX SOFTWARE Performing the slice El Select the slice to perform in the slicing view of a file Check uncheck the option Backward from the context menu to perform a backward forward slicing E Select the option Perform Slicing from the context menu or the corresponding toolbar button The slice is performed The resulting statements and declarations are presented in the Slicing Results folders for the slice They are also highlighted in the program with a different colour E CARE Reengineering Environment version 2 0 2 2004 Bc 01 x File Edit View Actions Tools Help S tee EBRE EX Ark B slicingt cob 0 vB slicingi cob x BR amp amp e e B 2 B 000160 PROCEDURE DIVISION 03930000 000161 THE SECTION 03940000 E slicingl cob gt Y TES En gy CriterionFolder E SlicingResults qp THE INIT MOVE 0 TO SUMR 03980000 4 THE INITILOOP MOVE 0 TO AVERAGE 03980000 32 move 33 move 36 move gy THE MAIN 38 s if COMPUTE AVERAGE SUMR N 03880000 39 g0_to DISPLAY I 03880000 43 display screen DISPLAY SUMR 03880000 45 s exit 3 THELOOP DISPLAY AVERAGE 03880000 9 48 multiply 9 49 add to 50 go to Gil SheingResultsDed ADD I TO SUIR 03880000 oN 1 PRODUCT l
12. 3 by 01 NUM REG ALT PIC X 16 e delete the declaration 45 e inserting after declaration 43 01 OLD REG PIC X 12 The choices of the program nodes to be in the result of a marker should be choosen carefully In the previous case consider that the goal of the transformation was to replace only the variable name leaving the rest of the declaration unchanged The result markings should therefore include as an entry the program node corresponding to the variable name line 43 XX Y Y allowing a much more localized replacing 01 NUM REG ALT PIC X 12 How does a marker work A marker typically performs queries on the internal representation of a program which is a DOM XML model It uses the power of the XPath query language over the model to retrieve the desired results according to the semantic of the different types of markers In order to write a marker one has to have an understanding the underlying DOM model of a program and knowledge about the XPath language These are the skills required for the users defining transformations in CARE The tool also provide some facilities to visualize the underlying DOM Model graphically see Internal Model Visualization P g 21 de 46 CARE Users Guide AMX SOFTWARE Creating Markers Several types of markers can be defined within CARE The simple types use the XPath query language over the XML representation of a program Alternatinely user coded Java classes can be r
13. 64869 10 0 Simple without much risk nc EE eT 10 0 20 0 Reasonable complex moderate risk 20 0 50 0 Complex high risk Halstead s n1 Property 10 50 0 2 147483647E9 Untestable very high risk Halstead s n2 Property 5 EK More Halstead s N1 Property 19 MOK More Halstead s N2 Property 27 BL OK More THEINIT LOOP E Output Finished osa Note It may be required to generate auxiliary files e g interface files prior to the calculation of metrics see Generating Auxiliary files CARE Users Guide P g 42 de 46 Ark SOFTWARE 8 Batch transformations The transformation process was described as a three step process applied to each relevant program Usually the targets a large number of programs that should be processed massively Since there is are validation activities that require time from the user it is recognized that the most optimal process is not to process all the steps for each program at a time but rather each step for all the programs Performance reasons also encourage the use of batch processing of programs leaving interactivity with the user only to the validation activities Therefore the ideal process is described as follows Processing programs massively 8 BE Qu Create a project and add the relevant programs as described in Working with Projects or open an existing project Generate all the auxiliary files using the option Process Setup Auxiliary Fi
14. CARE Computer Aided Reengineering Environment User Guide Version 2 0 2 August 2004 FTWARE http www atxsoftware com SOFTWARE CARE Users Guide P g 2 de 46 1 INTRODUCTION 2 INSTALLATION CONFIGURATION AITANA E A ARO NI ATRAEN 3 FEATURES cccscsssssssssssssccsccscsssscssssessessssessessesssssssessscssssssssssuessassasessessesessssecsssossesscsscssssessassssessessssessesoes 9 4 GETTING STARTED wassncscicsssasossnsosssasenesossesoeissosensoonsossessossonssenesseoosdcsceasooiessgeatonsconcasooasaneensooseeasansocsesseeasen 11 BINI O EA EEA EAN a to dened as aL a Work Cd ai WORKING WITH PROJECTS Project PrODeNtes a te iE VIEWING PROGRAM a Text Window QUulMEBTIWS Tias re ER oda SETUP OF THE PROJECT onsec tee Et ete EE eto tele o ete pest cce Sa d etes veces be toe ev ey 5 REENGINEERING TECHNIQUES eere eee tnus ERROR BOOKMARK NOT DEFINED 6 RT TRANSFORMATIONS eese eese eene ese netta sense tt tasto senses tuse tasse tse sa assess nose eese ns aco snes cenas essas anta 19 TRANSFORMATIONS roca e EO ARCA GU ied ea tvi ee eei aste ecu eret eed e 19 DEFINING TRANSFORMATIONS ge RUE CURE Y EYES Et EE E EE REOR ede 20 What isca Marker 2 ere pet e eO IR REPERIO D I Prem RE i 20 How is the marking information relevant for the transformation process How does a marker Work 2 cse e on Re ete e o Ren ek Ye etn RR conash Fe eee peca aho cian 21 Greating Markers
15. CY EFEITO WK BDECOOCV MOVE EFTCEDI OF DEC7211 TO 2C EFT CKD BDECOOCV j gt D Work XML XmiTransformiDema testes GAPS ApplicationFilesicics BDECOOCV Cob When the tool operates with a program some extra information is loaded see Auxiliar program data However this information is only loaded when it is needed A dialog appears to confirm the operation or when a possible mismatch between the program source and the last time the information was generated requires an update of the information see also Project SetUp Please note that by default when a program is open it is on read only mode To change the program source the option Edit Mode in the text editor context menu should be used These changes will cause an information update in future operations Outline Browser The text editor presents the source code of the program For better understanding and navigability on the program structure the outline of the program may be used by using the option Tools gt Program Outline Pag 15 de 46 CARE Users Guide SOFTWARE 10 CSEGMTO VAL LINK PIC X 02 10 NBOL LINK PIC X 10 10 KCONT LINK PIC X 20 10 KDOC LINK PIC X 16 05 WOS CONTROLE CURSOR PIC 959 01 VALUE 68 V88 CURSOR OFF VALUE 68 W8S CURSOR OW VALUE 05 FILLER PIC X 040 0 0 l e BTTPOD06 Goto s O Dectarations 3j Paragraphs gt dl Blocks i DeadCode e 34 Performs This option opens the Outline browser
16. RAGE EXIT PROGRAM EXIT PROGRAM LOOP ADD IL TO SUMA INDID dL Ho Wg GO TO MAIN PAC PIC PIC PIC 5215 a JO 5215 e DIN SUMR N CARE Users Guide SOFTWARE 7 Metrics Introduction to metrics Metrics are a way to evaluate programming projects and code and a important instrument for Quality Assurance activities CARE calculates several industry standard metrics from source code To monitor their programming efforts software engineers traditionally use some simple metric like lines of code or executable file size Lines counts and kilobytes are useful numbers but they re rather limited They tell something about the size of the project but almost nothing about the understandability complexity and reusability of the code Knowing how big is a project is usually not the most relevant question to answer but how difficult it is the project to manage or evolve CARE provides metrics of the following groups size understandability complexity and unstructurability The supported languages have different structural unit concepts In this chapter we use the universal concepts of program procedure and variable in the description of the meaning of the metrics Size and Understandability Metrics Code size is usually measured in lines of code or kbytes You can measure sizes such as project size procedure size source file size executable file size and so on Line counts The simplest way to measure
17. Reengineering e Program System Analysis e Documentation e Code Certification Basic CARE features are e Application of one or several Reengineering techniques to a program including o Transformation A transformation is used to produce massive changes in source programs by applying changes to user identified patterns of code based in structural information or data control flow information o Slicing Slicing a program is identifying and extracting the relevant sub program that satisfies some criteria The result of a slice is still a valid program o Extraction Extraction is a technique for automatically extracting procedural elements from a program creating its interface when necessary and inserting the appropriate call instructions in the original program e Generation of a documentation website for a set of programs e Visualization of program information in textual graphical way program structure control flow dependency graphs P g 9 de 46 CARE Users Guide SOFTWARE CARE Users Guide P g 10 de 46 Ark SOFTWARE Getting Started Basics This chapter presents the general aspects of the tool The functionalities and tasks required to set a project ready to apply transformations are also described Work area The work area of the tool includes the typical components existing on a IDE We present here the most important ones P g 11 de 46 CARE Users Guide AMX SOFTWARE Ed
18. cs The above presented metrics are currently available in CARE or planned for the next releases The following table shows the metrics available in the current version Metric CARE current version Line count x LOC sLOC x Comment lines x Cyclomatic complexity x Cyclomatic density Structural fan in fan out C amp Y Informational fan in fan out H amp K x Informational complexity Halstead s properties x Depth of call tree Maintainability index x Pag 41 de 46 CARE Users Guide SOFTWARE GoTo s x Dead Code x Nested conditionals x Nested loops Viewing metrics El With the given file selected choose the context menu option Metrics or the corresponding toolbar button E E A new window appears in the editor board with the metric results Tables with the interpretation of results may be inspected clicking with the mouse on the result comments E CARE Reengineering Environment version 2 0 2 2004 E ioj xj File Edt View Actions Tools Help S i58 Rar Hg ATK GB Project TestSlice tpr Y ETslicingi cob 0 x amp E Project Testslice tpr a S source ox JE Structural Complexi B slicing2 cob 0 rated B slicing3 cob 0 Cyclomatic Complexity 2 EE Simple without much risk More Jl Henry and Kafura Fan In Fan Out Complexity Classification 2 147483
19. derer EUROPEO I EROR DEEP COE UR DO Phe EH rrt MARKING ENTRIES eeeeeeee WHAT IS A TRANSFORMATION CREATING TRANSFORMATIONS Used Patch Templ tes s d eee eR RR tru i E EP eR Generic Patch Templates sia lana RR Re gre e oh inser p udis HESS cake WHAT IS A PATCH TEMPLATE CREATING PATCH TEMPLATES icone ee NX etn e X Ye REC PRENNE SUE EE E aaa LOADINGISTORED DATA tasado teen roris o Ore oe Oni inerte i Re THE TRANSFORMATION PROCESS MAT A A AAA aaa ada rag APPLYING TRANSEORMATIONS 00 dae PNE GENERATING THE TRANSFORMED PROGRAM esee en nnns tenent nns ee t esee nete seine nennen nennen nnns 3l EB VHROPBUOC 32 OVERVIEW E 32 WORKING WITH SLICING P 32 8 METRICS vrisana deiet eiaa aaie ocn E a a con eae aa ron aan anos asas anos no stent nanda 36 INTRODUCTION TO METRICS RENE e ERE Y RN VIRO UO RW ERE nen OE SIZE AND UNDERSTANDABILITY METRICS Line Counts Sos sano inar Lines of code LOC sLOC Comment lines AAA RD oO nte e dine en ende COMPLEXITY METRICS into tena dee eite au nts Cyclomatic complexity McCabe Cyel m ticsdensSity CR Structural fan in fan out Constantine de Yourdon eese esee 38 Informational fan in fan out and informational complexity Henry amp Kafura eene 39 Halstead s Software Science Coll
20. eb Site documentation generation including some colors and an icon image lt The properties description must be updated to the current version project gt Viewing a Program Text Window To view a program click on the program in the project tree A text window appears with the program source CARE Users Guide P g 14 de 46 Fie Edt Search View Acton Tools Heip Bis 8 Jaw xim SOFTWARE fS Project gaps tp OR ue BDECOOCY 9 GApolicationFiles GO TO VALIDA SCREEN 71 BDECOOCY B SDECO1GP cob 0 B BDECO26T 0 IP SC OPCAO MOT 1 BDECOOCY B BDEC4691 cob 0 MOVE W3 M36033 TO US S72 M36 BDECOOCV B BNSTOOLU cob 0 MOVE 1 TO EFEITOL OF DEC721I 9 Becks GO TO SEND SCREEN 72 BDECOOCV B BDECOOCV cob 0 B BDEDO DP cob 0 B BDED181P cob 0 MOVE 2 TO SC FLAG ALT BDECOOCV B BDED191P cob 0 MOVE 0 TO EFEITO VK BDECOOCV B BNOCO1CV cob 0 SC ID ACEIT BDECOOCY 9 ngm SC ID SACADOR BDECOOCV B BDEC212A cob 0 i SC NR ADENDA BDECOOCV B BHXIFECI cob 0 SC STATUS REG BDECOOCV B BNST233A cob 0 IF INFO SCREEN MUMBER WOT 72 BDECOOCV o p Markers GO TO TRATA SIBS SCR 71 BDECOOCY 3 Transformations IF EFTBANI OF DEC7211 NOT ZEROS BDECOOCV fq Patch Templates AND EFTDEPI OF DEC721I MOT ZEROS BDECOOCV AND EFTWUMEI OF DEC 211 BOT ZEROS BDECOOCY MOVE EFTBANI OF DEC Z11 TO SC EFT BANCO BDECOOCV MOVE EFTDEPI OF DEC7211 TO SC EFT BALCAO BDECOOCY MOVE EFTMUMEL OF DEC 211 TO SC EFT NUMERO BDECOO
21. ection of Properties eee 39 Mairitainability Index atada 40 SOFTWARE Depth Call A eec anibsp ual ooo ODIO aaa ERR 40 UNSTRUCTURABILITY METRICS dia 40 9 0 Tc Dead Code Nested conditionals eese eene sszeg ment s tessen rsdn per e n esee e ines seen ense see renes esser nas esee esses R S aSr 41 Nested LOOPS ta ur dU ERU HEN 41 INIA 41 9 ADVANCED FEATURES sisssssessscsscsssssssccssssssssssesscsssssccssassossossssssssssssocsssssssassessssessesassesesssscesssesesdesessossssse 45 RULE LIBRARIES octal ceca 45 ANALYSIS DATA st A a a O 45 DOCUMENTATION E aa 45 10 BATCH TRANSFORMATIONS ese sie venere eee sono eene Ee Cosa re a e epe e nor ne eoo P oa eH ose ona cho eU Too reae vine e ero since 43 11 EXAMPLES 46 CARE Users Guide P g 4 de 46 SOFTWARE P g 5 de 46 CARE Users Guide SOFTWARE 1 Introduction The CARE tool is an environment targeting the reengineering transformation and documentation of COBOL programs ss CARE version 1 0 only works with COBOL programs Future versions will allow other languages if the parsers of the language to the CARE internal AST format are available CARE Users Guide P g 6 de 46 SOFTWARE 2 Installation Setup The installation of CARE goes through the following steps 1 First you sho
22. egisted in CARE to perform more complex marking processes Query A marker based on a simple XPath query This marker result are all the Marker nodes retrieved by the query Example The marker with the expression movelidentifier name QOname NUM REG marks all the move statements that write on the NUM REG variable Equation A marker based on a system of equations defined by XPath queries An Marker equation is either a definition of a value an equality or a constraint This marker returns the tuple of nodes values satisfying all the equations Example Consider the following set of equations DecInst format 1 EQ size DecInst picture 12 CONST VarName SDecInst name EQ Format DecInst picture value EQ These equations will retrieve a result similar to the previous marker example VAR_12 For more Java A marker implemented by a Java class see External Java Classes for Marker details Include a detailed description about the semantics of the expressions used in the Equation marker Creating a marker El select the option New gt New Marker on the Project context menu or the option New Marker on the Marker Folder contex menu B in the case of an Equation Marker create delete equations using the buttons New and Remove For each equation do the following CARE Users Guide P g 22 de 46 Ark SOFTWARE e give the value name e introduce the expression e select the type Definition Eq
23. er Creating a Java Transformation EH Select the option New New Transformation Java Transformation on the Project context menu or the option New Transformation Java Transformation on the Transformations folder context menu A The Transformation Editor dialog for a new transformation appears Editing a transformation requires the user to supply the following information a name EJ Select the OK button E The transformation appears under the project s Transformations folder The typical situation is to have one marker for each transformation and the marker is usually the first to be specified Therefore it is also possible to create a default transformation from a given marker using the option New Transformation on the marker context menu This will immediately create a transformation already associated with the marker with the same name CARE Users Guide P g 24 de 46 Example Ark SOFTWARE Used Patch Templates In the Patch templates tab of the Transformation Editor dialog it is possible to add remove one or several patch templates to the transformation using the buttons Add Remove This association means that the execution of the transformation will apply the template to the main entry of the underlying marking see Marking entries What is a Patch Template However it is possible to apply a given template to a specific marking entry and another template to other marking entry Use the Edit butto
24. ersion doesn t allow marks to be produced incrementally E Markers are executed and a list of marks grouped by transformation name will appear under the program Each mark displays the name of the marker that produced it and the corresponding source program location If the mark relates to an external include file the name of the include file is visible eg a mark labelled DEC1 32 12 24 CBTW001 CPY was produced by marker DEC1 and corresponds to a program node between column 12 and 24 of line 32 of file CBTWO001 CPY Inspecting a mark 1 Click an a mark The window of the nronram soiirce annears CARE Users Guide P g 28 de 46 Ark SOFTWARE highlighting the mark location A Select the option Marking Details in the mark context menu The details dialog appears showing the information of all the entries of the mark e the entry name e entry value for strings or numbers or entry location for program nodes E Select the OK button to close the details dialog Validating a mark El Use the checkable option Enable in the mark context menu to enable disable the mark H The icon in the tree reflects the current state of the mark An icon with a cross ES or a dimmed icon represents a disabled mark Saving marking results El Select the option Save Marks in the program context menu or the save marks button a 2 The current state of the markings for the program is saved The next time the program tran
25. f unique or distinct operators appearing in that implementation e n2 Property number of unique or distinct operands appearing in that implementation e N1 Property total usage of all of the operators appearing in that implementation e N2 Property total usage of all of the operands appearing in that implementation e Vocabulary Property e Length Property Pag 39 de 46 CARE Users Guide AMX SOFTWARE e Volume Property e Difficulty Property e Effort Property Maintainability index The maintainability index is a combination of some of the previous metrics as a measure and a predictor of maintainability over time It relies on a equation that may be calibrated according to the type of system language being used The interpretation of the results may also vary from project to project With the default calibration the results may be analysed according to the following standard table Effort Value Difficult to maintain 65 Moderate to maintain 65 80 Easy to maintain gt 80 Depth of call tree This metric measures the depth of the forward procedure call tree for every procedure Unstructurability Metrics This group of metrics focuses on the use of language constructs that may contribute to the level of unstructurability of a program e g spaghetti like code complex logical structures etc GoTo s Counts the number of GOTO statements or the equivalent statement in the prog
26. g the number of linearly independent paths through a program module Cyclomatic complexity Number of branches 1 P g 37 de 46 CARE Users Guide AMX SOFTWARE What are branches Branches caused by conditional statements Usual conditional statements are If Then Else Switch Case For Loop and While For a procedure with no branches cyclomatic complexity equals 1 There is no maximum value since a procedure can have any number of branches A high cyclomatic complexity denotes a complex procedure that s hard to understand test and maintain There s a relationship between cyclomatic complexity and the risk in a procedure 1 10 A simple procedure without much risk 11 20 More complex moderate risk 21 50 Complex high risk gt 50 Untestable very high risk The original usual limit for a maximum acceptable value for cyclomatic complexity is 10 Other values such as 20 have also been suggested Regardless of the exact limit if cyclomatic complexity exceeds 20 you can consider it alarming Cyclomatic complexity equals the minimum number of test cases you must execute to cover every statement in your procedure This is important information for testing Carefully test procedures with the highest cyclomatic complexity values Cyclomatic density Cyclomatic complexity is usually higher in longer procedures How much decision is there actually compared to lines of code The cyclomatic den
27. he modifications to apply has to be done The tool allows the user to change the text of a calculated modification Example Consider the global change of variable formats from X 12 to X 14 The user may recognize that a specific variable reguires a change to X 15 Changing a modification EB Select the option Edit Patch in the patch context menu An editing window with the text of the patch appears 2 Change the text in the window E Select the OK button to commit the changes an The icon of the patch changes to represent that the patch was modified B The icon of the owner mark also changes to signal that it contains modified elements B lt picture with patches and modified patches gt CARE Users Guide P g 30 de 46 Ark SOFTWARE Generating the transformed program The last activity of the transformation process is to produce the final transformed program This is the result of applying all the existing enabled and changed patches to the original program Generating a transformed program El Select the option Generate in the program context menu or select the Generate button Ed E The process of merging the modifications into the original source program is executed Any error occurring during the process is reported to the output window E A file with the same name of the original one containing the transformed program is created in the new directory under the project root directory n The tra
28. it Window A window allowing edit or display operations on the representation of a concept text or graphs Navigator A small window allowing the user to navigate easily over large graphical representations Output Window The window where error and informational messages are displayed Working with Projects To work with a set of programs it is required to create a project where all the necessary relevant source files will be included A project is a working unit with specific customizations and definitions that are valid for the operations performed on that project It also allows batch and multiple file processing optimizing time and resources in longer operations Several projects maybe open simultaneously in CARE A project is defined for one of the programming languages available and is selected at project creation time The project language cannot be changed Current version of CARE do not support multi language projects Creating a project Fl Before creating a project in the tool is a good idea to organize the source files under a project tree Create a directory in the disk for the project that you want to create lt project_dir gt Create a sub directory of that one eg programs and put the hierarchy of source files you want to work with inside If your sources use include files copybooks its also a good idea to create a sub directory under the project directory to hold these files Choose File gt New Project
29. ke accesses a number of global variables but calls no other procedures may be very complex yet its structural fan out is zero Informational fan in estimates the information a procedure reads Informational fan in Procedures called parameters referenced global variables referenced Informational fan out estimates the information a procedure returns Informational fan out Procedures that call this procedure by reference parameters assigned to global variables assigned to Combined these give a new metric informational fan in x fan out This is reportedly good in predicting the effort needed for implementing a procedure but not so good at measuring complexity To measure complexity we need a new metric informational complexity It is calculated as follows Informational complexity lines of code x informational fan in x informational fan out Watching for procedures with high informational complexity can reveal the following issues procedure has more than one function procedure is a stress point in the system with information traffic procedure has excessive functional complexity High informational complexity indicates candidate procedures for extensive testing or redesign Halstead s Software Science Collection of Properties Halstead s metrics measure the computational complexity of a program module based on the counting of operators and operands They include the following properties e nl Property number o
30. lect the option New Slice in the file context menu Select the program elements of the slice criterion by Give a name for the slice in the dialog box that appears e g product position the cursor over the variable declaration statement to include in the criterion select the Add Statement or Add Variable from the file context menu or the corresponding toolbar button The selected elements are presented in the criterion folder for the slice They are also highlighted in the program with a different colour E CARE Reengineering Environment version 2 0 2 2004 File Edit View Actions Tools Help S BO BBEm EX Rik B slicingt cob 0 B slicingt cob x 6 a we 19 e B 2 B 000151 01 N PIC 999 03890000 A 000152 01 I PIC 999 03900000 E E slicingi cob EE 000153 01 SUR PIC 999 03910000 gg CriterionFolder 00154 01 PRODUCT PIC 999 03920000 PRODUCT 000155 Ol AVERAGE PIC 999 03920000 18 43 43 000160 PROCEDURE DIVISION 03930000 000161 THE SECTION 03940000 000162 INIT 03950000 000163 MOVE 10 TO N 03960000 000164 MOVE 1 TO I 03970000 000165 MOVE O TO SUMR 03980000 000166 MOVE O TO AVERAGE 03980000 000167 MOVE 1 TO PRODUCT 03990000 000168 MAIN 04000000 000169 IFI N 03880000 000170 G0 TO LOOP 03880000 000171 COMPUTE AVERAGE SUMR N 03880000 000172 DISPLAY I 03880000 000173 DISPLAY SUMR 03880000 000175 DISPLAY AVERAGE 03880000 000176 EXIT PROGRAM 03880000 000177 LOOP 0388
31. les in the project context menu see Auxiliar Program Data for details Select the option Process Marking in the project context menu in order to perform the Marking activity on all the project programs or use the option in the program context menu in order to process the selected programs A batch marking process is started using the enabled transformations defined in the project A message dialog about the status of the process is displayed Wait until all the programs are processed The project tree now presents a different icon for the programs where markings where found and saved Es Perform the Validation activity on the desired programs by e opening the program double click on it e inspect enable disable save the marks as described in Marking Close all the programs In the project browser select the option Process Generate in the project context menu or in the program context menu in order to perform the Generation activity A batch generation process is started A message dialog about the status of the process is displayed Wait until all the programs are processed The project tree now presents a different icon for the programs where a transformed file was produced E Open the program in order to view the transformed file and the patches introduced Proceed as in Deleting patch comments if you require the programs to be cleaned up P g 43 de 46 CARE Users Guide AMX SOFTWARE Note Please
32. lity and more errors Complex code needs more time to develop test and maintain Therefore excessive complexity should be avoided There are many kinds of software complexity e Structural complexity comes from conditional statements loops and the relationships between program structure elements procedures functions etc and files Structural complexity relates with the control flow at run time e Psychological complexity means how difficult it is to understand a program This is very closely related to structural complexity e Informational complexity is about how data moves in a program How much data goes into a procedure and how much comes out This is a data flow issue e Mathematical computational complexity is about how much time and memory it takes to execute an algorithm High complexity may result in bad understandability and more errors Complex procedures also need more time to develop and test High complexity is also a problem for integrating new features when evolving a system Therefore excessive complexity should be avoided Although size can be used to measure complexity to reach better results more advanced complexity metrics are required Cyclomatic complexity McCabe Cyclomatic complexity is probably the most widely used complexity metric in software engineering It s easy to understand easy to calculate and it gives useful results It s a measure of the structural complexity of a procedure countin
33. n to change the name of the target marking entry for the selected template in the list Please note that only the listed templates will be applied during the transformation There is another way of specifying the applied templates using matching criteria Generic Patch Templates In the Generic Patches tab you may specify a list of identifiers This means that all the templates in the project s template list that match the identifier and are valid will be applied Why using template matching With this definition adding removing templates to a transformation do not change the transformation definition and the rules on whether to apply or not a template rely only on the templates themselves Example If for a given transformation of call statements we say that it uses templates matching the identifier EXTCALL we may define the templates to apply just by adding to the project template database for example e a template EXTCALL BEFORE to insert some instruction before e atemplate EXTCALL WORKING STORAGE to declare new variables if needed e atemplate EXTCALLGPROCEDURE DIVISION to insert copy statements e several conditional EXTCALLGREPLACE to replace some information on the call statement depending on the case Although the CARE tool provides this declarative way of defining the applicable templates it is advisable to use the first alternative to remain with a consistent and complete definition of transformation P g 25 de 46
34. nsformed file appears as a node in the transformation browser B containing references to the locations of all the patches inserted in the program during the process A modification of the program appears enclosed in comments including extra information about the original location of the modified code and the transformation that originated it See Project Properties for customizing these comments picture with a generated program showing the patches Deleting patch comments E Select the option in the program context menu program transformation tree or the option Process gt CleanUp in the project context menu or in the program context menu project browser E The corresponding files will be updated as the comment lines introduced by the transformation process are deleted P g 31 de 46 CARE Users Guide SOFTWARE 6 RT Slicing Overview Program slicing is a technique for simplifying programs by focusing on selected aspects of semantics The process of slicing deletes those parts of the program which can be determined to have no effect upon the semantics of interest resulting in a slice of the original program The slicing technique has applications in many areas like re engineering program comprehension and software measurement Formally a static program slice consists of all statements in a program that may affect the value of a given variable v at some point p The slice is defined for a slicing criterion
35. oject against a set of generic patch identifiers CARE allows to only to specify simple mapping transformations As with markers if other mappings are required with complex conditions and algorithms a Java class can be used to specify them and registered in the tool Sometimes the transformations and the associated markers cannot acquire all the information from the program in order to apply the correct modifications To allow users to add extra information the concept of Qualifier is used A qualifier is specified in the transformation definition P g 23 de 46 CARE Users Guide AMX SOFTWARE and the user may assign a value for it in each place where the transformation is going to be applied during the transformation process see Creating Transformations Creating a Simple Transformation EH Select the option New New Transformation Simple Transformation on the Project context menu or the option New Transformation Simple Transformation on the Transformations folder context menu E The Transformation Editor dialog for a new transformation appears Editing a transformation requires the user to supply the following information a name a set of markers a set of used patch templates optional a set of id s for matching the existing templates under the Generic Patches tab optional a set of qualifier names EJ Select the OK button Ej The transformation appears under the project s Transformations fold
36. ramming language Dead Code Counts the number of dead code blocks in a program A block is a sequence of statements that execute as a whole without any branches in between The metric focuses on blocks instead of statements to provide a measure of dead places in the program instead of individual statement count CARE Users Guide P g 40 de 46 Ark SOFTWARE Nested conditionals Nested conditionals or depth of conditional nesting is related to cyclomatic complexity Whereas cyclomatic complexity deals with the absolute number of branches nested conditionals counts how deeply nested these branches are The recommended maximum for nested conditionals is 5 More nesting levels make the code difficult to understand and can lead to errors in program logic If you have too many levels consider splitting the procedure You may also find a way to rewrite the logic with a Switch Case statement or an easier to read If Then Elself Else structure Although it might seem to give a lower figure it s not recommended to join multiple conditions into a single big condition involving lots of And Or and Not logical operators Nested loops Nested loops is a very rough estimate of the mathematical complexity of a procedure The more nested loops there are in a procedure the more likely it is that those loops take up a significant amout of time to execute A maximum of 2 loops in a procedure is the recommended number CARE Metri
37. sformation tree is open the saved marks will appear lt picture mark result with disabled marks gt Applying transformations Applying transformations is the activity of calculating the potential modifications patches on the original program caused by the enabled transformations marks Each transformation produces one of several modifications that is anchored in a mark Applying the transformations to a program El Select the option Apply Transformations in the program context menu or select the Apply button EB A All the enabled marks transformations in the program transformation tree will he executed nraducing the corresnondino P g 29 de 46 CARE Users Guide AMX SOFTWARE modifications patches El that appear under the mark Each patch is labeled by the template name that originate it or by a specific label otherwise Similarly with the marks the user may check if a modification is in fact a valid modification Disabled modifications will not be considered in the final transformed program Validating a modification EB Use the checkable option Enable in the patch context menu to enable disable the patch A The icon in the tree reflects the current state of the patch An icon with a cross B or a dimmed icon represents a disabled patch Sometimes a transformation is valid but the used patch templates only were able to define the most common situation If a specific case is reguired some tuning in t
38. sity allow us to see if the complexity comes from the length of a procedure or from its intrinsic complexity Cyclomatic density Cyclomatic complexity logical lines of code Structural fan in fan out Constantine amp Yourdon For procedures Structural fan in number of procedures that call a given procedure Structural fan out number of procedures the procedure calls For files Structural fan in number of files that require this file to compile or run Structural fan out number of files this file depends on A file depends on another file if it requires the other file to compile or run A high structural fan in denotes reusable code That s especially true for procedures that are called from many places in the program It may also be true for files However excessive dependencies between files are not desirable CARE Users Guide P g 38 de 46 Ark SOFTWARE A high structural fan out denotes strongly coupled code The code depends on other code and is probably more complex too A low or zero fan out means independent self sufficient code which is easy to migrate from a project to another Informational fan in fan out and informational complexity Henry amp Kafura Lines of code cyclomatic complexity or structural fan out are not perfect in predicting the real complexity of a procedure They are based on control flow in the code However they don t take data flow into account For example a procedure ta
39. t gt E Transformations amp Slicing 32 67 D Work CARE OLD_VERSION_3 Examples Slicing source slicing cab E Output Finished E Select the option Export Results from the context menu or the corresponding toolbar button B The sub program constructed from the slice results is presented in the editor window For the example program above the backward product slicing including the propuct variable declaration and the DISPLAY PRODUCT statement produces the following resulting sub program LINKAGE SECTION 01 N PING SEG 01 I pro 929 a 01 PRODUCT BIC GEC PROCEDURE DIVISION INTE MOVE 10 TO N MOVER ONSE CARE Users Guide P g 34 de 46 ES SOFTWARE MOVE 1 TO PRODUCT MAIN BED lt N GO TO LOOP DISPLAY PRODUCT EXIT PROGRAM EXIT PROGRAM LOOP MULTIPLY I BY PRODUCT ADD EO IES GO TO MAIN Notice that this program excludes all the statements related with the average or the sum As another example the slice including the AVERAGE variable declaration and the DISPLAY AVERAGE statement produces the following result Notice that now the variables and statements related with the product are excluded which are not relevant for the average calculation LINKAGE SECTION 01 N 01 I 01 SUMR 01 AVERAGE PROCEDURE DIVISION INIT MOVE 10 TO N MOVE 1 TO I MOVE 0 TO SUMR MOVE 0 TO AVERAGE MAIN IF I lt N GO TO LOOP COMPUTE AVERAGE DISPLAY AVE
40. t Properties The following project properties may be edited by the user using the option Properties in the project context menu General Source File A list of the valid extensions for source files in the form xxx extensions User Properties User defined string values that may be used in the comments produced with the file transformations Xml Data Check this if you want auxiliary xml data files to be stored in zip Compression mode see Auxiliar program data Includes Include Check this if you want the representation of programs to include Copybooks the information of the copybooks If copybooks are not included queries on a program will not consider the included information for retrieving the results Include A list of directories where to search the copybook files Directories P g 13 de 46 CARE Users Guide SOFTWARE Copybook A list of the valid extensions for copybook files extensions SetUp Check the data that will be produced when a setup operation is performed see Additional project program operations Change Text The text that will be inserted in the transformed files signaling the applied patches The text may be different according to the kind of patch In the text several variables may be used as variable A variable may be a defined User Property or a default property Default properties are LINE END_LINE RULE TIME DATE Documentation Several layout properties of the W
41. the size of a project is to count the lines This is the oldest and most widely used size metric Lines of code LOC sLOC There are several ways to count lines 1 Physical lines 2 Physical lines of code excluding empty lines and comments 3 Statements a statement may be spread by several lines or many statements in the same line These metrics are usually referred to as the LOC lines of code or sLOC source lines of code metrics Since there are several ways to calculate LOC sLOC you have to be careful about which metric definition is used when working with the calculated metrics values Especially when measuring programmers performance the line counts aren t perfect One programmer may produce a large number of lines CARE Users Guide P g 36 de 46 Ark SOFTWARE while the other spends a long time and succeeds in squeezing the same function in a small space CARE reports as lines of code the metric of type 1 and 3 Since line counts can vary between programming languages and coding styles the most uniform way to have a uniform volume metric is counting the statements of the language Comment lines This metric measures the amount of comment lines in a program Combining this value to the previous ones gives a measure of the ratio between comments and executable code in order to evaluate how well commented a program is Complexity Metrics High complexity in code may result in bad understandabi
42. uation Constraint e select if the equation define the main value of the marking or just a parameter select if the equation define a multiple value a list of values or a single value El Select the OK button E The new marker appears under the project s Markers folder The option Edit in the Marker context menu will open the edit dialog and allows to update the marker information Marking entries The entries of a marking are classified as follows e main entry it has to be a structural node represents the default location associated with the marking parameter entry may be a node or a value represents additional data that may be used in the transformation e named entry any entry may have an associated name that can used to reference the associated value Entries resulting from Equation markers are always named Other marker types may produce unnamed entries What is a Transformation A Transformation is the central unit of a transformation process When a transformation process is activated the transformations are the concepts that defines which markers should be executed and which patches should be applied The specification of a transformation is therefore a mapping between the result of the used markers into the applied patches A transformation may define the Patch Templates to apply in two different ways by indicating a set of specific patch templates or by matching the existing patch templates in the pr
43. uld choose the required installation type to perform an installation without a JVM and use one previously installed on the computer or to perform an installation including a JVM dedicated for CARE 2 Execute the supplied setup file according to the chosen installation type Introduction InstallAnywhere will guide you through the installation of CARE Itis strongly recommended that you quit all programs before continuing with this installation Choose BHOTTCUEEGITHET e pre netalleion summary Click the Next button to proceed to the next screen If you wantto e installing change something on a previous screen click the Previous button install Complete You may cancel this installation at any time by clicking the Cancel button Cancel 3 Supply the information required in the different installation steps When using an existing JVM it is necessary to select one of them it must be a JVM 1 4 1 or superior Confirm the information and click on the Install button Pre Installation Summary Please Review the Following Before Continuing Product Name CARE Pre Installation Summary a netallina Install Folder install Complete m pecu Shortcut Folder CADocuments and SettingsygouveialStart Menu Programs CARE Disk Space Information for Installation Target Required 11 117 976 bytes Available 243 998 720 bytes
44. y achieved by externally assembling into a library xml file all the required xml element definitions taken from project data files lt project gt tpr xml Transformations Execution P g 27 de 46 CARE Users Guide SOFTWARE 5 The Transformation Process The transformation process includes the following activities e marking a program e applying the transformations to obtain the modification patches e produce the final transformed program Marking The marking activity of a program may be summarized as follows When marking is triggered all the enabled markers of all the enabled transformations are executed They produce a set of markings that will be displayed under the program tree grouped by transformation After the creation of the marks the user may check their details and validate if a mark is in fact a valid mark Disabled marks will not be considered in the rest of the transformation process At anytime the user may save the marking results and its current state to proceed with the transformation process in a future session Marking a program El Open the program to mark by clicking on it in the project browser tree The text editor will present the program source code and the program transformation tree appears E Select the option Marking in the program context menu or the marking button Es If the option is disabled you may need to use the option Remove Marks to remove previously calculated marks This v
Download Pdf Manuals
Related Search
Related Contents
SCRIPTSWITCH CENTRALISED REPORTING USER MANUAL AVAILABLE ONLY IN Korea,Japan and Taiwan THE RISK PRIORITY ASSESSMENT METHOD (RPA) 取扱説明書 información técnica www.nintendo.com MVF Series User Manual Guide for TM-U220 Right Side Up Printing Copyright © All rights reserved.
Failed to retrieve file