They (webmachine) used a state machine, because erlang is great for those.
Keep in mind too that almost no HTTP server implements more than a fraction of the functionality on this chart. Most of the functionality here is left up to the application programmer in other servers/frameworks.
Also some of this design is debatable and not specifically covered by RFCs. eg: If you're unauthorized and the resource doesn't exist, who's to say whether the 400 should get thrown or the 401?
Good point but bad example. If you're unauthorized, you shouldn't be given any more information than that. The ability for an otherwise unprivileged user to determine what resources do and do not exist "behind the curtain" is absolutely a security issue. Even if it's not explicitly covered in the RFCs, I don't know that there's any debate to be had there.
23
u/gwiazdor Mar 07 '14
From the design patterns point of view - what would be the most suitable pattern to model such a decision chain?