cufyorg / moonkit

[ARCHIVED] DSL Based MongoDB driver wrapper for kotlin with an optional schema system
Apache License 2.0
4 stars 2 forks source link

The end of ORM? #7

Closed LSafer closed 1 year ago

LSafer commented 1 year ago

I was convinced ORM is just too heavy and very unsustainable in many scenarios.

I love what I did in the orm module of this project but I think I was trying to fix something that cannot be fixed in the first place.

We can't encode/decode a whole document just to read/write some field. We can't make it an opt-in thing to read/write only a specific field. So, I think partial encoding/decoding is the solution and I got an idea on how to do it. It is inspired by [Exposed][https://github.com/JetBrains/Exposed] and I am working on it right now and I think it will make the orm module obsolete.

That is why I am thinking on stop supporting the orm module (even though it is the initial purpose of this repository)

What do you think?

LSafer commented 1 year ago

Since this repository is still on beta, an action like removing the orm module all together is a possibility.

If no one is objecting I might remove it or move it to another repository.

Still, there is plenty of time until the decision is made. I might find a way to keep both orm and my new idea

Tayeb-Ali commented 1 year ago

It's great to see that you're constantly evaluating and iterating on your project. If you believe that the current ORM implementation is not sustainable and that you have a better solution in mind, it's crucial to adapt to new ideas and technologies. i see your idea of partial encoding/decoding seems interesting, and if it's inspired by a well-established library like Exposed, it could be a good direction to take. Before making any decisions, consider the following: Evaluate the alternatives: Make sure you've thoroughly researched other solutions and that your new approach is the best fit for your project's goals and requirements.

Prototype the new solution: Before completely abandoning the ORM module, consider developing a prototype of your new idea. This will help you identify any potential issues or roadblocks early on, and you can assess if it's worth making the switch. from my View i see Dropping a module you no longer believe in can be liberating! ooohh i like to use this word " liberating", any way:)

pros of keeping the ORM module: • It already exists and is used by existing users/projects. Dropping it would be disruptive. • It provides a "full ORM" experience for those who want/need it. Some use cases really do benefit from a full object-relational mapping. pros of focusing on a partial/incremental mapping approach: • It can likely be more efficient, flexible and lightweight. Only mapping and updating the data structures you really need for a given operation. • It avoids the overhead of a full mapping/decoding of entire documents on every operation.

• It caters better to use cases where a full ORM is overkill.

Some options to consider:

Keep both approaches (ORM module and partial mapping) and let users choose based on their needs. This has the benefit of flexibility but also more complexity.

Phase out the ORM module over time, as you build out and improve the partial mapping approach. This reduces complexity but risks upsetting existing ORM users.

Keep the ORM module maintained, but mark it as "deprecated" in favor of the new partial mapping approach. This handles existing users but signals that the focus is shifting.

Something in between, e.g. keep ORM module but architect it in a way that reuses parts of the partial mapping approach under the hood. This combines benefits of both.

There are good arguments on multiple sides here. My recommendation would be options 3 or 4 - keeping the ORM module for existing users but shifting focus and improvements to the new partial mapping approach. But there is no single absolutely right answer. It depends on your particular priorities, constraints and audience.

LSafer commented 1 year ago

Thank you so much for the feedback ❤️

I am going with option 3

I just pushed two new modules achieving the new approach!

This is still in beta-stage

LSafer commented 1 year ago

I am a little curios if there is anyone using the latest ORM beta?

The version 2.0.0 is still on beta and I think there is little to no one using it on production 🤔

The change from 1.0.0 to 2.0.0 is expected to be a huge change.

So, is it worth it to keep supporting the ORM module?

I always though that this project is not used for production yet by anyone due to it not having any issues (aside from the issues I created)