My rule of thumb: If in doubt, use separate modules per class, it’s a much nicer place to be as your code grows, or as time goes by and you wonder “where you left that class”. If you KNOW your class is depended on exclusively by other things inside a single module, then maybe they can share the module.
My opinion is that there isn’t much reason not to do a module per class, which goes hand in hand with my opinion that “many smaller modules” > “fewer larger modules”. On Sun, 15 Oct 2017 at 10:46 am, Justin Israel <[email protected]> wrote: > > > On Sun, Oct 15, 2017, 12:20 PM Rudi Hammad <[email protected]> wrote: > >> Ok. They are related only to 1main UI. So I will create 5 classes inside >> the same module. My doubt was if I had to do 5 modules. >> So I guess that if they were usable in other different UIs it would make >> sinc eto do different modules, but If they are all relate only to 1 UI, >> multiple classes if the better choice, >> > > Oh, different modules just depends if they grow larger and serve > completely different purposes. Even if you wanted to reuse them you could > keep them all in one module. But if say, one of them had a dependency on > another external library, you could separate them so that other apps can > still use the ones that don't have dependencies > > > >> El sábado, 14 de octubre de 2017, 23:48:06 (UTC+2), Justin Israel >> escribió: >> >>> >>> >>> On Sun, Oct 15, 2017 at 10:23 AM Rudi Hammad <[email protected]> wrote: >>> >>>> Hello, >>>> >>>> I am writing a tool in maya with pyside and I was wondering if I should >>>> do multiple classes inside a module. After reading different opinions , I >>>> didn´t get a clear answer. >>>> To simply my question, imagine that you have a UI with 5 buttons that, >>>> when clicked, open different sub-UIs more or less complex.. >>>> >>>> For instance, one of the buttons opens a simple color picker ui, >>>> antoher one opens a dialog with a table widgets, another one opens a more >>>> complex UI with its own layout and widgets etc...etc... >>>> >>>> Should I create 5 classes inside the same module for this secondary >>>> UIs, only 1 class doing all (which will make it less clean because it would >>>> have to many methods) >>>> or should I create five modules. The color picker ui is very simple and >>>> can be done in less than 20 lines, but other uis could be around 200 lines. >>>> So If I am consistent and decide to write modules, I will have one >>>> module with 20 lines, and another with 200. >>>> >>> >>> My opinion is that if the other widgets are anything more than trivial >>> dumb widgets (a dialog with some initial settings), that it is beneficial >>> to separate them into individual classes. This will help keep your >>> separation of concerns clear and help keep the code maintainable. If your >>> color picker is generic, then making it a discreet class would mean you can >>> reuse it in other code. >>> >>> >>> >>>> >>>> Thanks, >>>> R >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/python_inside_maya/76fd4881-de81-462c-955e-a23f75c3eed2%40googlegroups.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/76fd4881-de81-462c-955e-a23f75c3eed2%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/eb945a4b-210f-4fa7-aa94-f3ebf43b7151%40googlegroups.com >> <https://groups.google.com/d/msgid/python_inside_maya/eb945a4b-210f-4fa7-aa94-f3ebf43b7151%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1UGjDXzsfrER5JaJ8DTzGoueW%3Di%3Dvv_PqGhzgGVxmpyQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1UGjDXzsfrER5JaJ8DTzGoueW%3Di%3Dvv_PqGhzgGVxmpyQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPzKG6VqaeUeJKJ%3D6t6_Wazq-kd6ZfJgM%3DuvfH8b2vuNVZLQTA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
