Replies: 7 comments 8 replies
-
An update: On the positive: On the negative: The words aimed at Ebean are highly damaging like: "those who engage in it should be shamed out of the community". Ebean is going to take a massive hit forever going forward because Brian thinks we are "pissing in the pool". The thing that really hurts here is that I'm really really confident that the bytecode transformation is doing nothing wrong but we don't seem to be getting a chance to defend ourselves. We are not being offered an opportunity to explain accurately how various cases are dealt with such that we still honor the semantics of record type. The approach taken is one of presumed guilt and then not listening to the defense arguments. Perhaps part of the issue is that we are in the ORM business. As such, we are a long way away from if/then/else helloWorld() code. In the ORM business we are deep into bytecode transformation because we are looking for good ways to deal with issues like interception, partial objects, lazy loading, dirty checking etc. We are in the rabbit hole and bytecode details matter here and this scares Brian and he doesn't have faith that we are up to the task and he does not want people to do down here into these details. For Ebean in the ORM business, we go into bytecode transformation because it really does enable us to do what we need to do and it really simplifies our world. It simplifies our dealing with issues like interception, partial objects, lazy loading, dirty checking. Ebeans bytecode transformation is a big reason why ebean is simpler and smaller than the other ORMs that we compare ourselves to. We go down into these details for really good reasons so solve hard problems. When we do this we must be excellent, accurate and care about bytecode details. The annoying thing to me when I'm looking at the details on this is that honoring the semantics of record type isn't actually hard or even new to ebean bytecode transformation. Record types actually present nothing new or need any special treatment as far as ebean bytecode transformation is concerned (1). A vote for Ebean/Rob at https://stackoverflow.com/questions/73377190/bytecode-transforming-record-class-to-be-mutable ... could help. Any help and support is greatly appreciated. Cheers, Rob. (1) Caveat, well if we detect a type is a record we can choose not to add the _ebean_identity field. The reason being that with record types a equals/hashCode implementation must always exist. Currently the transformation always adds the _ebean_identity field and for record types that field is completely redundant and not used at all - a bit wasteful, I've logged that as a bug and fixed it. This is in fact the only special treatment we apply for record type. |
Beta Was this translation helpful? Give feedback.
-
The plan: Lets have a review sessionI will look to organise a session for people who are interested in the details around this issue - an Ebean council if you like. I know Eddie is on holiday so we need to wait a few days at least. If you want to participate maybe reply to this or something. Agenda:
Notes:
|
Beta Was this translation helpful? Give feedback.
-
I've updated my answer and still super keen for upvotes on https://stackoverflow.com/questions/73377190/bytecode-transforming-record-class-to-be-mutable ... any support there would be great. I'm planning to better document:
|
Beta Was this translation helpful? Give feedback.
-
Perspective Discussion The SQL database model has traditionally been one of mutation-in-place. I picture a retail store shelf stocked with products. When someone takes a product off the shelf, the contents are mutated in place: I have stuffed some relatively unchanging things into SQL database tables, but I did it knowing I was putting a square peg into a round hole. There is some immutable/functional saying, "Some evil is necessary in order to get work done." Heck, if I understand this right, Goetz is putting an immutable Record onto a JVM that does not enforce those guarantees! Goetz is brilliant and has done a better job leading Java than I ever could. But Java has no moral high ground to stand on where immutability is concerned. Scala assumed it in 2004, Clojure in 2007, and Kotlin in 2011. Java released records in 2020. Java still has no interfaces to represent unmodifiable collections. But I digress. Rob, you and Ebean are awesome. As always, thank you for that. I know Goetz himself responded, but the question is a month old and only has 9 up-votes. Bytecode manipulation is kind of evil in general, yet it's the least-bad solution to ORM in Java. What do other JVM ORM's do that is so much better than the way Ebean handles this? I bet they do the same thing. My lens for the technical aspect of this discussion is the intersection of, "What is the Java programmer's intention and expectation in this scenario?" and "What is practical to provide in this situation?" If the expectation is nonsensical, then I'd favor a good error message and/or documentation as the solution. You shouldn't need to explain or defend yourself or Ebean beyond that. |
Beta Was this translation helpful? Give feedback.
-
I've put up a summary of what this is all about at: https://ebean.io/docs/well-thats-interesting/embedded-id Hopefully that is a bit easier to follow than the SO post. Keen and happy to take any feedback on that page. Cheers, Rob. |
Beta Was this translation helpful? Give feedback.
-
I think it's more effective to say something very clearly and simply once, than to repeat yourself. "The less you write, the more of it people will read." It also makes it easier to better organize your points. Suggested changes:
Great example!
Your bullet points and example look great.
Would I just noticed you use You might consider deleting most of your stack overflow posts on this issue and providing a link to this summary instead. Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
Summary
A summary explanation of what this is about is now at: https://ebean.io/docs/well-thats-interesting/embedded-id
The bytecode transformation that ebean uses for java
record
is being questioned aggressively and unfairly on stack overflow.When you get into the actual details, it turns out that ebean is doing nothing wrong but ebean is taking a reputational hit by some comments that assume that ebean isn't handling customisation of record types. THIS IS NOT THE CASE.
In terms of bytecode transformation, record types are in fact the easy case and there isn't bytecode in record types that ebean is not treating properly. We have no evidence that ebean is doing anything wrong at all ... but ebean is taking heavy criticism.
This heavy criticism is being delivered by Brian Goetz who is the Java Language Architect so this makes this a massive issue. As I see it, currently Brian is taking the approach of assuming that ebean is incorrectly enhancing record types and I think this is really unfair. Given Brian's role in the Java community his words have extreme weight and will create significant reputational damage to ebean and possbly already has done so.
Ebean isn't perfect and we are open to criticism but it seems really unfair for that criticism to come without any evidence of doing anything wrong. There seems to be an assumption of guilt.
If you could please have a look at: https://stackoverflow.com/questions/73377190/bytecode-transforming-record-class-to-be-mutable ... have a good read and look at the details that I have supplied Brian.
The really good news here is that having gone through this and looked really really closely again at the bytecode transformation on record classes that I am confident the enhancement is doing the right thing. This confidence comes from Brian's last questions around dealing with customisation of records - this is because these same issues appear with mutable types (non-records). To a large extent record types are a really simple case for the enhancement agent.
So please have a good read of that stack overflow question and if you can offer support that would be good. As I say in SO, this is a super serious issue that we must take really really seriously.
Thanks, Rob.
Beta Was this translation helpful? Give feedback.
All reactions