Share some small bits of functionalities across packages

  softwareengineering

Suppose that:

  • you invent a new coordinates system and you create a class to represent it
  • you have two products which need to deal with this coordinates system but which, apart from that, are completely independent

Then, how do you share this class among both products?


I think this question can receive a generic answer, but I ask it in the specific context of Python programming.
Translated in “Python words”, the question is: is it worth creating a package which defines only one class? What other ways are there to share very small bits of functionality?

1

The correct way is to make a package.

Now, when its a single class you have to ask yourself whether its easier just to copy and paste the code.

But even if thats the case, it doesnt make it the right way to do it generally, it just means you decided to cut a corner and save some time.

4

LEAVE A COMMENT