Replies: 11 comments
-
As far as what is best for developer, I think that is — #2. I believe that’s best because developers don’t actually care about abstract classes, since those aren’t actually exposed/observable. So I think when developers developers go to look at the MDN article for a particular interface/object, they expect to find is all the exposed members of that interface/object documented/linked to in that one MDN article. They don’t want to be forced to go read yet another article to get the info they need. Redundancy is the obvious downside of optimizing for the developer reader/user experience is that way. We don’t want to maintain the same information in multiple places. But we have a mechanism in the Yari backend for doing transclusion. So maybe this is an opportunity to explore using it to solve this long-standing problem. And if the existing Yari transclusion mechanism isn’t sufficient for solving this problem, then maybe we would need to consider how to refine/improve it to handle this. |
Beta Was this translation helpful? Give feedback.
-
Yes. #2 is the best solution for now, but redundancy is a problem. To get around this, I think we need a combination of separate pages with bits transcluded from a core abstract page — some bits will need to be the same, and some bits will need to be diffferent. So for example:
So, after writing all that out, I am thinking, is it even worth having the AbstractRange documents created separately, when so much of the pages for the features that implement from there need their own distinct separate sections anyway? You think a lot of it is going to be the same, but really it is just similar but not the same? In which case this would mean a fourth option to explore — "Document all and concrete classes plus all their members, and get rid of the abstract class/member pages". |
Beta Was this translation helpful? Give feedback.
-
Thanks for your comments, I'm also leaning towards #2 (or even 4).
Right, this is often the main reason I'm not a big fan of transclusion. You'd have abstract content transcluded when you actually would like to provide specific syntax sections, code examples, etc.
This is interesting. I wonder how much interest MDN readers have about abstract classes (or mixins) at all. If there isn't a need to know this then yes, MDN documentation could actually leave this detail out and readers can consult the specification and WebIDL to learn about Web API classes' composition. |
Beta Was this translation helpful? Give feedback.
-
I'm going to look around a bit in Web APIs and provide a second (and third) example here to see if our current thoughts apply for other classes that do inheritance as well. |
Beta Was this translation helpful? Give feedback.
-
I really doubt there is much interest here. On the concrete feature pages, we can include notes to say that "these features are defined on the blah blah mixin", plus link to the spec in the Specifications table. I think that would be enough to satisfy the web archaeologists among us.
Nice one @Elchi3 — I'm really excited about you looking into this! |
Beta Was this translation helpful? Give feedback.
-
Okay, discussing a slightly different example: Non-exhaustive inheritance: interface Node : EventTarget
interface AbortSignal : EventTarget
interface AudioNode : EventTarget
interface XMLHttpRequestEventTarget : EventTarget
// many more Basically, If we think this through in terms of option 2. (or 4.) then we end up with many Currently MDN does what I had as option 3. above. See https://developer.mozilla.org/en-US/docs/Web/API/AudioNode#methods One thing to note here is that
|
Beta Was this translation helpful? Give feedback.
-
I quickly found another example where I don't think the rule should apply: interface Document : Node
interface Element : Node
interface Attr : Node
// ... We surely don't want to apply option 2. (or 4.) here and create pages for all Another hint is |
Beta Was this translation helpful? Give feedback.
-
I had the same question as @Elchi3 on why this isn't a mixin - the discussions happened there w3c/staticrange#1 (comment) - from what I can see, it's a combination of alignment with other APIs and the need to reference the common base interface as argument types. I guess this is relevant here, in the sense that |
Beta Was this translation helpful? Give feedback.
-
cc'ing @foolip who had thoughts on this in the past. Philip, I'm trying to think about how to best deal with (simple) API inheritance structures on MDN pages (not even mixins yet). Do you have thoughts on the examples above? What would you expect from documentation? |
Beta Was this translation helpful? Give feedback.
-
@Elchi3 I think it is good that you've brought up common abstract classes that are implemented in many places. You are right that in places like these, we shouldn't repeat the pages endless times for the sake of it. Maybe we should think about defining the two cases as two different groups — specialized abstract classes, and common abstract utility classes (or somesuchthing)? The first group would be ones like AbstractRange that aren't implemented in too many places, and are likely to require different examples, etc. These would be dealt with using option 4. The second group would be ones like EventTarget, which are pretty generic and implemented in lots of places. These would be dealt with using option 3, and then on implementing class pages, we could do what we currently do anyway in many cases, and include some functionality in Yari to include collapsed lists of links to all the stuff that is defined on the abstract classes. Of course, exactly what rules will put an abstract class in one group or the other is still up for debate ;-) |
Beta Was this translation helpful? Give feedback.
-
This has been converted to an issue here: mdn/content#19965 |
Beta Was this translation helpful? Give feedback.
-
We probably discussed this already somewhere but I'm opening a new issue here.
(I'm also thinking about mix-ins but I figured it might be easier to make a call on simple inheritance structures first.)
I'm picking a random API that has inheritance. It is DOM
Range
.So, here we have two constructible classes
Range()
andStaticRange()
and we have a class calledAbstractRange
which both inherit from.MDN documents
AbstractRange
here:MDN documents
Range
here:Range
-specific members)MDN documents
StaticRange
here:Now, MDN documents
Range.collapsed
andStaticRange.collapsed
along withAbstractRange.collapse
:(and this is true for all AbstractRange members, you find them all also under
Range
andStaticRange
).Observations:
Range
variant manages to provide a code example.StaticRange
could have a code example and forAbstractRange
you would probably need to refer toRange
andStaticRange
for practical code.AbstractRange
is weird and doesn't make sense to me as is.So, what is the convention here? I think there are options:
Beta Was this translation helpful? Give feedback.
All reactions