August 2018
Intermediate to advanced
332 pages
9h 12m
English
Now, we want to be able to parse an event from several data sources, in different formats (XML and JSON, for instance). Following good practice, we decide to target an interface as our dependency instead of a concrete class, and something like the following is devised:

In order to create this as an interface in Python, we would use an abstract base class and define the methods (from_xml() and from_json()) as abstract, to force derived classes to implement them. Events that derive from this abstract base class and implement these methods would be able to work with their corresponding types.
But what if a ...
Read now
Unlock full access