-
Notifications
You must be signed in to change notification settings - Fork 166
[Refactoring] Aggregate widely used constants. #282
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
[Refactoring] Aggregate widely used constants. #282
Conversation
|
@slinkydeveloper i hope i didnt break any contributing guidelines by providing a patch without first filling an issue? |
|
@Alfusainey no problems, although I'm not 100% comfortable in having the "protocol binding constants" in api. This goes a bit against the purpose of that package. Also I don't see the need of "global constants" for attribute names (since they are spec version dependant), nor for yet another cloudevents version constant, since we already have the specversion enum |
|
Even though there are obvious "repetitions" throughout different spec versions, I think it's weird to have a |
yes, i see your point. i try to disambiguate that using the comments for each attribute name. i see your other point too regarding the Specversion enum. Can this be used then instead of the Constants? |
|
@Alfusainey What you want to place inside SpecVersion enum that isn't already there? |
no I didnt mean adding anything in that enum. my question was whether we can in fact use the SpecVersion enum to replace the string literal attribute names instead of using the Constants class in this patch |
You can do |
i think i should be more clear :-) i introduced the constants class so that occurrence of Now if i understand your previous message correctly, you said that since we already have a SpecVersion enum, defining a dedicated Constants class is not needed since the constants for the attribute names are defined in the SpecVersion enum. So this means that we can replace |
|
@Alfusainey No I was talking in particular about these two https://github.com/cloudevents/sdk-java/pull/282/files#diff-55e4715e8931e785311e85867a858e9516b09158e4a10d16a1285eb9a17a1a79R30 Ok so I was looking at this PR again and these are my 2 cents about it:
Does these concerns make any sense? |
|
I think having some constants for attribute names is useful.
I agree, if we want them, constants should be versioned and protocol agnostic.
Do we have a measure of how much bigger?
Yes, we need them in |
yeah and that's why i'm removing these classes, they're quite wrong and they do nothing more than a set of public final static constants can't do... I wonder, since the #280 adds these constants inside |
I see your point! The reason why i added them in the api is that the
ok, i was not thinking about this. i just wanted a way to use attribute names and having them defined (and documented) once somewhere that everyone can use would be great. that was my only reasoning for this PR
thats true 👍
i think @pierDipi already answered this. if you see the javadoc at the class level, i mentioned that the class contains constants used throughtout the SDK. so i was only focused on the sdk itself
I see.. this is like putting salt and sugar at the same location in a kitchen :-) however, if the salt and the sugar are properly labeled (i.e well documented using javadoc comments), then i expect a user to first read the label before putting salt in his tee. I feel the same way with constants that are properly documented I just took a look at #280. i think if we make those attribute names public (and well documented), then we do not need this patch at all since it would already be taken care of in #280 @slinkydeveloper @pierDipi given that there is a consensus here, can i close this patch? |
|
#280 merged |
Signed-off-by: Alfusainey Jallow <alf.jallow@gmail.com>
985832c to
94cffa4
Compare
slinkydeveloper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
There are important constants in the cloud event API that are widely used throughout the SDK. Such constants should reside in one place and be properly documented (possibly adding references to the respective section of the spec).
This patch attempts to put all constants for property names and prefixes for protocol bindings in one place.
Signed-off-by: Alfusainey Jallow alf.jallow@gmail.com