Refactor ConsoleDrivers to remove duplicate code
See original GitHub issueThere is a LOT of common code across the three (now four with Fake) Drivers.
I was just thinking about how to fix bugs related to non-printable chars causing rendering issues on some terminals. For example, in Windows Terminal and Fluent if AddRune
gets called with \n
it does this:
The fix is to modify AddRune
to look for non-printable chars like this, that may cause the underlying console to take action and replace them with the right glyph. E.g:
However, it’s stupid to do this 4 times. Instead the base
should implement the least-common-denominator functionality.
Right?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Code Refactoring to remove the duplicate code
I have three methods in two classes in which two methods have the same code but with different inheritance. How can I reduce...
Read more >Duplicate Code
Use Extract Method for both classes, followed by Pull Up Field for the fields used in the method that you're pulling up. ·...
Read more >Refactoring Duplicate Code. Engineering Insights | by Talin
Thus, refactoring duplicate code can make this evolution easier. Some programmers are pretty obsessive about eliminating duplicate code ...
Read more >object oriented - How to remove duplicate code (in general)?
So the fix would be to extract the method and delegate to common behaviour. in the same method, perform Extract Local Variable and...
Read more >The Art of Refactoring: Removing Code Duplications
Our first goal is to remove the second duplication. This should be easy, because the code looks almost the same.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Woo-hoo! Finally!
It ain’t perfect, but this radically simplifies and improves the ability to prove quality.
I think this makes sense.
The abstract capability is more of an indicator that some holes need to be plugged by concrete implementations, but we could move common code here.