Skip to content
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

Sharpen argument for hypermedia and add list of client libs/projects #25

Open
hlgr360 opened this issue Jan 17, 2017 · 1 comment
Open

Comments

@hlgr360
Copy link
Contributor

hlgr360 commented Jan 17, 2017

From an email convo:

Die _link Elemente erlaube eine starke semantische Entkopplung des Clients vom Backend.

Das Prinzip ist relativ einfach .. anstelle das Wissen über die konkrete URL Struktur der API in den Client hart zu verdrahten, kennt der Client nur die Relationship Attribute Values. Um eine bestimmte Operation mit einem bestimmten Relationship Attribute Value durchzuführen, findet der Client das matching _link Element und benutzt die darin embedded URL ‘as-is’ (mit der Exception fuer den Backend Server bei Injektion des ‘Forwarded’ Header durch den vorgeschalteten APi Management Proxy)

Das erlaubt eine spätere Änderung der URL Struktur der API, ohne dass der Clients verändert werden muss. Das bedingt natürlich auch, dass Ihr die _link Elemente nicht einfach ignoriert, sondern sie entsprechend der Spezifikation nutzt. Eine Google Search zeigt eine ziemlich grosse Anzahl von client libs, die ihr entsprechend fuer Eure Anwendung evaluieren könnt.

@hlgr360
Copy link
Contributor Author

hlgr360 commented Jan 23, 2017

Juan Martinez, Salvador @JuanS 10:45 AM
Oh nice, thats a lot of interesting material to read, I haven't read it all yet, but i will, in the meantime, related to some of the topics you mentioned above, my personal take on how to use hypermedia:

Without hypermedia, clients had to make requests, read the values of the response (state) and according to the values, then implement business logic to decide what to do next. With Hypermedia, if you offer state through links, with possible actions (like a finite-state-machine) then on the clients, one can just perform coding around the presence or absence of links.

So basically the target is to remove all the domain/business knowledge from the client side, and replace it with "protocol" knowledge through links. This way you remove duplicated implemented logic, effectively reducing the amount of changes that would have been breaking ones, achieve loose coupling, etc. But also, at the same time, need to carefully design hypermedia, because, the risks of making everything accessible through links can lead to a really chatty API, which at the end can do more harm than good. This is one of the reasons I also like consumer-driven-contracts approach, it makes those 2 concerns easier to address.
👍🏻 1

Reinhardt, Holger @reinhardth 10:51 AM
true ... and you went way deeper the rabbit hole than I would (which is a weird way of making a compliment) 😉
to me they are two ways of coupling I have observed .. there is syntactical coupling ... which usually involves interfaces directly or indirectly generated from an implementation .. you change the implementation, you change the interface
this was the original sinn of WebServices .. it was essentially a functional interface across the network ... you changed one side .. you had to change everyone relying on it too ... which did not scale for even mildly complex environments
then there is a more hidden kind of coupling ... I call it semantic coupling ... it is the embedding of knowledge about the API/interface in the client
a particuar way how URL's are constructed
hardcoding server IP's
some stuff you know becaue you have access to the server code etc
this coupling is non-obvious but it falls on your feet the moment you change something fundamental about the server .. maybe you move the server to a difference hostname or ip
or you change the urls
or you change a particular behavior (do this and then do this) which the client had been relying on
and usually that hits you when you are already operating at some scale ... and then you are in a place of real pain
you either not change it (and can not evolve) or you change it and break a lot of clients
most REST-light or pragmatic REST API's fall into that category
this is where hypermedia comes in .. sure, in the ideal world you can do everything you described above (de-duplication business logic etc).
but I would already be happy if it were simply preserving our ability to evolve without breaking existing clients which are owned and managed by different teams or differet orgs
the need for coordination is the enemy of speed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant