3 ms·
Sorry, this really feels like a user problem. Someone who is used to functional or dynamically-typed languages where one has to read documentation in a browser
by deanCommie 3y ago
Sorry, this really feels like a user problem. Someone who is used to functional or dynamically-typed languages where one has to read documentation in a browser instead of just navigating around a strongly-typed SDK codebase and understanding how it works from within the IDE.
I have done ZERO development in Apple/iOS/macOS. I have written ZERO lines of Swift or Objective C. My experience is with Java and C#.
But when I opened the first link in the blog that took me to https://developer.apple.com/documentation/appkit/nsopenpanel https://developer.apple.com/documentation/appkit/nsopenpanel the very first thing I saw was
class NSOpenPanel : NSSavePanel
And after scrolling through the page, before I even went back to the author's blog I had already clicked on "NSSavePanel", saw what was listed there https://developer.apple.com/documentation/appkit/nssavepanel https://developer.apple.com/documentation/appkit/nssavepanel, and then even further up to https://developer.apple.com/documentation/appkit/nspanel https://developer.apple.com/documentation/appkit/nspanel, and so on.
For me, this was absolutely the most natural way to navigate around an unfamiliar SDK/library/codebase. Understand everything that's available on the object from it's inheritance chain.
So when I went back to the blog and eventually came to:
> Ah, it inherits from NSSavePanel! That was not at all obvious (and I'm sorry OOP devotees, that makes damn all sense in principle). Oh, look, loads of new functions and properties. Ah, so I'm meant to query the NSOpenPanel object for the directory.
I was extremely confused.
I'm far from an OOP devotee, but I don't understand how you can attempt to write code in an OO-language without understanding that inheritance is one of the most important concepts for code separation. (and is almost always an anti-pattern, but regardless).
This is all absolutely information I would expect to discover from within my IDE, I wouldn't even go to the browser for it.
I suppose I will have to admit that "Open Panel" inheriting from "Save Panel" is weird - it's definitely a code-reuse paradigm and not a correct use of "isa" inheritance. Except this is literally how it works in every other desktop UI framework I remember using - MFC, Visual Basic, Java Swing. I could be wrong, but I think it's a pretty common convention in desktop UI development.
- malfist 3y agoI agree with you. Everything this person is struggling with is well documented on the parent class. A basic understanding of OOP is all that's needed to use this documentation and this dialog. Are they mad at Java docs? Or C# docs? Or any other OOP doc that follows the same pattern of not repeating the parent's documention on the subclass unless the subclass adds to it.
- zastrowm 3y agoThe charitable view would be that they come from language/platform that does include the base-class's methods/apis. Your example of dotnet/C# doesn't seem to be the best - DotNet/C# repeats the base documentation - for example the SaveFileDialog class [1] lists all of the methods but indicates when the methods come from the base class. Flutter also seems to list inherited methods - for example the TextButton [2]. [1]: https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.savefiledialog?view=windowsdesktop-8.0 https://learn.microsoft.com/en-us/dotnet/api/system.windows.... [2]: https://api.flutter.dev/flutter/material/TextButton-class.html https://api.flutter.dev/flutter/material/TextButton-class.ht...
- mrbombastic 3y agoYeah as someone who does work in the ecosystem but has never used this api or built a mac app I felt the same, the docs assume some familiarity with inheritance and delegation which is still used pretty much everywhere in the ecosystem, so you are gonna need to understand those to get anywhere. I do kind of agree that apple’s docs aren’t great but this is a bad example.