teragrep / cfe_31

0 stars 0 forks source link

Rename classes #17

Closed MoonBow-1 closed 7 months ago

MoonBow-1 commented 8 months ago

The "Parser" name doesn't conform into OOP naming practices, hence it should be name something like "Hub". The parseDirs method inside the Parser class should be elevated into its own class and called PromiseList. CFE-01 and RELP Parsers should be renamed to ...Promise (This will be a single class with a generic type parameter.

MoonBow-1 commented 8 months ago

Renaming has been done in stages, going to work on the Promise class with a generic type next

MoonBow-1 commented 8 months ago

Worked on other tickets first, so the refactoring would be simpler with new changes

MoonBow-1 commented 8 months ago

Going to look more into generics, and how they could be used in the Promise class.

MoonBow-1 commented 8 months ago

Going to switch the generic type argument to an interface for RelpPromise class

MoonBow-1 commented 8 months ago

Initial Interface has been added, going to look more into overrides tomorrow

MoonBow-1 commented 8 months ago

Decided to not override the default method, but use the implementation instead

MoonBow-1 commented 7 months ago

Interface has been refactored to be more object-oriented, now has 3 methods for "getting" different objects from the Promises.

There is a possibility that the generic type parameter from the Promise class is removed, but going to discuss that soon/now. (This is related to the use of instanceof method/function of Java)

MoonBow-1 commented 7 months ago

Removal of the generic type argument is in progress, all unit tests pass, but will need to confirm with CFE-18 endpoints once the JSON response is implemented on both sides (breaking changes on CFE-18 responses).

MoonBow-1 commented 7 months ago

https://www.yegor256.com/2015/04/02/class-casting-is-anti-pattern.html