Category Archives: Blog

Koding.com

Short one this time…

I was looking at getting myself a linux box where I could try playing around with Docker, when I wondered if its possible to get an online virtual linux box without a credit card.

That is when I found http://www.koding.com.

It gives you a free virtual machine, no credit card required. The only drawback is that the machine only remains on while you are logged in.

Great for learning, not so great for running, but then again, they do have plans where you can get a running machine.

 

Koding.com has a number of guides to get you started. These can be found at http://learn.koding.com/guides/

Happy Playing!

DFDL

DFDL is a modelling language currently under development to describe the format of non-xml data. For example –

  • Delimited (CSV)
  • Fixed width
  • Binary etc

DFDL uses XML schema notation to describe data formats. In order to do this, it uses a subset of the xml schema constructs. When implemented, it will provide a means to describe non-xml data using well formatted, valid XML.

Take note, it describes data that is NOT xml.

Source: https://redmine.ogf.org/dmsf_files/8110?download=12653

Example:

00100Fake St   Melbourne Vic

5 digit house number 10 Character street 10 character suburb 3 character state

<xs:element name="address" dfdl:lengthKind="implicit">
  <xs:complexType>
     <xs:sequence dfdl:sequenceKind="ordered">
       <xs:element name="housenumber" type="xs:string" dfdl:lengthKinbd="explicit" dfdl:length="5"/>
       <xs:element name="street" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="10"/>
       <xs:element name="suburb" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="10"/>
       <xs:element name="state" type="xs:string" dfdl:lengthKind="explicit" dfdl:length="3"/>
    </xs:sequence>
 </xs:complexType>
</xs:element>

Similarly for CSV data

100,Fake St,Melbourne,Vic

Where the data is comma separated

<xs:element name="address" dfdl:lengthKind="implicit">
  <xs:complexType>
    <xxs:sequence dfdl:sequenceKind=="ordered" dfdl:separator"," dfdl:separatorPosition="infix">
      <xs:element name="houseNumber" type="xs:string" dfdl:lengthKind="explicit""/>
      <xs:element name="street" type=""xs:string" dfdl:lengthKind="delimited" />
      <xs:element name="suburb" type="xs:string" dfdl:lengthKind="delimited"/>
      <xs:element name="state" type="xs:string"" dfdl:lengthKind="delimited"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

Sources: http://www.ogf.org/dfdl/

Implementations

It is still early days. There are a couple of implementations available, mainly open source, but the idea is promising. Hopefully

Daffodil – Open Source

Defuddle – Open Source

  • written iin java
  • early stages or abandoned.
  • Last updated 2/4/22013

http://sourceforge.net/projects/defuddle

IBM – IBM Integration Bus (formerly IBM Websphere Message Broker)

  • Paid (But a free developers edition is available)

Test Data Builder Pattern

The test data builder pattern is a pattern as the name implies, is to build test data. It works on the principle of setting the details in teh constructor and then have a method that builds (returns) the built object. Default values are set in the constructor and the methods are then used to override those defaults.


package com.beanietech;

public class AddressBuilder {

private String firstName;
private String lastName;
private String Address;

public AddressBuilder() {
this.withFirstName("Holger");
this.withLastName("Paffrath");
this.withAddress("5 Fake St");
}

public AddressBuilder withFirstName(String firstName) {
this.firstName = firstName;
return this;
}

public AddressBuilder withLastName(String lastName) {
this.lastName = lastName;
return this;
}

public AddressBuilder withAddress(String address) {
this.Address = address;
return this;
}

public String build() {
String message = this.firstName + "," + this.lastName + "," + this.Address;
return message;
}

public static void main(String... args) {
AddressBuilder A = new AddressBuilder()
.withFirstName("Rory");
System.out.println(A.build());
}

}

As you can see, the code is a little different to your usual getter and setter code. By using the with methods. The with method return the current object, so it allows you to chain with statements together.

For example:

 Address A = new Address()
.withFirstName("John")
.withLastName("Smith");

Also, by indenting the statement over multiple lines, it makes it more readable. It also gives the advantage that you can comment out certain with lines to debug or change the data without affecting the execution.

Documentation

As a first post to this blog (See the about page for links to my previous blogs) I would like to go though my journey of Documentation technologies that I have tried.

I have worked in the IT sector for many years and it seems that the default method of doing documentation has always been Microsoft Word documents, which I’m sure a lot of you and myself included are still using today. This is because Businesses tend to use this as the default method of documenting anything.

So what is wrong with Word documents. Not a lot really, it does what it is suppose to do. Which is replicate the printed page on the screen.

To me, this seemed like an archaic method of doing documentation, there must be other means. This is when I came across Tiddly Wiki. This was about 10 years ago, it seemed very easy to use, I started playing around with it, but I could not use it because business wants Word Documents. So I dropped it. I have just started using Tiddly Wiki again for my personal notes. Adding Dropbox and I have my personal notes everywhere I go.

A little while later, I came across DocBook. DocBook is an documentation format in XML. I tried writing a post back in 2011, Message Tracking. I liked the idea of DocBook. You can write your content in the XML and use css to change the format. You can then output the document as either HTML, PDF, word and most likely several other formats. I haven’t really touched on it since, but I do like the idea. It means that your documentation format is decoupled from the format. Maybe one of these days I’ll look into it again.

The next format I started looking at which is more common is the Wiki. I think the humble wiki is probably the best method to do your documentation. There are many open source wiki’s available on different platforms, but the one I like most is from a company in my home country, Atlassians Confluence. Everyone can collaborate on a wiki. No need to email documents around (Yes, I know you can use something like SVN to keep the store documents in a common area, but it is still difficult to navigate and search.)

I had been searching for a better way to do Specification documents. I was trying to find a template on the Internet. I didn’t quite like the way that our company did them. There seemed to be too much fluff and not enough content. This is when I got exposure to the whole Specification by example movement. From this, I came across Fitnesse and Concordion. These two products allow you to create executable documents. Documents that can be used to test your applications that you have developed. Fitnesse uses a wiki to hold the documentation portion and Concordion uses HTML pages. These seem the best methods I have come across to document your systems. They are always up to date as they are part of the testing process. The only downside I have come across with these products is… they don’t use Word, so it makes it hard for business types to accept. Oh well. I have done some proof of concepts with both Fitnesse and Concordion. At some point I’ll put up a tutorial on how to use them.

The final type of documentation technology I would like to talk about isMarkdown. Markdown is a text format that can be rendered with the right software to HTML. I like it because it is easy to read as a text file, but can also be rendered to HTML. For example, this blog post is being written in Markdown. As a proof of concept I have used Markdown for comments in SoftwareAG’s WebMethods. I then wrote a python script that takes those comments and renders it to HTML. With extensions, which included adding the js-sequence-diagram.js library, I was able to add sequence diagrams to the output.

That is it for the first post. I have lots of topics I would like to cover, unfortunately I don’t have a lot of time. Hopefully I’ll be able to keep up the content.