-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apps should never reference ConsoleDriver
#3622
Comments
I also mostly agree, but perhaps have a different ideal or at least more words (ha - never) about how I think we should go about it. As is common in even .net itself, it's totally cool and often good to hide the internal exemplar implementation that most people will probably end up using, meaning making ConsoleDriver However... It's still a good idea to abstract the concept of the console away, for the same reason it was originally done - there are differences between platforms, and there always will be. And if we don't have an abstraction, what public API surface we do expose ends up coupling consumer code to our implementation anyway, half defeating the purpose of the endeavor. While the BCL may certainly continue to evolve to make the platform differences less and less apparent, as has been happening, there will always be something that needs to be special-cased. Without an abstraction, even if it's a pretty thin one, that just leads to significantly less-maintainable code, due to scattered workarounds that also end up being bug and regression factories later on. Instead, I strongly believe we MUST create a public interface as the externally-visible abstraction of the low-level nuts and bolts.This is a low-effort thing we can do (and really should do in an SDK in 2024) so that consumers can still implement their own extensions, at most, or that they can have a stable contract for interfacing with TG at a lower level, at minimum. That just means we need to dogfood any such interface, as well. Fortunately, ReSharper makes that a fairly simple task, at least on the surface, since you can "extract interface," which will grab all the visible members of the class and make an interface from them. There is a high probability that we would, however, need to make some modifications to things to eliminate assumptions made internally that directly affect the externally visible API surface. That would also be a boon for testing, both internally and for consumers. Interfaces make things so much easier - especially in that realm. In fact, I'd even go as far as to say I would support sealing the platform-specific drivers, as well, (but leaving them public), and if necessary, define platform-specific interfaces to be the sole means of extending them, because - as above - we don't want consumer code dependent on implementation of those either, if they're writing code at that level or lower. They'd be free to wrap them, since they'd still be public, and would be able to use and pass them around as either their native types or as the interface, but they'd be required to stick to the interface, otherwise, without ability to directly override the implementations of those drivers. Footnotes
|
Originally posted by @dodexahedron in #3615 (comment)
I semi-agree. My take is
ConsoleDriver
details should not be exposed to app code, AT ALL.All of these operations (
AddRune
,Move
,GetAttribute
, ...) should be on eitherView
orApplication
.This issue is to track this.
The text was updated successfully, but these errors were encountered: