Posts tagged with "Java"

Jun 6th, 2013

Look Mate, No Setters, No XML!

2104233_801fe7669e_q

Lately I had a discussion about setters that have been introduced for the sake of testability. Just to be able to replace the actual collaborator with a stub or mock. The discussion went something like this: S: “We could use a dependency injection in conjunction with the @Inject annotation with a container like Spring to [...]

1 Comment
May 23rd, 2013

A Rule to Test Them All (At Once)

2597653005_094ec92782_m

Unit tests often stop being useful where concurrency is involved. A special case is thread safety which can be tested relatively easily with the use of a simple JUnit rule. Suppose middle earth wants to keep track of the dragons that were slain over the centuries. The dragons are tracked in one list, and reports [...]

Leave a Comment
May 14th, 2013

How to Bootstrap a Tabris Application with Maven and Eclipse

From my point of view bootstrapping a new application is always tricky. Especially when you want to bootstrap an app that uses technology you are not yet familiar with. With this post I want to give you a step by step tutorial on how to bootstrap a Tabris application using Eclipse and Maven. So, let’s [...]

3 Comments
Apr 25th, 2013

When an exception gets lost

6947296049_a513bdfc32_n

Recently I fell into the lost exception pitfall – when an exception thrown in a try block gets lost because another exception is thrown in the finally block. It wasn’t that I was not aware of the problem, but rather that I underestimated and therefore ignored it. This post describes an example where suppressed exceptions [...]

1 Comment
Apr 18th, 2013

A Fast and Minimal JSON Parser for Java

Overall performance

In the RAP project, reading and writing JSON are critical operations, since the server processes and creates JSON messages for a large number of clients at a high rate. For this reason, we need something fast for this job. When we switched to JSON, we included the org.json parser, which is reasonably small but not [...]

10 Comments
Apr 11th, 2013

JUnit – the Difference between Practice and @Theory

Lately a colleague showed me how to improve JUnit tests written for a distance calculator. Speaking with other developers I found out that the majority wasn’t aware of the undocumented @Theories Runner which can be found in an experimental package in JUnit, so I decided to share this valuable “experiment”. In contrast to the parameterized [...]

1 Comment
Mar 1st, 2013

Use your HEAD – checking CouchDB document existence

One common task when working with CouchDB is to find out whether a document with a given ID exists. A simple solution is to send an HTTP GET request with the ID to CouchDB and check the response’s HTTP status code. A GET request, executed, for example with curl curl http://localhost:5984/mydatabase/mydocumentid will return the document [...]

Leave a Comment
Feb 21st, 2013

API Tools revisited

image01

Defining API’s is crucial to maintaining modularity. OSGi defines the concepts necessary for API definition such as a service concept and package visibility. However, pure OSGi is not enough to really maintain an API and its potential usages. There are several cases in an API definition where it is required to do more than restrict [...]

1 Comment
Feb 19th, 2013

Inside the Tabris UI

store

As you may have read in the Tabris 0.11.0 new and noteworthy post, we have created a small UI framework called the “Tabris UI”. In this post I will dive into the details of this framework. Grab a coffee and open your mind . Let’s get started… Background Almost a year ago we released our [...]

6 Comments