Replies: 3 comments 26 replies
-
I think the algorithms bring value.
|
Beta Was this translation helpful? Give feedback.
-
Hi all, I think this thread got side-tracked into discussion about reference implementation (RefImpl), based on an early claim that somehow algorithms in spec are in some direct relation to RefImpl. We started discussing RefImpl's readability, it's role in bringing new features etc. While it is an interesting discussion on its own, I would like to come back to the original subject of algorithms in the spec. The spec is a document that is self-sufficient and it must completely describe the GraphQL protocol , clearly explaining all the details, enough for successful implementation of servers or clients in any language or platform. That's how the specs work, in general. The question here and now is the use of didactic tools and approaches in the spec for the best readers' experience. Let's look again at the original example It has 3 parts:
Since the algorithm precedes the Explanatory Text, and is titled 'Formal Specification', then it is the 'official definition/description of the feature, source of truth, and something that one HAS TO READ to fully understand the feature. The third section 'Explanatory Text' is just something extra, optional explanation material that one can skip if he 'got it' from the 'Formal Specification' - which is a multi-step algorithm. It is thi front role of the 'algorithms' that I am not happy with. What if it instead was like this:
If it was like this, honestly, I would be OK, and definitely would not start this crusade/discussion. It is the use of the elements, the order, and the role of algorithms as a formal source of truth (vs optional illustrative element) - that's what I am against and suggest to change. And of course use algorithms sparingly, at least skipping the trivial ones like the one shown above. I suggest also to leave the Reference implementation alone, and focus on clarity and explanatory power of the spec text itself, without any implied links to the WG process, Ref implementation, change logs, or anything else. Thank you |
Beta Was this translation helpful? Give feedback.
-
I always welcome a spicy take, but I must say I strongly disagree with this one. I find the algorithms as one of the primary ways the spec brings value.
English phrases are notoriously ambiguous. There may be cases where we have simple algorithms which could be stated in English. It's quite useful to have both actually. English should be easier to read and understand intent where algorithms should disambiguate and be very clear as to the explicit order of operations. We also have algorithms which are considerably more complicated. It would be a huge problem to omit complex algorithms in favor of ambiguous English prose. Rather than having some rule where only complicated algorithms get written in full form, it's useful to describe all algorithms uniformly.
This is good feedback, and a case where we are not always consistent across the spec document. I like the principle that you should be able to read the spec text top to bottom linearly without encountering knowledge large gaps along the way. There are cases where we aid this by explaining a concept at a high level relative to some section if it's described in detail further below. Algorithms appearing before prose which explains their purpose and high level behavior is in fact backwards according to that principle.
I think it's worth pointing out here that the purpose of the algorithms is not to tell server-side developers how to write a program. I agree with you that developers are perfectly capable of writing their own code, and in fact we encourage that in the spec. Algos should disambiguate and explain to all developers but most importantly consumers of a GraphQL API what behavior they should expect. If a behavior is not observable to a client, then it may not be required to be described in a spec.
Over time I have seen a very large number of examples where explicit algorithms have helped disambiguate and help resolve inconsistencies in the ecosystem, help guide spec discussions, discussions around building tools, and countless other cases where a lack of clarity would have resulted in real cost but clearly defined algos avoided that outcome (or we faced real cost, where writing an algorithm more clearly helped resolve it). So I have to firmly disagree with the statement that they bring zero value. In fact I've experienced their great value first hand. |
Beta Was this translation helpful? Give feedback.
-
This is 'operation name uniqueness check' algorithm. Which can be expressed with a simple human-readable sentence - which actually follows it in the spec:
Now, do we really need this multi-step, barely readable multi-line nonsense? Would it be enough to simply have this 'humanly' statement?
Another point of view. We all know declarative vs imperative dilemma. Declarative is usually preferable, most of the time. What we do in the spec - we make IMPERATIVE to be our primary way in the spec (we list algorithm first). Then imperative code is followed by DECLARATIVE (this simple sentence). Why?!
Finally, it also feels like a personal insult. I am a server-side developer, and since these checks over schema are executed on the server, it appears its target audience is server developers, just like me. I feel I need to ask - why are you explaining this to me - how to check uniqueness of a string in a list? Your think I am that stupid? and the spec actually says - well, yeah...
Now seriously, what's the point of this and other 'algorithms'? they take space, cost a lot of effort to write and verify, while bringing ZERO value. The spec gets bloated. I doubt there is anybody who needs these, client or server dev.
Let's go DECLARATIVE, not imperative. Let's get rid of these.
Beta Was this translation helpful? Give feedback.
All reactions