Softwire Blog


Cloud Development is Painful (but necessary)


30 March 2016, by

So you want to move your application to the cloud? Well is that really the right thing to be doing? There are lots of pros and cons for using cloud services rather than physical servers. In this blog post we’ll discuss some of the different aspects to consider before taking the leap.

(more…)

Lightning Talks – Modern IDE Usage


3 June 2015, by

In April 2015 we ran another Lightning Talks competition where eight employees each had five minutes to tell us something they find interesting – inside or outside the software development world. We had talks this year on topics from the Java ecosystem to general relativity!

Once again we voted on our favourite talks and the top two won Amazon vouchers.  This is Suzanne Hamilton’s winning talk demonstrating the power of modern IDEs, where she refactors an example piece of code based on Martin Fowler’s book “Refactoring” without ever typing anything!

 

Writing good notes during meetings


19 May 2015, by

NotesHave you ever come away from a meeting with the feeling that you’ve missed or forgotten some important information? Below are some tips to help you write better notes: if you apply them (and practice) you will find that your notes are much more useful and you retain the ideas and information that come out of your meetings for longer. (more…)

Currying in Node.js


29 April 2015, by

Having been doing a lot of functional programming recently, I discovered myself wanting to curry functions while doing some work in Node.js recently, but the question arose as to how?
Currying a function is providing some of its parameters now, and the rest later and is very common in Functional languages:

Scala

def add(x:Int)(y:Int) = x + y
def add2 = add(2)
add2(10)     // 12

F#

let add x y = x + y
let add2 x = add 2
add2 10      // 12

But how can you do this in javascript when you have to provide all of the arguments to your function?
Well here are a few options:

  1. Get the extra variables in scope (not really the point, but will work in some situations).
    val y = 2;
    function add2(x) { return  x + y; }
    add2(10);    // 12
  2. Return a function from your function.
    function add(x) { return function(y) { return  x + y; }; }
    var add2 = add(2);
    add2(10);    // 12
  3. Use bind to perform partial application instead.
    var add = function(a, b) { return a + b; }
    var add2 = add.bind(null, 2);
    add2(10);    // 12
  4. Extend Function.protocol.
    Function.prototype.curry = function(){
      var slice = [].slice,
          args = slice.apply(arguments),
          that = this;
      return function() {
        return that.apply(null, args.concat(slice.apply(arguments)));
      };
    };
    var add2 = add.curry(2);
    add2(10);    // 12
  5. Use the curry library.
    var curry = require('curry');
    
    var add = curry(function(a, b){ return a + b });
    var add2 = add(2);
    add2(10);    // 12

The curry library is doing something very close to 2 behind the scenes. It will however also let you do partial application as well if you want.

var sum = function(){
  var nums = [].slice.call(arguments);
  return nums.reduce(function(a, b){ return a + b });
}
var sum2 = curry.to(2, sum);
sum2(2)(10);      // 12

Java: auto-generated POJO builders


6 April 2015, by

Any of you that have worked for a while with Java have undoubtedly come across code similar to this, usually in unit tests:

public SomeEntity createEntityWithFoo(String foo) {
    SomeEntity entity = new Entity();
    entity.setFoo(foo);
    return entity;
}

public SomeEntity createEntityWithFooAndBar(String foo, String bar) {
    SomeEntity entity = new Entity();
    entity.setFoo(foo);
    entity.setBar(bar);
    return entity;
}

(more…)

The best way to manage your task list


23 March 2015, by

Check ListI’m not about to give you the perfect task list. If I could, I would, but different people have different requirements for how their task list works, where it is, and how it reminds them of upcoming actions/events. At Softwire each employee chooses how to manage the tasks they need to do. In this blog post, we take a look at 6 different options that are used within our company. It’s up to you to decide if they’re the right option for you or not!

(more…)

The Journey Pattern


25 March 2014, by

The need for DRY code is a well established idea, which is well explained by Uncle Bob. The Page Object Pattern is the basic application of this principle to web tests. However, it is an idea that does not solve all our problems.

Although it goes some of the way to improving the readbility and extensability of web tests, it still has its issues. For example, people often find that when they start modifying their code, large numbers of their web tests can break, as they are brittle. Locating the source of the problem is also tricky, despite the implementation of the Page Object Pattern.

So are there any better ways to structure web tests that get around this problem?
(more…)

Mean Bean


4 November 2013, by

Recently, on one of Softwire’s projects, we were tasked with retrofitting a test suite to a codebase. The use of Hibernate on the project had resulted in a large number of getters and setters, and we wanted an easy way to check for obvious bugs in this code. MeanBean:

  • Tests that the getter and setter method pairs of a JavaBean/POJO function correctly.
  • Verifies that the equals and hashCode methods of a class comply with the Equals Contract and HashCode Contract respectively.
  • Verifies property significance in object equality.

(more…)

Lightning Talks: Open Source Contribution: A Practical How-To


18 June 2013, by

In April 2013 Rupert Wood organised our second Lightning Talks competition where eight employees each had five minutes to tell us something interesting about software development. This time our theme was “A Call To Arms”. Once again we voted on our favourite talks and the top three won Amazon vouchers.

This is Harry’s winning talk: “Open Source Contribution: A Practical How-To”. In four-and-a-half minutes he demonstrates how to fork a JavaScript library on GitHub, fix a bug in it and submit his fix back for review! Shortly after the competition the change he makes here was accepted and merged into the original project.

Lightning Talks: Page Objects: Put Some OOP in Your Web Testing Soup!


21 May 2013, by

In April 2013 Rupert Wood organised our second Lightning Talks competition where eight employees each had five minutes to tell us something interesting about software development. This time our theme was “A Call To Arms”. Once again we voted on our favourite talks and the top three won Amazon vouchers.

This is Rowan’s third-place talk: “Page Objects: Put some OOP in your web testing soup!”, a pattern for organising Selenium web-testing code.