Call for review : Proposed .NET `System.Console` abstraction called IConsole, that will enable interoperability between open source console library and app developers.
so many devs create some type of IConsole to remove the static dependancy to `System.Console` when refactoring I thought it would be great if there was a 'known' interface that we could use each time instead of whipping one up each time
But I can write my own System.Console wrapper, it will be done in less than 40 lines?
It's not about writing a wrapper, that is very easy. It's about setting a standard of interoperability between everyone that uses this as their interface. Since you would have started by writing your own interface, and then also writing something that implements that interface, why not save yourself the 2 or 3 hours you will be sidetracked doing that and dive right in to cleaning up your code.
You can use IConsole as simply as typing, `add package IConsole`. You can always come back later and remove it.
Anyway, I've created a proof of concept as well as a hierarchy of interfaces that allow devs to be explicit about what type of functionality their console app or method or class requires, and should solve save time when refactoring and cleaning up code, making it more testable and-or removing dependancies. (injecting etc).
If you can please take a few minutes and look at the interfaces and the project site on Github, that would be very helpful.
Love you all, Alan
That is false. A quick search reveals 21k+ code points indexed where `IConsole` is found. It could be in a comment, it could be in part of a string, it could be anywhere. But these are not 21k+ projects - it may be like 2k+ or something assuming `IConsole` appears on average 10 times in a project.
so many devs create some type of IConsole to remove the static dependancy to `System.Console` when refactoring I thought it would be great if there was a 'known' interface that we could use each time instead of whipping one up each time
But I can write my own System.Console wrapper, it will be done in less than 40 lines?
It's not about writing a wrapper, that is very easy. It's about setting a standard of interoperability between everyone that uses this as their interface. Since you would have started by writing your own interface, and then also writing something that implements that interface, why not save yourself the 2 or 3 hours you will be sidetracked doing that and dive right in to cleaning up your code.
You can use IConsole as simply as typing, `add package IConsole`. You can always come back later and remove it.
Anyway, I've created a proof of concept as well as a hierarchy of interfaces that allow devs to be explicit about what type of functionality their console app or method or class requires, and should solve save time when refactoring and cleaning up code, making it more testable and-or removing dependancies. (injecting etc).
If you can please take a few minutes and look at the interfaces and the project site on Github, that would be very helpful. Love you all, Alan