BhavyeMathur / goopylib-v1

A simple-yet-powerful 2D graphics framework built on top of Tkinter capable of creating good-looking & modern GUIs, games, and simple animations.

Home Page:https://pypi.org/project/goopylib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Design Choice: one file or X files?

ReblochonMasque opened this issue · comments

All the code in one file, a la John Zelle's graphics.py package is quite ungainly with over 3000 lines.

Do you want to keep everything in one file, or are you considering splitting the code into various modules?

So I was trying to split the library down into multiples files and it seemed like a lot of work... and I asked myself why? Why are so many libraries split into multiple files when 1 will just do? There must be a good reason for Manim, Keras, Tkinter and basically every other professional library to split themselves into multiple files.

The first thing that comes to mind is just that it becomes more organized but is that really an issue when using an IDE that can fold everything down? The main thing I see is that users can quickly reach functions which they need - need colours? use goopy.colour._____. So do you have any tips for splitting the file?

Clearly, you have not thought that through, here is an article to get you started:
https://www.quora.com/Why-do-you-want-to-split-your-program-code-into-multiple-files?share=1

For compiled languages, it is to avoid having to recompile the entire program when recompiling only one file suffices.

John Zelle's graphics.py package is designed to be lightweight, and make it easy for novice programmers to get started. It has, if I remember, in the order of 700-900 lines of code, which is a lot, but still "somewhat" manageable in one file.

It's been done and I have also renamed everything to follow the Python Convention rather than Camel Casing.