Difference: DesignRules (1 vs. 2)

Revision 22005-05-05 - KrisDeVolder

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Added:
>
>

Design Rules

 This page is the start of a hopefully growing collection of design rules. By building this collection of examples we will hopefully be able to form an idea of the kind/range of things that would be useful to enforce as design rules as well as how we would like to express them in our domain specific language.
Added:
>
>

What are Design Rules

Note: This is an attempt to provide a definition / vision on what we mean by "design rule". This is not the be all and end all.

A Design Rule is a (relatively) easily verifiable rule that constrains how code is to be structured. By adhering to a design rule developers trade away some flexibility on how they write and structure code in order to make it easier to manually or automatically verify important properties of their software.

A design rule is not the same as the actual property one is seaking to guarantee (let's call this the interesting property) but can actually be a weaker or stronger property than the interesting property. The property specified by the design rule is a structural property of their code which developer chose to adopt because it:

  1. Is easier to verify (manually or automatically) than the interesting property.
  2. The fact that the desing-rule property holds boosts the developer's confidence in that the interesting property holds.
  3. It makes the code easier to read and understand (because it makes the interesting property more obvious and easier to verify).

For example, let's us considering the opening and closing of files. An interesting property we may wish to ensure ourselves of as developers is that

  • All files are opened before they are always closed eventually.

This property is potentially very hard to verify. However, it becomes much easier to verify it if adopt the following design rule:

  • Files that are opened by a method should closed within the same method.

By adopting this desing rule the developer agrees to always open and close file in manner similar to the following idiom:

     void operateOnFile(String filename) {
        ... open file ...
        ... operate on the file ...
        ... close the file ...
     }

Note that this design rule may be overly restrictive for some situations. In such cases, the desing rule may need to be extended to allow for certain exceptions. For these more complex cases may then chose to adopt a different design rule as an alternative.

Design Rule Catalog

 

Revision 12005-05-05 - KrisDeVolder

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WebHome"
This page is the start of a hopefully growing collection of design rules. By building this collection of examples we will hopefully be able to form an idea of the kind/range of things that would be useful to enforce as design rules as well as how we would like to express them in our domain specific language.

-- Main.kdvolder - 05 May 2005

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback