-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kMolecules DDD flavor of jMolecules DDD to work around issues in Kotlin #51
Comments
You seem to run into this ticket which – unfortunately – hasn't seen any significant progress since it was filed 6 years ago. I can certainly take the suggestion forward to the team but my gut reaction is that I (we) don't want to introduce and maintain an additional artifact replicating another artifact, just to fix a problem in the target language. The linked ticket has a suggestion of how to make this work using |
Ok ! It makes sense. I will most likely create a fork to ease Kotlin integration for Kotlin users |
I gave this a bit more thought and briefly thought it might be okay to just coin a new kMolecules project and repo and ship something similar to what you proposed in your PR, assuming someone was willing to contribute and maintain any of this. But what the occurred to me is that virtually everything in |
Word is on the street that we might see movement on the related ticket in Kotlin soon. In that light, I'd refrain from moving forward with anything Kotlin specific, as I expect it to be just working with the Java-based abstractions as is. |
Waiting for a decision I've created a library that mimics jmolecules-ddd with types easier to use in Kotlin here |
That's wonderful, thanks! I can take this to our team meeting this afternoon. Would you be generally interested in moving this repo to the xMolecules org? |
Yes sure ! |
There have been a few thoughts and questions coming up in the team call, that I would like to forward:
|
Ok
However I won't be able to work on it for the next two weeks |
I gave this a quick spin, and it seems to work as expected. I would go ahead and commit the types you created into the tweaked module setup, with you as the official committer and take it from there? |
The type-based flavor of the DDD building blocks uses methods that follow the Java Beans naming convention. Unfortunately, Kotlin currently does not implement these methods if properties are declared that match the convention [0]. This commit adds a kmolecules-ddd module that completely defines the same abstractions as jmolecules-ddd in Kotlin so that they can be properly used from Kotlin as well. The types are located in the org.jmolecules.ddd package so that we can phase out this module as soon as that glitch in Kotlin is fixed and users can just drop this JAR here in favor of the jMolecules DDD one. [0] https://youtrack.jetbrains.com/issue/KT-6653
That's in place now! |
I've added a rudimentary Kotlin example project that shows the existing integration working. |
Great thanks. All good for me |
The type-based flavor of the DDD building blocks uses methods that follow the Java Beans naming convention. Unfortunately, Kotlin currently does not implement these methods if properties are declared that match the convention [0]. This commit adds a kmolecules-ddd module that completely defines the same abstractions as jmolecules-ddd in Kotlin so that they can be properly used from Kotlin as well. The types are located in the org.jmolecules.ddd package so that we can phase out this module as soon as that glitch in Kotlin is fixed and users can just drop this JAR here in favor of the jMolecules DDD one. [0] https://youtrack.jetbrains.com/issue/KT-6653
Kotlin modules need to use Dokka o generate the Javadoc JAR required to publish an artifact on Maven Central. We're now generating that during the release build.
jMolecules DDD types are helping a lot but there are some annoying limitations due to Kotlin's Java interoperability.
The main limitation is due to Identifiable#getId method that conflicts with constructor's
id
field as shown below:Obviously it is possible to rename constructor's
id
field but it makes framework integration brittle since projects such as the excellent Spring Data instantiates objects via constructor if I'm not mistaken. It also hurts Kotlin's conciseness and integrate poorly with Kotlin's data classes.To cope with those issues I created Kotlin counterparts for jMolecules DDD types. I would be happy to contribute a PR if you think it makes sense
The text was updated successfully, but these errors were encountered: