-4

I am currently writing a simulation in python which is running in 2D. I want to extend it now to 3D and therefore I have to change the classes like the simulation grid.

My question is what is considered best practices?

I thought about the following options:

  1. Create extra classes for the 3D simulation
  • PRO: Clean separation between 2 and 3 D
  • CON: A lot of duplicate code
  1. Handle the 2d/3d difference internally in the class
  • PRO: DRY
  • CON: Could be confusing and possibly other issues
  1. Something else like extending the 2 D class?
  2. Or doing both?

Thanks for the feedback!

  • please don't cross-post: stackoverflow.com/questions/64372634/… "Cross-posting is frowned upon as it leads to fragmented answers splattered all over the network..." – gnat Oct 15 at 14:10
  • I did not know that. Someone commented that this would be the right place to post it. – Alexus Oct 15 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.