I am, as a hobby and best-practice exercise, to implement the same domain model (a simple GPS / GIS library, inspired in ISO 191xx stardards and OGC Abstract Model) both in Python and C#.
It first, I tought: "well, ISO/OGC gave me a finished UML, so I will have each class in C# and in Python to have the same signature".
I quickly found myself stuck in the "strict/static vs duck typing" problem, since I cannot count on method signatures in python. For example:
- Overloading constructors is quite common and natural in C#, but in Python you have to resort to
*args **kwargs
and conditionals; - Properties are encouraged in C#, but most source code I have seen around in Python tend to set the fields directly, although the use of
@property
orproperty()
is quite straightforward. - (and so on).
Actually there is (obviously) an obvious and very well documented "difference in mindsets" between one language and the other, and I would like to respect those differences while at the same time ending up with "the same" application, that is, equivalent domain model, architecture and functionality.
So my question basically is:
If I am to implement the same abstract model ("UML-like") in Python and C#, how should I proceed, and specifically, which constructs should be invariant, and which should be different?