Here are a few questions I've been thinking about:
How should I express data or API?
How should the data be represented in Java or Scala?
How do I convert the data into wire formats such as JSON?
How do I evolve the data without breaking binary compatibility?
limitation of case class
The sealed trait and case class is the idiomatic way to represent datatypes in Scala, but it's impossible to add fields in binary compatible way. Take for example a simple case class Greeting, and see how it would expand into a class and a companion object:
If you're interested in gigahorse-github itself, README contains the full documentation.
I also wrote Extending Gigahorse page describing the overview of how to write a Gigahorse plugin, which is more or less the same as how one would write a Dispach plugin. As I wrote there, the JSON data binding is auto generated from a schema.
For me, gigahorse-github was as much a proof of concept for sbt-datatype as it was for Gigahorse. It did end up exposing minor bugs on all components along the stack, so it was a fruitful exercise.
There's a "pattern" that I've been thinking about, which arises in some situation while persisting/serializing objects.
To motivate this, consider the following case class:
scala>caseclass User(name: String, parents: List[User])
defined class User
scala>val alice = User("Alice", Nil)
alice: User = User(Alice,List())
scala>val bob = User("Bob", alice :: Nil)
bob: User = User(Bob,List(User(Alice,List())))
scala>val charles = User("Charles", bob :: Nil)
charles: User = User(Charles,List(User(Bob,List(User(Alice,List())))))
scala>val users = List(alice, bob, charles)
users: List[User]= List(User(Alice,List()), User(Bob,List(User(Alice,List()))),
The important part is that it contains parents field, which contains a list of other users.
Now let's say you want to turn users list of users into JSON.