Misplaced Pages

GXL

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

GXL ( Graph eXchange Language ) is designed to be a standard exchange format for graphs . GXL is an extensible markup language ( XML ) sublanguage and the syntax is given by an XML document type definition (DTD). This exchange format offers an adaptable and flexible means to support interoperability between graph-based tools.

#707292

59-485: In particular, GXL was developed to enable interoperability between software reengineering tools and components, such as code extractors (parsers), analyzers and visualizers. GXL allows software reengineers to combine single-purpose tools especially for parsing, source code extraction, architecture recovery, data flow analysis, pointer analysis, program slicing, query techniques, source code visualization, object recovery, restructuring, refactoring, remodularization, etc., into

118-399: A directed edge connects two nodes if the second command might be executed immediately after the first command. Cyclomatic complexity may also be applied to individual functions , modules , methods , or classes within a program. One testing strategy, called basis path testing by McCabe who first proposed it, is to test each linearly independent path through the program. In this case,

177-442: A "word" (or function ) into smaller, more easily maintained functions. Refactorings can also be reconstructed posthoc to produce concise descriptions of complex software changes recorded in software repositories like CVS or SVN. Many software editors and IDEs have automated refactoring support. Here is a list of a few of these editors, or so-called refactoring browsers . Cyclomatic complexity Cyclomatic complexity

236-439: A (connected) control-flow graph is considered a one-dimensional CW complex called X {\displaystyle X} , the fundamental group of X {\displaystyle X} will be π 1 ( X ) ≅ Z ∗ n {\displaystyle \pi _{1}(X)\cong \mathbb {Z} ^{*n}} . The value of n + 1 {\displaystyle n+1}

295-442: A class, for example). In these cases, P will equal the number of programs in question, and each subprogram will appear as a disconnected subset of the graph. McCabe showed that the cyclomatic complexity of a structured program with only one entry point and one exit point is equal to the number of decision points ("if" statements or conditional loops) contained in that program plus one. This is true only for decision points counted at

354-411: A module, all execution paths through the module should be exercised. This implies a module with a high complexity number requires more testing effort than a module with a lower value since the higher complexity number indicates more pathways through the code. This also implies that a module with higher complexity is more difficult to understand since the programmer must understand the different pathways and

413-408: A program that consists of two sequential if-then-else statements. In this example, two test cases are sufficient to achieve a complete branch coverage, while four are necessary for complete path coverage. The cyclomatic complexity of the program is 3 (as the strongly connected graph for the program contains 9 edges, 7 nodes, and 1 connected component) ( 9 − 7 + 1 ). In general, in order to fully test

472-409: A program with multiple exit points. In this case, it is equal to π − s + 2 , {\displaystyle \pi -s+2,} where π {\displaystyle \pi } is the number of decision points in the program and s is the number of exit points. An even subgraph of a graph (also known as an Eulerian subgraph ) is one in which every vertex

531-559: A programmer could click on the name of a variable and then select the "Encapsulate field" refactoring from a context menu . The IDE would then prompt for additional details, typically with sensible defaults and a preview of the code changes. After confirmation by the programmer it would carry out the required changes throughout the code. While the term refactoring originally referred exclusively to refactoring of software code, in recent years code written in hardware description languages has also been refactored. The term hardware refactoring

590-592: A single powerful reengineering workbench. There are two innovative features in GXL that make it well-suited to an exchange format for software data. Since GXL is a general graph exchange format, it can also be used to interchange any graph-based data, including models between computer-aided software engineering (CASE) tools, data between graph transformation systems , or graph visualization tools. GXL includes support for hypergraphs and hierarchical graphs, and can be extended to support other types of graphs. GXL originated in

649-418: Is incident with an even number of edges. Such subgraphs are unions of cycles and isolated vertices. Subgraphs will be identified with their edge sets, which is equivalent to only considering those even subgraphs which contain all vertices of the full graph. The set of all even subgraphs of a graph is closed under symmetric difference , and may thus be viewed as a vector space over GF(2) . This vector space

SECTION 10

#1732855906708

