{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "chem-bla-ics",
  "description": "Chemblaics (pronounced chem-bla-ics) is the science that uses open science and computers to solve problems in chemistry, biochemistry and related fields.",
  "home_page_url": "https://chem-bla-ics.linkedchemistry.info/",
  "feed_url": "https://chem-bla-ics.linkedchemistry.info/2010/05/23/pmd-code-checking-checking-for.json",
  "icon": "https://chem-bla-ics.linkedchemistry.info/assets/images/chem-bla-ics_logo.png",
  "language": "en",
  "authors": [
    {
      "name": "Egon Willighagen",
      "url": "https://orcid.org/0000-0001-7542-0286",
      "_orcid": "0000-0001-7542-0286"
    }
  ],
  "items": [

    {
      "id": "https://doi.org/10.59350/9wby7-sdm26",
      "url": "https://chem-bla-ics.linkedchemistry.info/2010/05/23/pmd-code-checking-checking-for.html",
      "title": "PMD code checking: checking for programming against CDK interfaces",
      "content_html": "<p>I wrote recently about <a href=\"https://chem-bla-ics.linkedchemistry.info/2010/05/15/cleaner-cdk-code-5-developer-against.html\">programming against interfaces <i class=\"fa-solid fa-recycle fa-xs\"></i></a>,\nwhich led to some discussion. <a href=\"http://blog.rguha.net/\">Rajarshi</a> <a href=\"http://sourceforge.net/tracker/?func=detail&amp;aid=3005355&amp;group_id=20024&amp;atid=320024\">commented</a>:</p>\n\n<blockquote>\n  <p>patch 2 seems to replace usage of Molecule with Molecule, rather than IMolecule</p>\n</blockquote>\n\n<p>Now, this particularly problem was <a href=\"http://www.eclipse.org/\">Eclipse</a> being overly active cleaning up the imports, but we reached the\npoint that it is actually interesting to have <a href=\"http://pmd.sf.net/\">PMD</a> warn about these issues. PMD is a cool piece of software used\nby the CDK project for a long time one. One particular cool thing is that you can write <em>code warnings</em> as\n<a href=\"http://www.w3schools.com/xpath/default.asp\">XPath</a> queries.</p>\n\n<p>So, I promised Rajarshi to have a look at a custom rule to look at using IMolecule instead of Molecule. The code is actually pretty simple, using the aforementioned XPath feature:</p>\n\n<div class=\"language-xml highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nt\">&lt;rule</span> <span class=\"na\">name=</span><span class=\"s\">\"ReplaceMoleculeWithIMolecule\"</span>\n      <span class=\"na\">language=</span><span class=\"s\">\"java\"</span>\n      <span class=\"na\">message=</span><span class=\"s\">\"Use the IMolecule interfaces instead of the Molecule implementation\"</span>\n      <span class=\"na\">class=</span><span class=\"s\">\"net.sourceforge.pmd.rules.XPathRule\"</span><span class=\"nt\">&gt;</span>\n  <span class=\"nt\">&lt;description&gt;</span>\n      Programming against the CDK interfaces allows users to pick their favorite\n      implementation (nonotify, datadebug).\n  <span class=\"nt\">&lt;/description&gt;</span>\n  <span class=\"nt\">&lt;priority&gt;</span>3<span class=\"nt\">&lt;/priority&gt;</span>\n  <span class=\"nt\">&lt;properties&gt;</span>\n    <span class=\"nt\">&lt;property</span> <span class=\"na\">name=</span><span class=\"s\">\"xpath\"</span><span class=\"nt\">&gt;</span>\n      <span class=\"nt\">&lt;value&gt;</span>\n <span class=\"cp\">&lt;![CDATA[\n   //Type/ReferenceType/ClassOrInterfaceType[@Image='Molecule']\n ]]&gt;</span>\n      <span class=\"nt\">&lt;/value&gt;</span>\n    <span class=\"nt\">&lt;/property&gt;</span>\n  <span class=\"nt\">&lt;/properties&gt;</span>\n    <span class=\"nt\">&lt;example&gt;</span>\n    <span class=\"cp\">&lt;![CDATA[\n      Molecule mol = builder.newInstance(IMolecule.class);\n    ]]&gt;</span>\n  <span class=\"nt\">&lt;/example&gt;</span>\n<span class=\"nt\">&lt;/rule&gt;</span>\n</code></pre></div></div>\n\n<p>Patch pending…</p>",
      "summary": "I wrote recently about programming against interfaces , which led to some discussion. Rajarshi commented:",
      
      "date_published": "2010-05-23T00:00:00+00:00",
      "date_modified": "2026-07-05T00:00:00+00:00",
      "tags": ["cdk","java","pmd"],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
