Skip to content
Greg Swindle edited this page Jul 30, 2017 · 10 revisions

Goals of eslint-plugin-crc

Generate CRC models for refactoring

First and foremost, this plugin is made to help you refactor. To that end, its near- and mid-term goals include

  1. Automated CRC Model reports with hyperlinks to associated source code.

  2. Auto-generated Object responsibilities based on annotations, e.g., JSDoc @descriptions, git logs, etc.

  3. Code smell detection, over time.

  4. Refactoring recommendations with hyperlinks to popular refactoring catalogs (e.g., Refactoring Guru and Martin Fowler's Catalog of Refactorings).

  5. Static source code metrics within time-ranges. These metrics must formally substantiate the previously mentioned goals to avoid data puke reports:

    a. Total/Average SLOC (source lines of code)

    b. Maintainability indexes for a CRC Model

    c. Cyclomatic complexity

    d. Halstead complexity measures

Software archeology: derive the semantic intent of software with machine learning

Clear, unambiguous, and effective communication is hard. Linguists have demonstrated the syntactic and semantic ambiguity of natural languages for centuries. As a consequence, scientists and logicians devised constructed languages in order to communicate more precisely and accurately. Modern programming languages are recent examples of constructed languages.

Even with the exactitude of programming languages, however, cognitive psychologists have proven that humans are not only oblivious to valid and invalid forms of reasoning, but also resistant to exercising one type of conditional logic even after they've formally studied it. [1]

Luckily, most professional programmers and engineers are forced to exercise valid conditional reasoning as part of their trade. Valid reasoning is necessary, but it is not sufficient: expertise with conditional syllogisms does not teach us how to translate a hodgepodge of actions, facts, and goals -- also known as "requirements" -- into conceptual models that execute the purpose and intention lurking somewhere among all the User Stories. The extent to which product delivery teams are able to articulate a proposed product's purpose and intention often dictates the success or failure of the product itself.

Fortunately an entire field of study exists to help us overcome the challenges of converting resources into products that meet objective goals. This field is called design.

AI-generated CRC responsibility statements

Infer the purpose of software products based on data mined from:

  1. AST structure
  2. Identifier names
  3. Code comments
  4. Tests
  5. Source control logs

Conceptual graphs

In order to infer and communicate the semantic intent lurking within source code, the application of semantic roles feels like a natural fit. John Sowa's Conceptual Graphs could be useful, not only for discovering and expressing the semantic intent of source code, but also for pointing out risks associated with inconsistent or even contradictory expressions of purpose (i.e., bad design).

Sample report from early v0.1.0 work

This report was generated by the tests/crc-model-formatter.spec.js specs; a simple "es5-object-identification fixtures; and a lodash html template.

Alpha
Responsibilities Collaborators
  1. Disambiguation for the letter "A"
  2. Clarifies pronunciation when spelling with the letter "A"
    Bravo
    Responsibilities Collaborators
    1. Disambiguation for the letter "B"
    2. Clarifies pronunciation when spelling with the letter "B"
      Charlie
      Responsibilities Collaborators
      1. Disambiguation for the letter "C"
      2. Clarifies pronunciation when spelling with the letter "C"
        Delta
        Responsibilities Collaborators
        1. Disambiguation for the letter "D"
        2. Clarifies pronunciation when spelling with the letter "D"
        1. Charlie 18:26
        Echo
        Responsibilities Collaborators
        1. Disambiguation for the letter "E"
        2. Clarifies pronunciation when spelling with the letter "E"
        1. Alpha 20:25
        Foxtrot
        Responsibilities Collaborators
        1. Disambiguation for the letter "F"
        2. Clarifies pronunciation when spelling with the letter "F"
        1. Alpha 23:19