Sample scenario

This page contains a sample scenario which illustrates Community driven code quality process.

In this scenario there are two senior developers - Jim and Jack - who lead development teams.

  1. During a peer review Jim spots a potential problem in source code.
  2. Jim creates a guideline definition with a detailed description of the problem and how to avoid it.
  3. Jim adds himself in “Owner” role to the guideline definition.
  4. Jim publishes the guideline to the team intranet site and shares news about a new guideline with his team and his peers during a staff meeting.
  5. Jacks reads the guideline description. He agrees with the guideline.
  6. Then Jack spot-checks sources owned by his team and finds several occurrences of the problem described in the guideline.
  7. Jack contacts Jim and asks to add him (or his team) in “Endorser” role to the guideline. Jim fulfills the request and publishes updated guideline to the team intranet site.
  8. Jack communicates the new guideline he endorsed to his team and asks team members to be in compliance.
  9. When Java Language Module is released, Jim implements an inspector class which automatically checks for guideline compliance.
  10. Jim packages the inspector in a jar file and publishes the jar and dependency jars to the intranet web site.
  11. Then Jim modifies the guideline definition - he sets “runtime” attribute to true and adds location of the implementation jar to the definition's classpath. Jim publishes updated definition to the intranet site.
  12. Jim creates a component definition for the module his team is working on. Jim publishes the definition to the intranet site.
  13. Jim adds a review target to the module's build script. The target contains review task and ftp task to publish report to the intranet site. The review task references component definition on the intranet site.
  14. Jim monitors reports to make sure that existing occurrences of the problem are getting fixed and there are no new occurrences.
  15. Jack downloads Jim's component definition, modifies it to work for Jack's team module and also integrates automated code reviews into the build process.

Code snippets

MyOrg.party
<?xml version="1.0" encoding="UTF-8"?>
<com.hammurapi.party:Organization xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.hammurapi.party="http://www.hammurapi.com/party" name="MyOrg" uid="myorg">
  <children xsi:type="com.hammurapi.party:Organization" name="My team" uid="12345">
    <children xsi:type="com.hammurapi.party:Person" name="Jim" uid="j567" title="Team Lead">
      <contactInfo xsi:type="com.hammurapi.party:EMail" category="Work" address="Jim@myorg.com"/>
      <contactInfo xsi:type="com.hammurapi.party:Phone" category="Work" countryCode="+1" areaCode="777" number="777-7777"/>
      <contactInfo xsi:type="com.hammurapi.party:Web" comment="Personal site." category="Work" address="..."/>
      <identity type="EID" value="76543"/>
    </children>
  </children>
</com.hammurapi.party:Organization>
xyz-inspectors.hmrp
<?xml version="1.0" encoding="UTF-8"?>
<com.hammurapi.review:InspectorSet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.hammurapi.config="http://www.hammurapi.com/config" xmlns:com.hammurapi.party="http://www.hammurapi.com/party" xmlns:com.hammurapi.review="http://www.hammurapi.com/review" description="Inspectors for XYZ technology" name="XYZ Inspectors">
  <roles name="Owner">
    <party xsi:type="com.hammurapi.party:Person" href="http://mysite.myorg.com/svn/party/MyOrg.party#j567"/>
  </roles>
  <classPath baseUrl="http://mysite.myorg.com/svn/inspectors/xyz/">
    <pathElement>com.myorg.inspectors.xyz.jar</pathElement>
  </classPath>
  <inspectors description="Do it or else..." name="XYZ-001" type="com.myorg.inspectors.xyz.DoItInspector" category="//@categories.0" severity="2">
    <property xsi:type="com.hammurapi.config:NamedObjectDefinition" name="xyzProperty" value="789"/>
  </inspectors>
  <categories name="XYZ" description="XYZ inspectors."/>
</com.hammurapi.review:InspectorSet>
MyComponent.hmrp
<?xml version="1.0" encoding="UTF-8"?>
<com.hammurapi.review:Component xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.hammurapi.config="http://www.hammurapi.com/config" xmlns:com.hammurapi.party="http://www.hammurapi.com/party" xmlns:com.hammurapi.review="http://www.hammurapi.com/review" description="My module" type="com.hammurapi.review.SessionPoolingReviewDriver" name="My module">
  <roles name="Owner">
    <party xsi:type="com.hammurapi.party:Person" href="http://myorg.com/svn/party/MyOrg.party#j567"/>
  </roles>
  <constructor>
    <argument xsi:type="com.hammurapi.config:ObjectDefinition" value="10" type="java.lang.Integer"/>
  </constructor>
  <module name="XYZ" description="XYZ artifacts">
    <inspectorSet href="http://myorg.net/svn/inspectors/xyz-inspectors.hmrp#/"/>
    <source xsi:type="com.hammurapi.config:ObjectDefinition" description="Definition of the source model." type="...">
      <constructor>
        <argument xsi:type="com.hammurapi.config:ObjectDefinition" value="C:\..." type="java.io.File"/>
      </constructor>
    </source>
    <classPath baseUrl="http://myorg.net/svn/models/xyz/lib/">
      <pathElement>com.myorg.xyz-model.jar</pathElement>
    </classPath>
  </module>
  <reporter xsi:type="com.hammurapi.config:ObjectDefinition" description="Reporter definition." type="com.hammurapi.review.report.html.HtmlReporter">
    <classPath baseUrl="http://myorg.net/installs/HammurapiGroup/hg-release-xxx/review.report.html/lib/">
      <pathElement>com.hammurapi.review.report.html.jar</pathElement>
    </classPath>
    <constructor>
      <argument xsi:type="com.hammurapi.config:ObjectDefinition" description="Output directory." value="report" type="java.io.File"/>
      <argument xsi:type="com.hammurapi.config:ObjectDefinition" description="Report title." value="My module" type=""/>
      <argument xsi:type="com.hammurapi.config:ObjectDefinition" description="http flag." value="false" type="java.lang.Boolean"/>
    </constructor>
  </reporter>
</com.hammurapi.review:Component>
review.bat
java -Xmx800m -jar lib/com.hammurapi.config.bootstrap.jar --threads 10 --codebase http://myorg.com/svn/inspectors/xyz/lib/com.hammurapi.review.jar MyComponent.hmrp
Last modified: 2010/01/30 02:25 by Pavel Vlasov
   
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Hammurapi Group