Nice attempt @aristosgi, but you have several flaws and omissions in your implementation. I will explain a few:
When applying the Strategy pattern, the concept is to have an interface that is implemented by specific classes, in order to develop different functionality, as in the case of exporters, analyzers and readers. When applying the Factory pattern, the concept is to simplify the generation of instances based on the types requested by the client app. These patterns are commonly used together, but in your case, their implementation was incorrect. While you have added factory classes for two of the the three dimensions, you have not created the dimension interfaces, thus the implementation of the Strategy pattern is incorrect. In addition, the MetricsExporter file should contain the interface, but in your case you have added the exact same code as in MetricsExporter factory (the only difference is that in the second case you have also handled the null case using the NullExporter).
Your choice to implement SourceCodeAnalyzer as an abstract class and the relevant class code indicate that you wanted to also implement the Bridge pattern, but you did not proceed with this decision, thus parts of the code are a bit irrelevant. In any case, RegexSourceCodeAnalyzer and StrCompSourceCodeAnalyzer do not extend the SourceCodeAnalyzer class and this is incorrect.
When implementing the Facade design pattern, you have to remove the code relevant to the program logic from the demo client. This was not done in your case.
Based on the above, you have some major inconsistences in the UML diagram.
You did not modify the code regarding the file reader.
You could modify the unit tests, in order for them to align with your code changes.
You have several code errors, with the most important of them being inconsistences between file and class names. Thus, your project did not compile.
Nice attempt @aristosgi, but you have several flaws and omissions in your implementation. I will explain a few:
MetricsExporter
file should contain the interface, but in your case you have added the exact same code as inMetricsExporter
factory (the only difference is that in the second case you have also handled the null case using theNullExporter
).SourceCodeAnalyzer
as an abstract class and the relevant class code indicate that you wanted to also implement the Bridge pattern, but you did not proceed with this decision, thus parts of the code are a bit irrelevant. In any case,RegexSourceCodeAnalyzer
andStrCompSourceCodeAnalyzer
do not extend theSourceCodeAnalyzer
class and this is incorrect.Facade
design pattern, you have to remove the code relevant to the program logic from the demo client. This was not done in your case.Please have a look at Antonis's proposed solution for further information.
Have a nice summer!