Applied bridge design pattern to main code file covid19.py. The main class (COVID19) uses two new formatter (1 and 2) classes to format the output of its data and make it easier to read for the user. The data is returned more neatly and vertically (rather than horizontally in a list). Dividers are also placed to show clear separation of data where needed (ex. between individual countries).
Formatter1 class is used to format the outputs of methods in COVID19 class that get data by country name, code and id.
Formatter2 class is used to format output of methods that get total data (ex. getAll( ) method).
Should the formatting be changed, only the code in Formatter1 and 2 classes should be modified (and the main COVID19 class can be left as is).
Applied bridge design pattern to main code file covid19.py. The main class (COVID19) uses two new formatter (1 and 2) classes to format the output of its data and make it easier to read for the user. The data is returned more neatly and vertically (rather than horizontally in a list). Dividers are also placed to show clear separation of data where needed (ex. between individual countries).
Formatter1 class is used to format the outputs of methods in COVID19 class that get data by country name, code and id. Formatter2 class is used to format output of methods that get total data (ex. getAll( ) method).
Should the formatting be changed, only the code in Formatter1 and 2 classes should be modified (and the main COVID19 class can be left as is).