5.11.11

Professional Scrum Training is essential!

Some weeks of our Scrum@University adventure are over, and it feels like a good point to share some experiences with you. Since my last Post we built up the teams, get in touch with our Product Owners, and got an excellent Scurm training by Ralf, one of the coaches at agile42.

Our initial setup was 7 companies offering 7 projects. The students had a first and a second vote for a project. Based on these votes, I formed 5 groups (attention, groups, not teams!). 80% of the students got their first vote accepted, and 20% their second vote. That was a nice result. However, it took about a week to come to this result, and I think I can do better in future. For example, I could present the projects and say: "Hey, I will leave the room for 30 minutes. When I come back, you've found 5 groups with a minimum of 5 members". I am sure there are thousands of possibilities to form groups. Do you have additional ideas for me?

OK, so we had our groups. The next thing was to bring the 5 groups together with their 5 Product Owners. BUT WAIT, what is a Product Owner? Yes, before I could present the groups, I need to tell them what Scrum is. Nothing easier than that, because I was aware of Mike's Reusable Scrum Presentation. So I picked the slides, put my name on the first slide, and gave an enthusiastic talk about Scrum to my students.
And guess what, after that talk I had room full of 30 students with BIG question marks over their head.
 
What went wrong? Well, I told them what Scrum is (roles, artifacts, meetings), but I didn't told them why I told them! The question was, how can I do better? And now I was ready to understand the need for a professional Scrum training by Scrum experts. I invited Ralf from agile42 and he told us (no, he let us live) what Scum is. And he did a fantastic job! Here are some selected photos taken during the training:


The Ball Point Game
The Ball Point Game simulates the whole Scrum Iterations (including estimation, planning, sprinting, reviewing, and restrospecting)

One goes inside a circle and tells what he/she thinks is the reason for student projects fail in the past. Everyone who agrees goes inside the circle.
Metaphor for Scrum: Round Table

Metaphor for Scrum: Curricle
Metaphor for Scrum: Soccer

Metaphor for Scrum: Hill Climbing
Mataphor for Scum: Voltage Delta

29.9.11

Building Software Projects Using Scrum At University


As some of you know, I started to teach at the University of Applied Sciences Berlin this semester. One of my courses is called Softwareproject I (and will be continued by Softwareproject II with the same students), in which the students should work in groups and do what they are expected to do later in the in the IT industry: Build Software.
In the next months, I will try to write down my experiences with this course, because I think that we do something special, since we will try to create large teams of six to nine students (yes, that's a fairly large number at the university) and do Scum, a popular candidate of the agile methodologies. Applying Scrum in an university context exposes many challenges, and I will try to address some of them in future posts. One of that challenges is the lack of real projects. For me, a real project is a project with a real customer. And a real customer is someone who is driven by the market. So in a perfect world, I would have enough real projects for all of my students (~30) to work in. And guess what, sometimes the world is perfect. I started to search for companies with these characteristics:
  • have the courage to work with (potentially unexperienced) students
  • propose a project which fits to the experience level of the students
  • agree to apply Scrum and provide a Project Owner 
 I found an overwhelming number of seven(!) companies with seven projects who want to work with us:
 And if this wasn't anough, I also found sponsors and supporters:
  • agile42 will give us free Scrum lessons, which is really great because of their experiences with introducing Scrum in many companies
  • ScrumDo, providing a web-based Scrum tool, supports us with business accounts
  • github, a hosting service for git repositories, supports us with business accounts for private repositories
  • a friend of mine, Olivera Janackovic, desgined the banner you can see at the top of this posting especially for that course
For the start, the world seems perfect. My students can decide which project they want to work in, an after that we will start to build the teams. Next week, I we will try to have the Project Owners of the chosen projects to come to our lessons, so that the teams can start to work on a detailed vision for the project and its architecture.

14.6.11

Railroad Diagrams in Redmine Wiki

I recently needed to show the grammar of our XText based UML guard and action language in the Azmun Wiki. I decided to use railroad diagrams for that purpose, since I remembered that the XText documentation contains such cool diagrams in the MWE2 sub-chapter. For example, here is the railroad diagram for Module definitions:



I don't know how the XText documentation is generated, but I know that the rail package for LaTeX is able to generate such diagarams. So I wanted to integrate such diagrams in our wiki using rail.

We host all the projects of our research training group METRIK in a Redmine instance. One of the Redmine Plug-Ins is the Wiki External Filter, which allows defining macros that process macro argument using external filter program and render its result in Redmine wiki. The Plug-In is shipped with support for PlantUML to draw UML diagrams, Graphviz for abritrary diagrams, ritex for MathML, and ffmpeg to embed videos.

In order to add a new filter, I extended the redmine/config/wiki_external_filter.yml file with the following entry:

rail:
    description: "Constructs railroad diagrams for (E)BNF grammars, see http://notendur.hi.is/snorri/091263/rail/rail.html"
    template: image
    outputs:
      - command: "SOME_PATH/rail.sh"
        content_type: "image/png"
        prolog: "\documentclass{article} \n \usepackage{rail} \n \pagestyle{empty} \n \\begin{document} \n \\begin{figure} \n"
        epilog: "\n \\end{figure} \n \\end{document} \n"

Our filter is named rail and calls the shell script rail.sh, which I will show in a second. It defines the needed prolog and epilog LaTeX commands including the usage of the rail package and the definition of a figure, so that the user only needs to specify the rail commands.

Here now the code of the rail.sh shell script:

#!/bin/sh

# pipe STDIN to file
cat - > input.tex

# run first time with latex
latex input.tex 1> /dev/null 2> /dev/null

# run rail
rail input 1> /dev/null 2> /dev/null

# run second time with latex
latex input.tex 1> /dev/null 2> /dev/null

# convert DVI file to PNG
dvipng -q -Ttight -M -pp1 --noghostscript -D150 -o out.png input.dvi 1> /dev/null 2> /dev/null

# remove temporary files
rm input.*

# pipe contents of PNG to STDOUT
cat out.png -

This script has following prerequesites:
(Note that there are precompiled Debian and RPM packages for LaTeX and dvipng available.)

Having all the pieces together, we now can use rail scripts to create nice railroad diagarams in Redmine. Here is an example taken from Azmun:

{{rail(
\railalias{IMPLIES}{->}
\railalias{EQUIVALENCE}{<>}
\railalias{OR}{||}
\railalias{XOR}{\textasciicircum}
\railalias{AND}{\&\&}
\railalias{EQ}{==}
\railalias{NEQ}{!=}
\railalias{LT}{<}
\railalias{GT}{>}
\railalias{LTE}{<=}
\railalias{GTE}{>=}
\railalias{SHIFTLEFT}{<<}
\railalias{SHIFTRIGHT}{>>}
\railalias{MUL}{*}
\railalias{DIV}{/}
\railalias{MOD}{\%}
\railalias{PLUS}{+}
\railalias{MINUS}{-}
\railalias{NOT}{!}
\railalias{PO}{(}
\railalias{PC}{)}
\railalias{DOT}{.}
\railalias{FALSE}{false}
\railalias{TRUE}{true}
\railalias{INT}{0..9}

\railterm{IMPLIES,EQUIVALENCE,OR,XOR,AND,EQ,NEQ,LT,GT,LTE,GTE,SHIFTLEFT,SHIFTRIGHT,MUL,DIV,MOD,PLUS,MINUS,NOT,PO,PC,DOT,FALSE,TRUE,INT}

\begin{rail}  
  BasicExpression :
    [constants] ( BooleanConstant  
        | IntegerConstant )
    | [attribute reference] AttributeReference
    | PO BasicExpression PC
    | [logical NOT] NOT BasicExpression
    | ( [integer multiplication] BasicExpression MUL BasicExpression
        | [integer division] BasicExpression DIV BasicExpression 
        | [integer remainder] BasicExpression MOD BasicExpression )
    | ( [integer addition] BasicExpression PLUS BasicExpression
        | [integer substraction] BasicExpression MINUS BasicExpression )
    | ( [bit shift left] BasicExpression SHIFTLEFT BasicExpression
        | [bit shift right] BasicExpression SHIFTRIGHT BasicExpression )
    | ( [equality] BasicExpression EQ BasicExpression
        | [inequality] BasicExpression NEQ BasicExpression
        | [less than] BasicExpression LT BasicExpression
        | [greater than] BasicExpression GT BasicExpression
        | [less than or equal] BasicExpression LTE BasicExpression
        | [greater than or equal] BasicExpression GTE BasicExpression )
    | [logical AND] BasicExpression AND BasicExpression
    | ( [logical OR] BasicExpression OR BasicExpression
        | [logical exclusive OR] BasicExpression XOR BasicExpression )
    | [logical equivalence] BasicExpression EQUIVALENCE BasicExpression
    | [logical implication] BasicExpression IMPLIES BasicExpression
  ;

  AttributeReference : UMLPropertyReference ( DOT AttributeReference )?;
  BooleanConstant : FALSE | TRUE ;
  IntegerConstant : ( MINUS | PLUS )? (INT+) ;   
\end{rail}  

)}}

This script results in the following diagram:



So, what is missing? Yes, an automatic conversion of Xtext grammars to rail scripts.
I am also looking forward to have the new Xtext Syntax Graph View.

Happy grammar hacking!

29.3.11

New screencast from nusmv-tools

I created a screencast which shows the features of the nusmv-tools Eclipse editor. The editor is build using Xtext, so many thanks to the itemis AG team!

You can watch the video also in HD.

nusmv-tools Eclipse editor in action from Siamak Haschemi on Vimeo.


Happy model editing!

22.3.11

Access NuSMV from Java

NuSMV is a symbolic model checker, which I use as part of my PhD thesis. However, NuSMV is written in C and I could not found any Java API to use the model checker from Java. Luckily, creating Java libraries out from C-headers becomes very easy by using JNA and JNAerator:

JNA stands for Java Native Access and is a alternative to JNI, the official way to access shared native libraries. The advantage of JNA is the dynamic binding to shared libraries, whithout writing anything but Java code. Principally, you write a Java Interface with methods machting the corresponding C-header of the library and provide that Java Interface to JNA. More info‘s and examples can be found on the project‘s website.

While JNA provides the dynamic bridging between calls to the java interface, you still have to write the Java Interface and therefore you also need the knowledge about the conversion conventions from C to Java. Here comes JNAerator into the game. JNAerator is a tool to parse C headers and generate the corresponding JNA Java Interfaces. It comes with a Graphical User Interface, but can also be used on the command-line.

To create a Java API for NuSMV, first a dynamic library has to be created out of the sources. Unfortunately, this library is not created by the make files. I host some scripts for the current NuSMV 2.5.2 to help you out with windows, linux, and osx.
Having the shared library for NuSMV (nusmv.dll, libnusmv.so, libnusmv.jnilib), we can go an create the Java API using JNAerator (I also host the script for that). What we get is a java interface which now gives us access to NuSMV.

Accessing NuSMV becomes now as easy as:

import static org.eclipselabs.nusmvtools.nusmv4j.NusmvLibraryUtil.toByteBuffer;

import java.io.File;
import java.io.PrintStream;

import org.eclipselabs.nusmvtools.nusmv4j.NuSMV4J;
import org.eclipselabs.nusmvtools.nusmv4j.NusmvLibrary;

public class Main {
  public static void main(final String[] args) throws Exception {
    final File file = new File("testModel.nusmv");
    final PrintStream ps = new PrintStream(file);
    ps.println("MODULE main");
    ps.println("  VAR");
    ps.println("    x : boolean;");
    ps.flush();
    ps.close();

    final NusmvLibrary nusmvLibrary = NuSMV4J.getNusmvLibrary();
    nusmvLibrary.Cmd_CommandExecute(toByteBuffer("reset"));
    nusmvLibrary.Cmd_CommandExecute(toByteBuffer("set default_trace_plugin 4"));
    nusmvLibrary.Cmd_CommandExecute(toByteBuffer("read_model -i testModel.nusmv"));
    nusmvLibrary.Cmd_CommandExecute(toByteBuffer("go"));
    nusmvLibrary.Cmd_CommandExecute(toByteBuffer("check_ctlspec -p \"!x\""));
    nusmvLibrary.Cmd_CommandExecute(toByteBuffer("show_traces"));

    file.delete();
  }
}

When you run the above class, you get the following line on the console:

-- specification !x  is false
-- as demonstrated by the following execution sequence
<?xml version="1.0" encoding="UTF-8"?>
<counter-example type="0" desc="CTL Counterexample" >
  <node>
    <state id="1">
      <value variable="x">TRUE</value>
    </state>
  </node>
  <loops> </loops>
</counter-example>

If you don't want to take the above steps on your own, you should take a look at my project nusmv-tools, which contains some Eclipse based tools like an Eclipse editor for NuSMV files (see blow), an API to read the NuSMV counterexamples in java, a model advisor, and the libraries for accessing NuSMV from java, which I presented in this post.



Happy model checking!

21.3.11

Verify And Beautify Model-2-Text Transformation Output

One of the projects which I developed during my PhD thesis is Azmun, a model based testing framework based on various MDD technologies. One of the tasks within Azmun is to transform an UML-based test model to a model checking problem in order to use a model checker for automated test case generation. Although Azmun does not require a specific model checker, I mostly use NuSMV for my research. NuSMV has an own language to describe a system, and I developed a model-2-text (m2t) transformation from UML to NuSMV using Xpand. And here comes the problem:

Q: How do we ensure that the output of our Xpand transformation is syntactically correct, and how can we format our output?

These two questions may seem to be independend, but as you will see in a minute, we can tackle both problems with one approach. As a side project, I created the nusmv-tools Eclipselabs project, which hosts some Eclipse-based tools. One of these tools is a rich text editor based on Xtext. And now we have the solution for our problem:

A: We create a Xpand beautifier based on the Xtext parser and serializer.

The following lines show how we solve our problem in Azmun:

public final class NuSMVCodeGenerator extends WorkflowComponentWithModelSlot {
  private Generator m_generator = null;

  @Override
  public void checkConfiguration(final Issues p_issues) {
    super.checkConfiguration(p_issues);

    m_generator = new Generator();
    m_generator.addMetaModel(new UML2MetaModel());
    // add other metamodels

    m_generator.setFileEncoding("utf-8");
    m_generator.setExpand("foo::bar::UML2NuSMV() FOR " + getModelSlot());

    final Outlet outlet = new Outlet("/some/path");
    outlet.addPostprocessor(new PostProcessor() {

      @Override
      public void beforeWriteAndClose(final FileHandle p_fileHandle) {
      }

      @Override
      public void afterClose(final FileHandle p_fileHandle) {
        try {
          if (p_fileHandle.getAbsolutePath() == null 
            || !p_fileHandle.getAbsolutePath().endsWith(".nusmv")) {
            return;
          }
          NuSMVStandaloneSetup.doSetup();
          final ResourceSet resourceSet = new ResourceSetImpl();
          final URI fileURI = URI.createFileURI(p_fileHandle.getAbsolutePath());
          final Resource resource = resourceSet.getResource(fileURI, true);
          for (final Diagnostic diagnostic : resource.getWarnings()) {
            p_issues.addWarning(diagnostic.getMessage());
          }
          for (final Diagnostic diagnostic : resource.getErrors()) {
            p_issues.addError(diagnostic.getMessage());
          }
          if (!resource.getErrors().isEmpty()) {
            return;
          }
          final SaveOptions saveOptions = SaveOptions.newBuilder().format().getOptions();
          resource.save(saveOptions.toOptionsMap());
        } catch (final Exception e) {
          throw new RuntimeException(e);
        }
      }
    });
    m_generator.addOutlet(outlet);
    m_generator.checkConfiguration(p_issues);
  }

  @Override
  protected void invokeInternal(final WorkflowContext p_ctx, 
      final ProgressMonitor p_monitor, final Issues p_issues) {
    m_generator.invoke(p_ctx, p_monitor, p_issues);
    m_generator = null;
  }
}

We configure the Xpand workflow component with a PostProcessor, which is called for every file we create during the m2t transformation. In the afterClose method, we load the generated file using the standard EMF ResourceSet mechanism, and immediately save the resource. The options we add to the Resource.save method specify that we want the output to be formatted by Xtext.

With this approach, we can be sure that the output we generate in the m2t transformations conforms to the NuSMV language. And as a side-effect we format our output.

Happy transforming!