1. 1
PUTting the Software Architecture to REST
Danut Prisacaru, Software Philosopher
Is REST an Idealistic Architecture Style? (Ideal = perfect, impossible to implement?)
Epistemology = the theory of knowledge, especially with regard to its methods, validity, and scope. Epistemology is the investigation of what distinguishes justified belief from opinion.
Fallacies of Distributing Computing
http://www.rgoarchitects.com/Files/fallacies.pdf
1. The network is reliable.
2. Latency is zero.
3. Bandwidth is infinite.
4. The network is secure.
5. Topology doesn't change.
6. There is one administrator.
7. Transport cost is zero.
8. The network is homogeneous.
Fallacy 0: Money (budget) is unlimited.
Programming Fallacy
“Code is deterministic.
I understand logic, therefore I can write correct code.”
Nathan Marz – A call for sanity in NoSQL
https://www.youtube.com/watch?v=CEMPG1QvMVw
8:50 – 10:30
Your code is wrong. Software is really complex. Infinite regress. Stop making perfect software.
http://en.wikipedia.org/wiki/Infinite_regress
2. 2
Plato’s Theory of Forms
Axioms:
• There is only one of everything: idea or form that exists only in the “thought universe” outside time and space.
• The idea exists in the mind of the creator. Everything else is a copy.
This translates to:
• The Idea is perfect.
• The copies are imperfect.
The “things” in the physical world are copies of the idea from the “thought universe” =>
The things in the physical world are imperfect.
Is this true?
REST is a perfect idea (an ideal) that exists only in the mind of its creator, Roy Fielding?
Any implementation is a copy of the REST perfection, therefore any implementation is imperfect?
“My own” definition for REST
http://mikeschinkel.com/blog/whatisarestafarian/
https://blog.apigee.com/detail/api_design_are_you_a_rest- afarian_or_a_rest_pragmatist
A RESTifarian is a zealous proponent of the REST software architectural style as defined by Roy T. Fielding in Chapter 5 of his PhD. dissertation at UCIrvine. You can find RESTifarians in the wild on the REST-discuss mailing list. But be careful, RESTifarians can be extremely meticulous when discussing the finer points of REST, as I learned recently while participating on the list. :)
REST is (according to different opinions)
REST is
My way to define REST (simpler!)
URIs
One URL for all methods should do it
Http Verbs (GET, POST, PUT, etc.)
POST can solve everything
3. 3
Content Negotiation
Ignore, use XML to make it simple
Hypermedia
I don’t need it
Caching (eTags)
Nah, caching is complicated
Media Types
XML
Resources
I don’t know what this is => ignore
Sorites Paradox (The Paradox of the Heap)
How many grains of sand does it take to have a heap of sand?
Who defines what “a heap of sand” is?
Vagueness – Vague Predicates
About Building Architecture Styles
Byzantine Style
Hagia Sophia (from the Greek: Ἁγία Σοφία, "Holy Wisdom"; Latin: Sancta Sophia or Sancta Sapientia; Turkish: Ayasofya) is a former Greek Orthodox patriarchal basilica (church)
The Australian War Memorial is Australia's national memorial to the members of all its armed forces who have died or participated in the wars of the Commonwealth of Australia.
4. 4
Square base + circular dome. Arnolfini violates the circular dome constraint (?)
3 buildings, 3 different purposes, the same architecture style => different architectures
About Architecture Styles
• An architectural style is constrained by a particular principle of how to build systems
• Each principle influences some quality attributes in a positive and some other in a negative way
• It is about balancing between advantages and disadvantages
http://coronet.iicm.tugraz.at/sa/s5/sa_styles.html
Quality Attributes: security, performance, extensibility, maintainability, availability, etc.
“An architectural style is less constrained and less complete than a specific architecture.” Perry and Wolf: “Foundations for the Study of Software Architecture” – AMC Sigsoft
So What is actually REST? – The facts this time!
REST is Chapter 5!
http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm
“architectural style for distributed (networked-based?) hypermedia systems”
The Arnolfini is an international arts center and gallery in Bristol, England.
5. 5
“Constraints” is the most important word in the first paragraph!
The ideal, perfect “thing” has no constraints.
In the real world we do have (lots of) constraints.
REST vs. SOAP
vs.
REST is an Architectural Style (for distributed hypermedia systems)
SOAP is a protocol
Deriving REST (Roy Fielding – 5.1)
“The design rationale behind the Web architecture can be described by an architectural style consisting of the set of constraints applied to elements within the architecture.
6. 6
By examining the impact of each constraint as it is added to the evolving style, we can identify the properties induced by the Web’s constraints. Additional constraints can then be applied to form a new architectural style that better reflects the desired properties of a modern Web architecture.
This section provides a general overview of REST by walking through the process of deriving it as an architectural style. Later sections will describe in more detail the specific constraints that compose the REST style.”
Architecture Design Process
There are two common perspectives on the process of architectural design, whether it be for buildings or for software.
1. The first is that a designer starts with nothing—a blank slate, whiteboard, or drawing board—and builds-up an architecture from familiar components until it satisfies the needs of the intended system.
2. The second is that a designer starts with the system needs as a whole, without constraints, and then incrementally identifies and applies constraints to elements of the system in order to differentiate the design space and allow the forces that influence system behavior to flow naturally, in harmony with the system.
Where the first emphasizes creativity and unbounded vision, the second emphasizes restraint and understanding of the system context.
REST has been developed using the latter process. Figures 5-1 through 5-8 depict this graphically in terms of how the applied constraints would differentiate the process view of an architecture as the incremental set of constraints is applied.
REST – trade offs
“The REST interface is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction.” Roy Fielding
REST Constraints
1. Client-Server
2. Stateless
3. Cache
4. Uniform Interface
5. Layered Systems
6. Code on Demand (optional constraint)
http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm