Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The documentation for JSON parsing in Play is hilarious.

You read the "The Play JSON library Basics" document, it looks like a lot of code for something that should be simple, but you go ahead and implement as explained. After a while, the verbosity starts bugging you, so you read the "JSON Reads/Writes/Format Combinators", followed by "JSON transformers" and finally the "JSON Macro Inception" pages.

The punchline in the last section can be summarized as "forget all that other stuff, just do "implicit val personFmt = Json.format[Person]". I was happy to be able to delete hundreds of lines of code from my project after learning this, but couldn't you just have told me this upfront since it probably covers 99% of all cases? The documentation also has an aura of "Isn't this all very clever?" feeling to it. It's also quite hard to search for anything, as outdated versions of the docs keep popping up in Google as the first results.



Look at this one: http://stackoverflow.com/questions/1722726/is-the-scala-2-8-...

Scala has a lot of really clever stuff and the "isn't this all really clever" attitude is definitely there.

EDIT: Come on. I meant clever in a good way as well. I'm just a bit ambivalent, is all.


I think if anything that example shows the cleverness is a good thing. It's from almost 5 years ago, since when Scala has gone from strength to strength, so the collections rewrite turned out quite well, and fears that it would stop new people coming to Scala, or that companies would stay on 2.7 and the community would schism, were definitely unfounded. The "use case" simplification of the documentation has been implemented and has shown itself to work well, suggesting that this kind of complexity can be managed. And a few years later I've seen Chris use equally complex techniques in his own code (check out his "practical scalaz" talk).


Yeah, I think there's a strong possibility that the Play JSON docs constitute a much more worrisome suicide letter.


I had this exact same thing experience, thinking, "wow, they want me to write marshal/unmarshal code for every type... is it 1999?" and then, finally, stumbling across the horrifically written "JSON Macro Inception" articles--as if no one had ever used reflection before for serialization--and feeling very, very stabby.

And lets not talk about all the wrong/missing import statements in code examples...


The documentation also has an aura of "Isn't this all very clever?"

This attitude needs to die. Forever. Why the fuck should I need know about contravariance and parser combinators to write a basic web app? I hope this Scala forking will kill it in Typesafe. It has no place in actually building products.

I notice a lot of difference in quality between libraries released by enterprises and those by users. It's the difference between https://www.paypal-engineering.com/2014/02/13/hello-newman-a... and Dispatch. We need way more of the former.


Wait, so it can figure out case classes on it's own?


Yes. The implementation uses a macro, which some people have (sometimes legitimate) concerns about, but you can tell it to make a format for a case class and it will Just Work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: