-
Notifications
You must be signed in to change notification settings - Fork 3
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
Naming Things #2
Comments
Like the naming of pretty much everything including distinguishing between transition parameters (URI variables) and attributes (message-body fields). The only possible confusion I see is when it comes to Representor attributes and Transition attributes – one an attribute (semantic descriptor) of a Resource, the other message-body field of a request. Did anyone else stumble upon this? I like the word attributes for both cases it is just we must be consistent and make sure we always address them with clear resource or transition context. As for the organization / project name – I was (and still am) against Rosetta Stone – don't have any other name but THP (the hypermedia project), but I am pretty sure there will be some ideas here. |
Turns out from a profile standpoint like ALPS, attributes of transitions are themselves semantic descriptors. We have not had any trouble with this in the libraries we have been writing. |
This has never occurred to me! Great point |
Do you all make any distinction between URI template parameters and query string parameters? In Verbose, I have all three–template params, query string params, and body params. Thinking out loud, some URI template params always seems to be a difficult one for me in regards to defining semantics. Say for example you have the template |
In the past, I (based on the libraries I use) have treated templated path On Sun, Aug 3, 2014 at 7:47 PM, Stephen Mizell [email protected]
|
I did the same. I totally agree on
However as for path segment variables vs. query parameters I tend to think of them as two very different things. |
I think in all of this, it may be helpful to have different categories or classifications of transitions. I consider links with path parameters to be a "templated" while links with only query parameters as not. Maybe there is a better name for that distinction, but a templated link is not one you can follow without some extra info, whereas a link with only query params is one you can without the parameters. Additionally, a templated link requires some attribute of an existing resource (maybe there are exceptions), while a query param is not always an attribute and therefore may not require resource data. Like in my example above, A little thinking out loud here. |
Hi Guys! Great work and great discussion! At the risk of being simple minded, I'm going to take a quicky left turn in regards to naming things and wondering your thoughts... In particular, with the overarching goal to make hypermedia "...accessible to the masses." It is my opinion that we either need to teach the masses this very abstract vocabulary of the charter, or use the same language the masses do. I vote the latter--as it'll end up being much easier on us. For example: Transitions: Not very many people in my organization know what a transition is, but they completely get the concept of a link. Is it inaccurate to just call these links since we're in the context of HTTP? Or is there another not-so-generic term that "the masses" use that we can incorporate? Another thought: Is it possible to start off simple and grow this over time? In other words, can we iterate over the design by using code as our model? Maybe support a couple of media types and grow the requirements as additional media types are added? For example: I'm excited to see where this conversation goes and how HyperExpress can morph towards what we define here. |
I do like the idea of the API using some common terminologies, thought I also think, maybe this is a chance to educate? For the sake of quick adoption, though, common terms seems to be the way to go (hence using "links" in my maze example). Like you're saying as well, that doesn't mean this terminology can't be a veil to the underlying model. A link is a transition, but it's usually considered a certain kind of transition (a safe, idempotent request) by the masses. An action is similar, as it conveys different aspects of a transition. The underlying model may classify everything as a transition, though the API may provide something like Regarding "Representer," I wonder if we could still refer to the model conceptually as representer, but call it something else at the same time. For example, my library is called Halpert, and a Halpert object is a representer object. Is there some ambiguous, made-up name we could call this object for the masses, though still classify it as a representer? Something we could name it across all these languages instead of us all coming up with our own names? Just some thinking out loud here. |
The term "transition" has multiple contexts. Based on feedback I heard at the recent API Craft Conference, this can be confusing to many people. In an API interaction, there may be both client state transitions and resource state transitions. Making any request will result in a transition of client state (sometimes called application state). Making an unsafe request can result in a transition of resource state. We need to be careful not to conflate these concepts. |
That's a good point, and I think this is super helpful to think around all the edges of these projects. I think we should also not think of this representer object as a client, but rather as a component/element of the client. The representer primarily is an interface to the representation of the resource (on the client side in the case I'm speaking of here). It does not deal with client/application state in anyway, which would all be handled up the ladder. To the representer, transitions will always be resource state transitions, IMO. Thoughts? |
So, I think we need to find a compromise here between how people SHOULD think about this and what they are capable of grasping. Per @tfredrich's comment on transitions, it is true that developers don't grok simple finite state-machines. This is not a good thing:
We may not be in the business here of winning that battle, but frankly this type of interface for introspecting a hypermedia message is much closer to the truth IMO. Thus, I think we need to provide an interface and teach people how to use it as part of this process that breaks old thought patterns, while at the same time helping them get past their mental blocks (see example of different style of thinking and coding below we want to reinforce). However, as @kevinswiber points out, understanding the difference between application state and resource state transitions is important. From a state-machine interface these are transparent, which in one sense is a benefit to me. That is, if a client "understands" what the transition does, it can use it to modify a resource or change client (application state) or take a peak at another resource, etc. You just have avail to transition state presented to you in the resource. So, not sure that calling it conflates this since one SHOULD understand this (but I was listening to the confusion about this at during the panel so understand we need to be sensitive to it). I think using the term "links" over simplifies things. I think having "links" and "actions/forms" as separate concepts, though possibly useful in a media-type does not add extra in terms of the interface we are trying to surface here in that a client would have to look for different things. If we take a step back and thing that hypermedia is about "data" and "controls", if we did not want to use the term "transitions", I think we could maybe discuss "controls" or make that an alias for "transitions". You can then have different types of controls. Some are "link" controls and some are "action/form-like" controls. They are not "methods" because we are not going RPC and are fending off OOP thinking. W/r to "Representor" (I name this a little differently than @smizell, but it is conceptually the same), I like that name for a number of reasons as it more re-enforces an idea about how one should look at a message. I could go with something like "StateRepresentation" ala @glennblock's "StateObject". I don't think "Resource" is a good name because it is more mis-leading IMO. Some ruby pseudo code to highlight why I think we should strive to keep this really simple and state-machine centric: some_resource_representor = agent.enter('https://example.org/some_resource')
transitions = some_resource_representor.transitions
desired_transition = transitions['the_one_i_want']
# No RPC here and this type of coding keeps things loosely coupled and evolvable
if transition
transition.apply_attributes(params['attributes']) if transition.attributes?
transition. invoke
else
# I write my code to recover or pick an alt. path, etc.
end Alt. using controls some_resource_representor = agent.enter('https://example.org/some_resource')
controls = some_resource_representor.controls
desired_control = controls['the_one_i_want']
# No RPC here and this type of coding keeps things loosely coupled and evolvable
if control
control.apply_attributes(params['attributes']) if control.attributes?
control. invoke
else
# I write my code to recover or pick an alt. path, etc.
end If we keep this simple and don't capitulate to a OOP/Remote Type Mashalling interface, I think we get a win. Also, as much as we are doing all this to make it workable for others, we are threading the balance of doing this so we can use it ourselves and leverage this tooling in our work, so I think we need to balance that as well. |
Great thoughts, Mark. So I guess the question that you're getting to is, On Thu, Aug 7, 2014 at 2:08 PM, Mark W. Foster [email protected]
|
Well, per @tfredrich's comment above, maybe we start off simple and just do the simple finite state-machine interface and proof test if it really is a WTF for developers when they see it with some sample code, etc. We could go round an round, but I have actually worked on this with other devs and I am not sure it will be such a barrier. If we feel we need more separation, what that is would be more clear down the road. In the end of the day, what we are working on here is a simple interface that abstracts the requirement of knowing messages and protocols (ideally) and allowing task based interaction with messages. I think the initial proposed interface in the Charter README is workable to start and we can evolve in concert as each of us gets this in the hands of other devs. That would be my 2-bits and I think would get us moving faster. |
That sounds great to me personally. The code sample idea is a good one, I have the maze example [1] and I'll work on changing the terminology there [1] https://github.com/smizell/maze_client On Thu, Aug 7, 2014 at 3:13 PM, Mark W. Foster [email protected]
|
all: great to be able to follow this discussion here. i started using the term "representor" a while back and always had as a "to-do item" to check into the GoF patterns to see if there isn't an already (better) established name for this code pattern. maybe this is better referred to as the bridge pattern or the mediator pattern. or some other more recent invention like the Model-View-Presenter pattern. just adding this to get people thinking. would be a bummer to reinvent something that is already well-defined and widely understood. |
Well-defined, perhaps. Widely understood is subjective and depends on the audience. The initial charter references "for the masses". The terminology is still at such a high (and abstract) level that the compelling elevator pitch of the project's relevance isn't there yet. |
The relevance, IMO, is not going to be just that we got all the terminology On Fri, Aug 8, 2014 at 2:29 PM, MatthewReinbold [email protected]
|
We deliberately skirted away from View For that reason I avoid using it. We came up with the term State Model to specifically connote that the On Friday, August 8, 2014, Mark W. Foster [email protected] wrote:
|
While I do like StateModel, it can be too loosely defined when introducing I've used terms like ReadModel and WriteModel in the past. Sent from my iPhone On Aug 8, 2014, at 9:57 PM, Glenn Block [email protected] wrote: We deliberately skirted away from View For that reason I avoid using it. We came up with the term State Model to specifically connote that the On Friday, August 8, 2014, Mark W. Foster [email protected] wrote:
— |
I am not stuck on StateModel, my bigger point was not to use ViewModel ;-) As to Read vs Write are you saying Read is something returned VS something On Friday, August 8, 2014, Kevin Swiber [email protected] wrote:
|
Just to add to the name game, Darrel likes Also I guess we could consider RequestModel and ResponseModel. As long as if is not RestModel :-) On Friday, August 8, 2014, Glenn Block [email protected] wrote:
|
I like RequestModel and ResponseModel - descriptive enough that even introductory API types can grok what they are about while simultaneously noting that they are an abstraction, a representation. |
I don't see having two classes. Further, I don't like the use of "Model" as However, the idea of "transitions" and finite state-machine don't map as If we felt this needed something more technical, then I would vote However, I think there is a lot to be gained by not moving away from a On Fri, Aug 8, 2014 at 9:26 PM, MatthewReinbold [email protected]
|
The model is not marshaled, the model is used to carry data and links which On Friday, August 8, 2014, Mark W. Foster [email protected] wrote:
|
I don't think if is a mediator pattern. A mediator is something that is On Friday, August 8, 2014, Mark W. Foster [email protected] wrote:
|
@glennblock My comment on marshalling had to do with in no way That being said, I could go with "ResponseModel" or "ResponseObject" in Also, I did pretty fast cursory review of design patterns and don't think On Sat, Aug 9, 2014 at 6:57 AM, Glenn Block [email protected]
|
Cool, I care less about naming and more about the contract :-) On Saturday, August 9, 2014, Mark W. Foster [email protected]
|
👍 Shall we move on? @fosrias would you kick of some initial form of contract or is there still something that needs to be discussed? |
@zdne Been wondering the same thing. I think we can sort out naming, etc. On Mon, Aug 11, 2014 at 9:48 PM, Z [email protected] wrote:
|
@fosrias I think an initial version of representor interface in Ruby (or any other language) would go a long way! |
@zdne @smizell @glennblock @tfredrich @tedepstein @mamund Per Z's prompting, I put together the following for discussion of an interface for the object in ruby (with rubyisms in its implementation): https://github.com/the-hypermedia-project/hypermedia_resource I used the name "HypermediaResource" as the class name just as another variation to think about. It is not written as a gem with TDD (I have implemented a similar interface in a different library). It is more that @zdne felt it would be useful to just see some code. So, I put it together. |
Per feedback from @zdne, renamed to: https://github.com/the-hypermedia-project/hypermedia-resource-ruby With the future convention of -language in the repos for the libaries (e.g. hypermedia-resource-swift, hypermedia-resource-java, etc.). Note the use of dashes throughout vs. using _. |
Up for debate/clarification/refinement:
The text was updated successfully, but these errors were encountered: