I see here a pattern I have observed often: A few basic operations suffice to do (almost?) everything.
What are these operations?
SQL says CREATE UPDATE DELETE SELECT.
Rest says GET PUT POST.
Lisp says defun cons car cdr () with () I mean function application.
From Lisp we can go down to Lambda calculus and S&K combinators etc.
One could add
says: cd, cat, rm, mkdir, ls
What is a GeneralApi
- efficient (has enough structure to allow optimizations of common patterns)
- general enough to support tasks involving meta and reflection tasks. This is the reason Lisp has eval().
- minimal in the sense of KissPrinciple
I have kind of an answer to this question but would like to hear your opinion first.
-- GunnarZarncke ThinkingOutLoud
A limited set of operations can be sufficient for operation, but that same logic can be used to defend any TuringTarpit
. We have indicators for when new features are needed, such as MissingFeatureSmell
, and EconomyOfExpression
. As a note: I consider KissPrinciple
as most often used to justify the SimplySimplistic
is another option for minimality. Anyhow, my 'GeneralApi
' would be found in 'IdealProgrammingLanguage
'; after all, ApiIsLanguage
- doubly or triply so when dealing with protocols like REST or SQL where it isn't a mere 'inconvenience' to add new primitives.
Minor quibble: REST isn't a protocol, it's an architectural style. An example of a RESTful protocol would be HTTP.
Granted. Of course, any RESTful architecture will embody a protocol, and it seems a contradiction to even attempt a RESTful protocol suitable for multi-user InteractiveSceneGraph
s and DeltaIsolation
, so any such protocol will always be SimplySimplistic
for some purposes. The best you could hope for is freedom to readily enhance the 'architectural style' with other protocols to the same resources.
Only two fundamental operations are required:
(Tongue mostly in cheek...)
Ah, but you need to specify what to read/write. That is the point of "cd", "cdr"/"car" and "select" above (and implicity present in the URLs used to GET/PUT).
The richness of this structure is what differs between the approaches. SQL has the richest (in the sense of providing most structure) - but at the same time the most limiting.
Lisps cond/car/cdr is minimal but complete for DAGs (and with the addition of setf allows cycles) but it couples representation too strongly with structure (in my opinion and its simplicity is maybe TooPowerfulForItsOwnGood.
The path notation in URLs and file paths amounts to tree structures - with arbitrary graphs possible with sym-links (files) and 302ers (HTTP).
-- Gunnar Zarncke
Ah, indeed. Hang on:
void *Read(void *where);
int Write(void *where, void *stuff);
That should do it.
(Tongue now firmly in cheek.)
Yes. That does it. :-) Consequently we know can now go to AssemblyLanguage and provide the GeneralApi equivalent there: move <src> <dst>
See also AlternateHardAndSoftLayers