708-404: Is a software metric used to indicate the complexity of a program . It is a quantitative measure of the number of linearly independent paths through a program's source code . It was developed by Thomas J. McCabe, Sr. in 1976. Cyclomatic complexity is computed using the control-flow graph of the program. The nodes of the graph correspond to indivisible groups of commands of a program, and

767-421: Is called the cycle space of the graph. The cyclomatic number of the graph is defined as the dimension of this space. Since GF(2) has two elements and the cycle space is necessarily finite, the cyclomatic number is also equal to the 2-logarithm of the number of elements in the cycle space. A basis for the cycle space is easily constructed by first fixing a spanning forest of the graph, and then considering

826-487: Is improved performance; software engineers face an ongoing challenge to write programs that perform faster or use less memory. Typically, refactoring applies a series of standardized basic micro-refactorings , each of which is (usually) a tiny change in a computer program's source code that either preserves the behavior of the software, or at least does not modify its conformance to functional requirements. Many development environments provide automated support for performing

885-460: Is in determining the number of test cases that are necessary to achieve thorough test coverage of a particular module. It is useful because of two properties of the cyclomatic complexity, M , for a specific module: All three of the above numbers may be equal: branch coverage ≤ {\displaystyle \leq } cyclomatic complexity ≤ {\displaystyle \leq } number of paths. For example, consider

944-483: Is intended to improve the design, structure, and/or implementation of the software (its non-functional attributes), while preserving its functionality . Potential advantages of refactoring may include improved code readability and reduced complexity ; these can improve the source code ' s maintainability and create a simpler, cleaner, or more expressive internal architecture or object model to improve extensibility . Another potential goal for refactoring

1003-406: Is not the union of edge sets of the paths in some subset of S / P {\displaystyle S/P} . If the source code contained no control flow statements (conditionals or decision points) the complexity would be 1, since there would be only a single path through the code. If the code had one single-condition IF statement , there would be two paths through the code: one where

1062-530: Is the cyclomatic complexity. The fundamental group counts how many loops there are through the graph up to homotopy, aligning as expected. In his presentation "Software Quality Metrics to Identify Risk" for the Department of Homeland Security, Tom McCabe introduced the following categorization of cyclomatic complexity: One of McCabe's original applications was to limit the complexity of routines during program development. He recommended that programmers should count

1121-412: Is to store all projects in a single repository , known as monorepo . With unit testing in place, refactoring is then an iterative cycle of making a small program transformation , testing it to ensure correctness, and making another small transformation. If at any point a test fails, the last small change is undone and repeated in a different way. Through many small steps the program moves from where it

1180-494: Is used as a shorthand term for refactoring of code in hardware description languages. Since hardware description languages are not considered to be programming languages by most hardware engineers, hardware refactoring is to be considered a separate field from traditional code refactoring. Automated refactoring of analog hardware descriptions (in VHDL-AMS ) has been proposed by Zeng and Huss. In their approach, refactoring preserves

1239-576: The code smells form, a subsequent developer carries out the actual refactoring action. Refactoring requires extracting software system structure, data models, and intra-application dependencies to get back knowledge of an existing software system. The turnover of teams implies missing or inaccurate knowledge of the current state of a system and about design decisions made by departing developers. Further code refactoring activities may require additional effort to regain this knowledge. Refactoring activities generate architectural modifications that deteriorate

SECTION 20

#1732855906708

1298-419: The hardware on which it runs, for example, to take advantage of parallel processors and vector units. There are two possible times for refactoring. A method that balances preventive and corrective refactoring is "shared responsibility for refactoring". This approach splits the refactoring action into two stages and two roles. The original developer of the code just prepares the code for refactoring, and when

1357-615: The Design of Existing Code is the canonical reference. The terms "factoring" and "factoring out" have been used in this way in the Forth community since at least the early 1980s. Chapter Six of Leo Brodie 's book Thinking Forth (1984) is dedicated to the subject. In extreme programming, the Extract Method refactoring technique has essentially the same meaning as factoring in Forth; to break down

1416-465: The IF statement is TRUE and another one where it is FALSE. Here, the complexity would be 2. Two nested single-condition IFs, or one IF with two conditions, would produce a complexity of 3. Another way to define the cyclomatic complexity of a program is to look at its control-flow graph , a directed graph containing the basic blocks of the program, with an edge between two basic blocks if control may pass from

1475-476: The NIST Structured Testing methodology, is to use the cyclomatic complexity of a module to determine the number of white-box tests that are required to obtain sufficient coverage of the module. In almost all cases, according to such a methodology, a module should have at least as many tests as its cyclomatic complexity. In most cases, this number of tests is adequate to exercise all the relevant paths of

1534-490: The complexity of the modules they are developing, and split them into smaller modules whenever the cyclomatic complexity of the module exceeded 10. This practice was adopted by the NIST Structured Testing methodology, which observed that since McCabe's original publication, the figure of 10 had received substantial corroborating evidence. However, it also noted that in some circumstances it may be appropriate to relax

1593-439: The control-flow graphs (CFGs) of non- structured programs look like in terms of their subgraphs, which McCabe identified. (For details, see structured program theorem .) McCabe concluded that section by proposing a numerical measure of how close to the structured programming ideal a given program is, i.e. its "structuredness". McCabe called the measure he devised for this purpose essential complexity . To calculate this measure,

1652-490: The cycles formed by one edge not in the forest and the path in the forest connecting the endpoints of that edge. These cycles form a basis for the cycle space. The cyclomatic number also equals the number of edges not in a maximal spanning forest of a graph. Since the number of edges in a maximal spanning forest of a graph is equal to the number of vertices minus the number of components, the formula E − N + P {\displaystyle E-N+P} defines

1711-418: The cyclomatic number. Cyclomatic complexity can also be defined as a relative Betti number , the size of a relative homology group: M := b 1 ( G , t ) := rank ⁡ H 1 ( G , t ) , {\displaystyle M:=b_{1}(G,t):=\operatorname {rank} H_{1}(G,t),} which is read as "the rank of the first homology group of

1770-401: The design of code, we make it easier and easier to work with. This is in sharp contrast to what typically happens: little refactoring and a great deal of attention paid to expediently add new features. If you get into the hygienic habit of refactoring continuously, you'll find that it is easier to extend and maintain code. Refactoring is usually motivated by noticing a code smell . For example,

1829-434: The designers' productivity. The first known use of the term "refactoring" in the published literature was in a September, 1990 article by William Opdyke and Ralph Johnson . Although refactoring code has been done informally for decades, William Griswold 's 1991 Ph.D. dissertation is one of the first major academic works on refactoring functional and procedural programs, followed by William Opdyke 's 1992 dissertation on

GXL - Misplaced Pages Continue

1888-505: The domain of software reengineering and graph transformation. During the APPLIGRAPH Subgroup Meeting on Exchange Formats for Graph Transformation, an overview of GXL was given [Schürr, 2000] and participants decided to use GXL to represent graphs within their exchange format for graph transformation systems (GTXL). The 2000 IBM Centers for Advanced Studies Conference ( CASCON 2000) included two half-day workshops on GXL. In

1947-400: The entry point, there is at least one such cycle for each exit point. For a single program (or subroutine or method), P always equals 1; a simpler formula for a single subroutine is M = E − N + 2. {\displaystyle M=E-N+2.} Cyclomatic complexity may be applied to several such programs or subprograms at the same time (to all of the methods in

2006-402: The first to the second. The complexity M is then defined as M = E − N + 2 P , {\displaystyle M=E-N+2P,} where An alternative formulation of this, as originally proposed, is to use a graph in which each exit point is connected back to the entry point. In this case, the graph is strongly connected . Here, the cyclomatic complexity of

2065-434: The following groups from industry and academics committed to refining GXL to be the standard graph exchange format, write GXL filters and tools or use GXL as exchange format in their tools: Reengineering (software) In computer programming and software design , code refactoring is the process of restructuring existing source code —changing the factoring —without changing its external behavior. Refactoring

2124-432: The frequency of defects occurring in a function or method. Some studies find a positive correlation between cyclomatic complexity and defects; functions and methods that have the highest complexity tend to also contain the most defects. However, the correlation between cyclomatic complexity and program size (typically measured in lines of code ) has been demonstrated many times. Les Hatton has claimed that complexity has

2183-401: The function. As an example of a function that requires more than mere branch coverage to test accurately, reconsider the above function. However, assume that to avoid a bug occurring, any code that calls either f1() or f3() must also call the other. Assuming that the results of c1() and c2() are independent, the function as presented above contains a bug. Branch coverage allows

2242-815: The graph G relative to the terminal nodes t ". This is a technical way of saying "the number of linearly independent paths through the flow graph from an entry to an exit", where: This cyclomatic complexity can be calculated. It may also be computed via absolute Betti number by identifying the terminal nodes on a given component, or drawing paths connecting the exits to the entrance. The new, augmented graph G ~ {\displaystyle {\tilde {G}}} obtains M = b 1 ( G ~ ) = rank ⁡ H 1 ( G ~ ) . {\displaystyle M=b_{1}({\tilde {G}})=\operatorname {rank} H_{1}({\tilde {G}}).} It can also be computed via homotopy . If

2301-500: The inner-state of software system structure, data models, and intra-components dependencies is a critical element to form a high-level understanding and then refined views of what needs to be modified, and how. Automatic unit tests should be set up before refactoring to ensure routines still behave as expected. Unit tests can bring stability to even large refactors when performed with a single atomic commit . A common strategy to allow safe and atomic refactors spanning multiple projects

2360-401: The lowest, machine-level instructions. Decisions involving compound predicates like those found in high-level languages like IF cond1 AND cond2 THEN ... should be counted in terms of predicate variables involved. In this example, one should count two decision points because at machine level it is equivalent to IF cond1 THEN IF cond2 THEN ... . Cyclomatic complexity may be extended to

2419-423: The mechanical aspects of these basic refactorings. If done well, code refactoring may help software developers discover and fix hidden or dormant bugs or vulnerabilities in the system by simplifying the underlying logic and eliminating unnecessary levels of complexity. If done poorly, it may fail the requirement that external functionality not be changed, and may thus introduce new bugs. By continuously improving

GXL - Misplaced Pages Continue

2478-575: The merger of GRAph eXchange format (GraX: University of Koblenz, DE) for exchanging typed, attributed, ordered, directed graphs (TGraphs), Tuple Attribute Language (TA: University of Waterloo, CA), and the graph format of the PROGRES graph rewriting system (University Bw München, DE). Furthermore, GXL includes ideas from exchange formats from reverse engineering, including Relation Partition Algebra (RPA: Philips Research Eindhoven, NL) and Rigi Standard Format (RSF: University of Victoria, CA). The development of GXL

2537-520: The method at hand may be very long, or it may be a near duplicate of another nearby method. Once recognized, such problems can be addressed by refactoring the source code, or transforming it into a new form that behaves the same as before but that no longer "smells". For a long routine, one or more smaller subroutines can be extracted; or for duplicate routines, the duplication can be removed and replaced with one shared function. Failure to perform refactoring can result in accumulating technical debt ; on

2596-433: The method to be tested with just two tests, such as the following test cases: Neither of these cases exposes the bug. If, however, we use cyclomatic complexity to indicate the number of tests we require, the number increases to 3. We must therefore test one of the following paths: Either of these tests will expose the bug. Multiple studies have investigated the correlation between McCabe's cyclomatic complexity number with

2655-490: The morning, 'Software Data Interchange with GXL: Introduction and Tutorial' gave a primer on the syntax and concepts in the format, while the afternoon workshop, 'Software Data Interchange with GXL: Implementation Issues' discussed the development of converters and standard schemas. At the Seventh Working Conference on Reverse Engineering (WCRE 2000), GXL was presented in a tutorial [Holt et al. , 2000] and during

2714-439: The number of test cases will equal the cyclomatic complexity of the program. There are multiple ways to define cyclomatic complexity of a section of source code . One common way is the number of linearly independent paths within it. A set S {\displaystyle S} of paths is linearly independent if the edge set of any path P {\displaystyle P} in S {\displaystyle S}

2773-437: The original CFG is iteratively reduced by identifying subgraphs that have a single-entry and a single-exit point, which are then replaced by a single node. This reduction corresponds to what a human would do if they extracted a subroutine from the larger piece of code. (Nowadays such a process would fall under the umbrella term of refactoring .) McCabe's reduction method was later called condensation in some textbooks, because it

2832-457: The other hand, refactoring is one of the primary means of repaying technical debt. There are two general categories of benefits to the activity of refactoring. Performance engineering can remove inefficiencies in programs, known as software bloat, arising from traditional software-development strategies that aim to minimize an application's development time rather than the time it takes to run. Performance engineering can also tailor software to

2891-424: The program is equal to the cyclomatic number of its graph (also known as the first Betti number ), which is defined as M = E − N + P . {\displaystyle M=E-N+P.} This may be seen as calculating the number of linearly independent cycles that exist in the graph: those cycles that do not contain other cycles within themselves. Because each exit point loops back to

2950-456: The refactoring of object-oriented programs, although all the theory and machinery have long been available as program transformation systems. All of these resources provide a catalog of common methods for refactoring; a refactoring method has a description of how to apply the method and indicators for when you should (or should not) apply the method. Martin Fowler 's book Refactoring: Improving

3009-424: The restriction and permit modules with a complexity as high as 15. As the methodology acknowledged that there were occasional reasons for going beyond the agreed-upon limit, it phrased its recommendation as "For each module, either limit cyclomatic complexity to [the agreed-upon limit] or provide a written explanation of why the limit was exceeded." Section VI of McCabe's 1976 paper is concerned with determining what

SECTION 50

#1732855906708

3068-435: The results of those pathways. Unfortunately, it is not always practical to test all possible paths through a program. Considering the example above, each time an additional if-then-else statement is added, the number of possible paths grows by a factor of 2. As the program grows in this fashion, it quickly reaches the point where testing all of the paths becomes impractical. One common testing strategy, espoused for example by

3127-413: The same predictive ability as lines of code. Studies that controlled for program size (i.e., comparing modules that have different complexities but similar size) are generally less conclusive, with many finding no significant correlation, while others do find correlation. Some researchers question the validity of the methods used by the studies finding no correlation. Although this relation likely exists, it

3186-415: The simulated behavior of a hardware design. The non-functional measurement that improves is that refactored code can be processed by standard synthesis tools, while the original code cannot. Refactoring of digital hardware description languages, albeit manual refactoring, has also been investigated by Synopsys fellow Mike Keating. His target is to make complex systems easier to understand, which increases

3245-420: The structural architecture of a software system. Such deterioration affects architectural properties such as maintainability and comprehensibility which can lead to a complete re-development of software systems. Code refactoring activities are secured with software intelligence when using tools and techniques providing data about algorithms and sequences of code execution. Providing a comprehensible format for

3304-594: The workshop on exchange formats [Holt/Winter, 2000]. Central results were a simpler representation of ordering information, the usage of UML class diagrams to present graph schemata and the representation of UML class diagrams by GXL graphs. The Dagstuhl Seminar on Interoperability of Reengineering Tools ratified GXL 1.0 as a standard interchange format for exchanging reengineering related data. Numerous groups from industry and research committed to using GXL, to import and export GXL documents to their tools, and to write various GXL tools. During various conferences and workshops

3363-427: Was also influenced by various formats used in graph drawing (e.g. daVinci, Graph Modelling Language (GML), Graphlet, GraphXML) and current discussions on exchange formats for graph transformation systems. At the 2000 International Conference on Software Engineering (ICSE 2000) Workshop on Standard Exchange Formats (WoSEF), GXL was accepted as working draft for an exchange format by numerous research groups working in

3422-566: Was seen as a generalization of the condensation to components used in graph theory . If a program is structured, then McCabe's reduction/condensation process reduces it to a single CFG node. In contrast, if the program is not structured, the iterative process will identify the irreducible part. The essential complexity measure defined by McCabe is simply the cyclomatic complexity of this irreducible graph, so it will be precisely 1 for all structured programs, but greater than one for non-structured programs. Another application of cyclomatic complexity

3481-723: Was to where you want it to be. For this very iterative process to be practical, the tests must run very quickly, or the programmer would have to spend a large fraction of their time waiting for the tests to finish. Proponents of extreme programming and other agile software development describe this activity as an integral part of the software development cycle . Here are some examples of micro-refactorings; some of these may only apply to certain languages or language types. A longer list can be found in Martin Fowler 's refactoring book and website. Many development environments provide automated support for these micro-refactorings. For instance,

#707292