Fork me on GitHub

@agile_geek: don't know, I was hoping for something nice like linq2sql in C#


@borkdude: yeah, seen linq, quite nice. Haven’t directly parsed XML for a while in Java but it was painful when I did.


don't need to parse, only write


@borkdude: I’m afraid I haven’t done that for even longer!

doug kirk15:10:00

@borkdude: The Java community has pretty much embraced annotation-based XML serialization, and in that space Jackson is the most common (and fastest).

doug kirk15:10:02

I've done it two other ways: hand-written .toXml() methods and also Velocity template-based (this last is very nice IMO, and separates all knowledge of XML outside of the Java code).


@borkdude: I’ve used JAXB in the past, but not sure if I can recommend it & the use of Schema’s and XSLT for forward/backward compatibility was nice though. Other than it was a pain and not sure if it’s maintained anymore


@joelkuiper: Yeah, JAXB is what we have and I tried working around a stupid problem. But I already solved it the other way by going from @XmlAccessorType(XmlAccessor.FIELD) -> @XmlAccessorType(XmlAccessor.NONE) and explicitly annotating every field I want to pull in the xml


I came across this today (during a lecture about DDD): The guy presenting advocated for replacing simple string by specialized classes and cited that article by Fowler. It goes so against the Clojure way of just writing hashmaps. I wonder if some people are trying the (immutable) hashmap way in Java and get away with it.


I wonder if I could easily use from Java 😈

doug kirk18:10:18

It's not whether you can, since it all boils down to JVM bytecode, it's how painful is it?

doug kirk18:10:48

(of course now I see you wrote easily)


@kirked: yeah, obviously you can. I am updating a legacy Java code base now. The 'domain' is so huge. Every little 'thing' has its own class. Still can't believe how people can be productive that way.


The app imports json. In json it all looks so small and clear. Until it's unmarshalled into Java objects. Huge bloat.


OK, enough ranting for the day. Thanks for putting up with me 😛.

doug kirk18:10:14

Ah, enterprise coding at its finest!


@kirked: I wonder if there's a better way in Java.


I really don’t miss the incredibly low signal->noise ratio in Java. There is just so much stuff that finding your domain logic is sometimes harder than where’s Wally simple_smile

doug kirk18:10:19

Using JS directly via ScriptEngine (with Java8 it's Nashorn)

doug kirk18:10:58

(or even better, cljs->JS on Nashorn?)


Probably the folks who started the project could better have dumped the JSON straight into MongoDB or Elasticsearch without writing one domain class.

doug kirk18:10:38

Yeah, I've seen a lot of really goofy stuff in Java codebases.


@kirked: if it was up to me, I would rewrite in Clojure, but it's not the reality. I don't even think this is goofy, it's just the way it's usually done in Java + mapping to relational databases (as far as I'm aware).


At least it's type safe! 😛


(until you make typos in xml configs)

doug kirk18:10:36

That's always been the problem with object-relational mapping: you need a compiler to tell you where you screwed it up, unless you wanna just wait until runtime

doug kirk18:10:06

And nobody's bother to take it that far (in Javaland)


I wonder if Clojure style (domain in 'just' hashmaps) catches on in other languages in the future.


case classes/Haskell records maybe are a bit similar approach?


I wonder if there is a name that catches this style: immutable domain model?

doug kirk18:10:26

Scala case classes are essentially named tuples with compiler-provided methods for equality, hashing, and copying ("modifying")

doug kirk18:10:47

I used regular Java HashMaps in an immutable way for one project. It worked well, but it would also have been nice to have compiler guarantees since others eventually took up the codebase.

doug kirk18:10:31

@borkdude You might also check out Apache Camel. It's a data flow toolkit essentially.

doug kirk18:10:44

Depending on your latitude with the codebase


@kirked: Yeah, I know it. Not relevant to this project I think.


@kirked: I share my office with an entire team of integration specialists working with Camel, Fuse, etc.


in my emphatic mode, I can even see why people were charmed by such a solution when all they had was Java