August 2018
Intermediate to advanced
332 pages
9h 12m
English
It would be better to separate this into two different interfaces, one for each method:

With this design, objects that derive from XMLEventParser and implement the from_xml() method will know how to be constructed from an XML, and the same for a JSON file, but most importantly, we maintain the orthogonality of two independent functions, and preserve the flexibility of the system without losing any functionality that can still be achieved by composing new smaller objects.
There is some resemblance to the SRP, but the main difference is that here we are talking about interfaces, so it is an abstract definition ...
Read now
Unlock full access