Skip to content

refactor using delegate (class TerminalCommandProcessor) instead of inheritance#151

Closed
Arnaud-Nauwynck wants to merge 1 commit intofusesource:masterfrom
Arnaud-Nauwynck:terminal-processor
Closed

refactor using delegate (class TerminalCommandProcessor) instead of inheritance#151
Arnaud-Nauwynck wants to merge 1 commit intofusesource:masterfrom
Arnaud-Nauwynck:terminal-processor

Conversation

@Arnaud-Nauwynck
Copy link
Copy Markdown
Contributor

@Arnaud-Nauwynck Arnaud-Nauwynck commented Jun 1, 2019

introduce class TerminalCommandProcessor to extract code specific to processing ansi escape commands (currently mixed into AnsiOutputStream, and using override...)
.. so change class inheritance by delegation...(Design Pattern best practices).
.. so also refactor to class WindowsTerminalCommandProcessor extends TerminalCommandProcessor instead of extending both WindowsAnsiOutputStream and WindowsAnsiPrintStream

instead of

   AnsiOutputStream               AnsiPrintStream        <=== lot of Copy&Paste
          /\                              /\
       extends                        extends
           |                              |
   WindowsAnsiOutputStream        WindowsAnsiPrintStream   <=== also lot of Copy&Paste

refactor as

   AnsiOutputStream                      AnsiPrintStream     <==== still lot of Copy&Paste
                   \                         /         ( ... cf other PR to fix this )
                   uses                   uses
                      \                    /
                      1 \/               \/ 1
                        TerminalCommandProcessor     <---  factory ---  TerminalType
                                     /\
                                      |
                          WindowsAnsiPrintStream

…nheritance (both WindowsAnsiOutputStream/PrintSteam extends AnsiOutputSteam/PrinStream)
@hboutemy
Copy link
Copy Markdown
Collaborator

good idea but too complex code
rewrote it, keeping naming and package conventions, avoiding Writer, keeping compatibility with previous API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants