nb-bendreamreal: yeah, people keep their broken ways because learning is slow. But after you learn you can do it both well and fast. Nothing delays projects more than a broken design
* pebble joined #java
nb-benanyway I don't know that people manually code anymore, feels like I'm the only one
* rvalue joined #java
dreamrealNah, you're not the only one
dreamrealit's still worth it, but the problem is that someone who *can* work with the tools well is gonna fly past you, a lot like how someone who knew C well was going to deliver enough value *easily* to make them worthwhile compared against someone hand-tuning ASM code. The ASM code was "better," but... the C guy is like "I wrote a method to do Thing() this morning, barely worth mentioning the 15 minutes of
dreamrealeffort" while the ASM guy's going "just you wait, in two weeks I'll have saved you 22us!"
* Tomte joined #java
* ghodawalaaman joined #java
* stfstfm joined #java
* Anaphaxaway joined #java
deeboi moved a big service from jaxrs to spring mvc with $250 of sonnet and a day or two, would've taken me at least a week just typing shit
deebobut damn if it didn't make a lot of annoying mistakes like unnecessary annotations etc, still had to read through all of it
* Cae2 joined #java
* GreenResponse joined #java
* ernimril joined #java
dreamrealYou'd have had to read through regardless, although I've found I usually give pretty precise and limited instructions that handle a lot of that- and almost ALL of my instructions screech about red/green testing hard enough that we write specs to conform with that keep everything in line. I also use green/green - which is what a porting exercise would want - but that's rare.
javabotwhaley's title: "JEP 540: Simple JSON API (Incubator)"
nevetJEP 540: Simple JSON API (Incubator)
whaley~jackson
javabotJackson is a library that provides a streaming parser for many, many common dataformats (including ~XML, ~JSON, ~YAML, ~CSV, and others) and can map those formats into and from Java Objects as well. See https://github.com/FasterXML/jackson - it's probably the most common such library in use in Java today.
whaley* whaley humps jackson
ParaLooking at the lack of anything useful in the proposed API I wouldn't be that quick.
ParatryGet(), no has()
ParaStandard object problem "is the key 'foo' missing or does it just have a null value" will be ugleh.
nimajePara: I think that's the reason why there is JsonNull
Paraso what does getting JsonNull mean for obj.get("key")
ParaIs that {"key": null} or {]
whaleyI think what's being referenced here is how Jackson does it by returning a MissingNode when parentNode.get("foo") is called where "foo" isn't a key.
Para{}
whaleyjackson-databind has such a nice fluent API that has effectively no extra noise. I can't tell if JEP 540 has that entirely... though it does look more fluent than most other impls
ParaJackson also added .has(...) methods at one point for solving this particular problem. And find*() methods for similar convenience.
whaleythough tbh, java was *wayyyy* behind the times by not including json processing of any kind in the standard api
ParaAnd these are all indeed in databind, which I totally agree with you, the API is very low friction to use these days.
ParaIt feels a bit that JEP 540 is being modeled by the reference implementation org.json which is...not that great ergonomics wise.
nimajeif obj is parsed from {"key": null} then obj.get("key") would give you a JsonNull value, if "key" doesn't exist in obj it would throw JsonValueException
ParaExceptions for flow control ;_;
nimaje.tryGet(…) would give you an Optional instead
* Drixtan joined #java
nimajehm, that API seems to be missing BigInteger/BigDecimal support
whaleyeww
ParaWhich is kinda odd as technically that's the only type they should support and coerce from that.
nevetJsonNumber (Java SE 28 & JDK 28 [ad-hoc build])
whaleythat toString() is icky
nimajeok, it handles numbers correctly, but doesn't exposes them nicely
ParaMaybe that's behind Oracle+ subscription.
dreamrealI hate that JEP so much
dreamrealhave we learned so little
nimajehm, is the only good part of that JEP, that it doesn't try to use javas null for a json null value?
dreamreal* dreamreal hits the "support trailing commas" bits and decides NO on the JEP. I have no vote, but that single paragraph would be enough, and combined with.. uh... all the other paragraphs...
ParaThis is like trying to express zero in Roman numerals...
dreamreal"This paragraph, along with all of the other paragraphs, convinces me that I would be compelled to happily, nay, ecstatically and emphatically, kick this idiotic effing JEP into the sun. We could, of course, remove that paragraph and its asinine assumptions and restrictions, but that would leave the others. Still sun-bound, in my opinion. Geez, people. Sincerely, me."