Tuesday, 30 October 2012

Implementing Java interfaces: when is it OK to add extra methods?

I have just found myself offended by a usage and I want to write out why.

public interface Stack {
  public int size();
  public boolean isEmpty();
  public Object top()  throws StackEmptyException;    
  public void push (Object element);
  public Object pop()  throws StackEmptyException;   

public class ArrayStack implements Stack {


  public Object atPosition(int i) throws StackOutOfScopeException {
    if (i > tos)
      throw new StackOutOfScopeException("Attempt to pass top of stack");
      return S[i - 1];

My claim is that the atPosition should either be in the interface or not in the class, or ArrayStack should be called AugmentedArrayStack or that an intermediate interface called AugmentedStack which extends Stack is needed.

My expectation is that if a class implements only one interface and that interface is named for a Noun and does not have a pertinent name (eg ...Mixin) then the class will only implement methods declared in that interface (and possibly override those inherited from Object).

Sunday, 21 October 2012

Preparation for Software Testing Course

  • The Impossibility of Complete Testing by Cem Kaner

    Bad software © 1997

    Article 2B October 30, 1998 of the UCC became UCITA which has only been adopted by two states (passed in 2000).

  • Exhausting Your Test Options by Douglas Hoffman

    By exhaustive testing a bug was caught, which would not have been spotted by inspection of edge cases.

  • The Patriot Missile Failure by Douglas N. Arnold

    Ironically, the fact that the bad time calculation had been improved in some parts of the code, but not all, contributed to the problem, since it meant that the inaccuracies did not cancel.

  • A bug and a Crash by James Gleick

    Fortunately, he points out, really important software has a reliability of 99.9999999 percent. At least, until it doesn't.

  • Other Papers from Testing Education

Case Study

Based upon The art of the elevator pitch describe your testing project.


  • Open Source utility aimed at developers and office users.
  • A command line utility for the common problem of unifying spreadsheet sheets into one sheet.
  • A pure java command line tool.
  • A small utility with only 16 classes.
  • Code coverage testing has already been completed through test driven development and retrofitting to 100&percent;, however there are is a need to extend testing for unexpected and illegal input.


  • An Open Source ORM framework aimed at developers and office users.
  • A DSL for writing database backed systems, with especial focus on web pages.
  • A pure java stack on top of any JDBC capable database, typically used with a template engine.
  • 4792 files, 180k lines of code, 8 developers over 12 years.
  • Code coverage testing has already been completed through retrofitting. Still some benefits to be gained: caching, speed tests, technology changes.

Tuesday, 16 October 2012

The truth about blogging the truth about health research: blogged

I attended a quick, lunchtime, course entitled Blogging the truth about health research.

Sadly @cebmblog could not attend, but ably deputised by @peterjgill.

This course was a quick tour of why the social web is important for primary care researchers.

Blogging helps to formulate your own thoughts.

It enables you to gain a style understandable by non-academics.

Blogging bypasses peer review, which is great for junior academics.

By informing others of your views before you meet in person blogging can enable the most productive use of face to face time.

Case study Rosiglitazone: the debunk message did not get out.

Sadly the lack of debunking led to a number of deaths before the drug stopped being widely used.

Case study: twitter as a collaborative tool

Autism brain scan: 20 adults with vs 20 without. 90% accuracy!!

This paper was summarised in a Wellcome Trust press release.

@bengoldacre tweeted that he could not find the original paper.

@cebmblog tweeted the original and blogged it. This was picked up by the Guardian and led to the press release being altered.

Twitter enables you to participate in the hive mind.

Trial by twitter: can be a bit traumatic.

PLOS - Measuring the impact of research

Before the web there were only slow, late methods of measuring research's impact

  • peer review
  • citation counting

PLOS - altmetrics

PLOS enables a number of measures of a papers impact. Altmetics are more nuanced and detailed

  • more complex
  • measure aggregate impact of research
  • fast and open
  • track impact outside of academia

Rather preaching to the choir, as far as this blogger is concerned, but a very good session, which gave us all something to think about.

Adding launcher icon for STS to Ubuntu 12.04

Googling for ubuntu add menu icon is an unfruitful experience, as Ubuntu keep changing the default windowing system.

I eventually had more luck with unity sts launcher

With the help of a colleague I arrived at:

  1. Create a file called ~/.local/share/applications/sts.desktop
    [Desktop Entry]
    GenericName=Spring Tool Suite
    X-GNOME-FullName=Spring Tool Suite
    Comment=Java Editor from SpringSource
  2. Invoke by searching for sts in Unity search ("Unity Dash Home")
  3. When application is invoked right click on menu icon and click Lock to Launcher

Note that full paths are required for files referred to in the .desktop content model; tilde form file names do not work.