-
-
Notifications
You must be signed in to change notification settings - Fork 502
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
Model changes under consideration for version 4.x #256
Comments
I was about to propose something similar 👍. Basically each UUID type should be a separate class with their own specific methods, not like now - one god Uuid object with methods for all types (and throwing exception for incompatible calls).
They will be mutually blocked. But that shouldn't be your primary concern - you would never release next major with this in mind. |
Can you elaborate on what you mean with this statement? |
This is also related to #235 |
I think trying to retain the old API with new implementations would only add burdens and hard work with little gain. Maybe a new API with a proxy implementation for old API that triggers deprecation errors pointing to a documentation on the correct upgrade path? What exactly are I would even like to suggest to never ever use any abstract class in a project like this where only ValueObjects are involved. |
@Slamdunk Good points about the abstract classes represented in the model diagram. I included them because I was considering that a lot of the functionality is shared and others may want to reuse some of that functionality, but that can be handled using traits, and those don't need to be represented in this diagram. I'll update the diagram. Thanks! |
I encourage you to try to provide functionality reuse only through composition. Thinking about traits at this point of design process seems pretty much early to me: I would start with the interfaces you draw, then, if reuse appears hard and unintuitive I would split APIs into smaller one building appropriate factories when necessary. The resulted exposed code will be available like traits, but within precise contracts and predictable behaviors. |
Can you elaborate more on this? The primary difference between types of UUIDs is in how they are generated, but the functionality for each, after generation, is basically the same (i.e. |
@Slamdunk, just making sure you saw my question in the last comment. 😄 |
We do extensively use this library for a year or such now, and the only public methods that we use are Uuid::uuidX() and Uuid::fromString() for creating, and UuidInterface for type hinting, if you don't change that, my migrations will be transparent ! As for the changes, something that I'd like to request are either:
That was my 2 cents, by the way, thank you very much for maintaining this wonderful library that just works out of the box ! :) |
Closing this issue, since I've already implemented the new model changes in the |
Along the lines of #255 and as discussed in #241, I've been thinking through some of the changes I'd like to make to the ramsey/uuid model. I'd like to introduce better abstractions that allow more flexibility to introduce things like the non-standard version 6 UUID discussed in #228 or the helper method for COMB UUIDs (also non-standard) discussed in #205.
The following diagram is high-level and represents my current line of thinking around this. I'm providing it here to open discussion, so don't think of this as a final design.
I'd like to try to make sure
UuidInterface
andUuid
maintain as much BC with the current API as possible, to ease the upgrade path from 3.x to 4.x, but I'd also like to get feedback from others regarding this. How painful would that break be? This package is depended upon by many other projects in the Packagist ecosystem, so what happens to dependencies when some projects upgrade to 4.x, while others stay on 3.x? (I ran into a similar problem between 2.x and 3.x, but the number of dependent projects was much lower than it is now.)So, this is open for discussion. I'd like to hear your thoughts.
The text was updated successfully, but these errors were encountered: