Saturday, December 27, 2014

Software at Oregami

At Oregami we are using a bunch of open source software products, or commercial products that are freely available to open source projects like us to get things done. This blog post will tell you what we are using!

Software for Development

IntelliJ IDEA

You are a Java developer? Chances are high that you are using Eclipse IDE which is available under a free license. I am using Eclipse now for many years myself, and I got "used to it".

Somehow I got aware of IntelliJ IDEA from Jetbrains, which they call "The Most Intelligent Java IDE". It is not completely available for free: they offer a free "Community Edition", but many useful features are only available if you buy the "Ultimate Edition". Fortunately, Jetbrains offers an Open Source License for the Ultimate Edition. IntelliJ IDEA is available for Mac, Linux and Windows.

Wednesday, June 11, 2014

Open source RESTful server application (Dropwizard - Google Guice - JPA Hibernate)

Around one year ago I decided to use the Java framework Dropwizard for our server application. Since then I read a lot, I learned a lot and I implemented many things.

As the recently published new Dropwizard version required some re engineering of our application, I used the opportunity to start all over again from the beginning to strengthen my knowledge about the whole implementation. I want to permanently understand every single detail of it, that's the only way I can extend and document it in a meaningful way. It should also help other people to get involved in the development!

In order to be able to provide my technical progress to the outside world in a useful way, I created a complete new ToDo application which is generic, thus stripped of the whole Oregami context. You know the drill with those to-do's: an incomplete thing with a list of features (name, description, state, ...) that still need doing.

Today the generic application contains the following stuff:
  • RESTful app based on Dropwizard version 0.7.0
  • Dependency Injection with Google Guice
  • Hibernate / JPA 2.1 as persistence framework
  • HSQLDB as (in memory) database
  • "Transaction-per-HTTP-request" with Guice PersistentFilter
  • Support for cross-origin resource sharing
  • JPA entities with UUIDs as key
  • a pattern for accessing and manipulating entities with HTTP REST calls
    (Resource => Service => DAO => entity)
  • a pattern for ServiceResult objects which contain ServiceErrorMessages (which can later be bound to the corresponding web form fields in the client)
  • continuous JUnit tests to assure correct functionality
In the near future the following aspects should be added:
  • authentification
  • Hypermedia with HATEOAS
  • more complex entities (1-to-n-relations)
The complete source code is available for everybody at Github as dropwizard-guice-jpa-seed.

Disclaimer: Of course you might find out that something can be done in a better way. In this case don't hesitate and help me to improve the code! Use the usual pull request mechanism at Github to do so. The same applies for extensions of the functionality!

Notes for developers:

Start the application with the class "ToDoApplication" with the parameters "server todo.yml".

List all tasks with:
GET => http://localhost:8080/task


Add a new task with:
POST => http://localhost:8080/task

Header:
Content-Type:application/json
JSON-Body e.g. :
{"name" : "task 1", "description" : "This is a description"}


Modify a task:
PUT => http://localhost:8080/task/[id]
Header:
Content-Type:application/json
Accept:application/json

JSON-Body e.g.:
{
    "id": "402880944687600101468760d9ea0000",
    "version": "0",
    "name": "task 1 with new name",
    "description": "This is an updated description",
    "finished": "false"
}


Important hint:
I recommend you use the great chrome extension Postman to make such HTTP calls!

Friday, January 31, 2014

Nomen est omen: the naming of games

One of the main recurring criticisms of MobyGames - despite all its serious flaws in other parts of their data model - is the naming of the game entries. As MobyGames is, and always has been, a US project, every game is only accepted into the database using its US release title as the "main title". Missing that, a release title of other English-speaking countries is accepted, and only if there's no English title available, the original title of release is allowed, regardless of origin. When a main title is found for the game, every other title is only accepted into the database as an "alternative title".

There's one big problem with this approach. It may well be that the rest of the world doesn't care one bit about the US release title of a game. Imagine a Japanese player browsing MobyGames, only to find the fourth entry of the Final Fantasy series listed as "Final Fantasy II", just because it was the second FF game released in the US. There must be a better way to do this, so, let's conduct some research about how other game sites are approaching this issue, and allow me to introduce you to the planned Oregami solution. For reference, I will always link Final Fantasy IV as an example game.