What's wrong with those Scala developers?
They could make beautiful frameworks and APIs, always start to create crazy method names.
> "org.scalatra" %% "scalatra-atmosphere" % "2.2.1",
> send(("author" -> "system") ~ ("message" -> "Only json is allowed") ~ ("time" -> (new Date().getTime.toString )))
What's wrong with them?!
And this is rather sad.
You got a language which allows you to write nearly litteral code and still build stuff only mathematicans can understand.
send(JSONSerialization.with(StringSerializer.class, DateTimeSerializer.class).serialize(JSONObjectFactory.put(PairFactory.of(String.class, String.class).getInstance("author", "system"), PairFactory.of(String.class, String.class).getInstance("message", "Only json is allowed"), PairFactory.of(String.class, DateTime.class).getInstance("time", new Date())).getInstance()))
no, it's just json4s dsl for constructing json. If you wanted, you could've used constructors yourself: send(pretty(render(JObject(List(JField("author", JString("system")), JField("message", JString("Only json allowed")), JField("time", JString(new DateTime().getTime().toString()))))
usually scala libraries come with an easy to read/write DSL version of the API along with a more verbose java-style API shown above. Many libraries don't document with a plenty of examples. But, it really takes 10 minutes to learn DSL version in many cases. And, it gives you wings. There are plenty of benefits of DSL. You can research online about them.Why do they have to name them ~ % %%, if they can name them ANYTHING. Just to make the writing shorter?
It's like using variable names like a, b, c, data, value etc.
I want readable code, not short code by hook or by crook...
it's okay to learn things.
Free documentation does not pay bills, books do. Assuming people don't pirate them.