> > I think "Build" is a strange name for a class
@justin: I agree 100%, taking my word back, Builder is anyday a better name that Build for a class, I think I was focussing more on the package naming conventions as whole not just the class. And here's the more precise rule - "Class names should nouns, method names should be verbs". This should work in almost all cases, though there be a corner case where this is not possible, but I think mostly it is. @rudi: Ask these questions before naming: - What does the package do - Provides functionality only for creating a skeleton object or it does more than that. Is there an expectation for the package to grow in future, will it provide more functionality etc. - - What does the module `skeleton` contains - Does it contain only one class for building the skeleton object or it has some other interface fucntions, other classes etc. for doing some other stuff. If yes, then what could be collectively those utilities called. - - And more importantly - What does the class `Skeleton` actually do. Does it serve to build or construct a `Skeleton` object, which might be another class - if so then this class is factory, name it `SkeletonBuilder`. If this class is the skeleton object itself, then you have named it correctly. It's name SHOULD be `Skeleton`. So Skeleton(), creates a Skeleton object and that is fine. If the class has other alternate constructors (other than __init__()), probably implemented as @classmethods than you can name them either starting with 'from....' or 'create' whatever you want to. - Alok On Sun, Sep 25, 2016 at 12:31 PM, Justin Israel <[email protected]> wrote: > I think "Build" is a strange name for a class though, since it implies an > action such as something a function should do. But calling a class means > calling its contructor. Would a more appropriate name be "Builder" since a > class would be a collection of logic that can be used to build a Skeleton? > Because... once you make an instance of your Build class...you have a... > Build instance? > > On Sun, Sep 25, 2016 at 5:24 PM Alok Gandhi <[email protected]> > wrote: > >> But a class named Skeleton is more descriptive than Build. >> >> >> Of ourse it is, but only if you do not have a namespace context. >> >> I totally agree with Yury here. Your namespace already qualifies what >> Build class is, so you do not have to worry about the context. >> >> Always remeber - Namespaces are one honking great idea. And PEP 8, should >> be followed whenever it is possible. >> >> I would recommend a great talk by Brandon Rhodes >> <https://www.youtube.com/watch?v=YklKUuDpX5c&index=6&list=PLuJJxrghlFfpojbzNvBuCQmBliw2QOOUI> >> on this very topic, who succintly and efficiently covers most of the naming >> methodologies. I think this talk also covers what you are trying to solve. >> >> I do not know how are modules are setup or what your code does, but from >> what I can read, I would suggest something like this: >> >> package name : rigbuilder >> module name : skeleton >> class name : Build >> >> Also you can put in the __init__.py of top directory of the package >> __all__ = [skeleton, ...... etc.] >> for the all modules that you want to expose. >> >> So now there are few options for the client code, depending on how they >> want to use: >> >> import rigbuilder >> mySkeleton = rigbuilder.skeleton.Build() >> >> or >> >> from rigbuilder import skeleton >> mySkeleton = skeleton.Build() >> >> or >> >> from rigbuilder.skeleton import Build as SkeletonBuilder >> mySkeleton = SkeletonBuilder() >> >> >> and lastly, though not recommended >> >> from rigbuilder import * >> mySkeleton = skeleton.Build() >> >> >> >> >> On Sun, Sep 25, 2016 at 2:58 AM, Rudi Hammad <[email protected]> >> wrote: >> >>> hmmm, interesting. >>> But a class named Skeleton is more descriptive than Build. >>> I might be overthinking all that, but I am curious about it. >>> >>> El sábado, 24 de septiembre de 2016, 19:47:28 (UTC+1), ynedelin escribió: >>>> >>>> You could use Build instead of Skeleton. >>>> This would make sense since you already have skeleton in the >>>> rbskeleton, then you will have rbs.Build() >>>> It would also work well with other functions like rbs.Destroy() >>>> On Sep 24, 2016 12:20 PM, "Rudi Hammad" <[email protected]> wrote: >>>> >>>>> Hi, >>>>> so I guess that in the end every one has his one logical way for the >>>>> nomenclature. pep 8 says that packages should always be lowercase with no >>>>> underscore, and module lowercase with underscore if needed. >>>>> I have a package call rbskeleton, "rb" stands for rig builder. And the >>>>> module is name skeleton. and the class inside the module is Skeleton .(or >>>>> I could also name the class BuildSkeleton to add som variety , I don´t >>>>> know) >>>>> I have then >>>>> >>>>> import rbskeleton.skeleton as rbs >>>>> mySkeleton = rbs.Skeleton() >>>>> >>>>> I don´t like repeating all the time skeleton, but there is no other >>>>> way to describe it. what do you thing? Do you follow pep 8 convention on >>>>> packages and modules >>>>> >>>>> -- >>>>> 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/f6a528d2-d2ee-4cfa-9c9c- >>>>> dbe8beda6bf6%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/python_inside_maya/f6a528d2-d2ee-4cfa-9c9c-dbe8beda6bf6%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/1ca75171-3b86-4dc1-939f- >>> ad35c0337ad2%40googlegroups.com >>> <https://groups.google.com/d/msgid/python_inside_maya/1ca75171-3b86-4dc1-939f-ad35c0337ad2%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/CAPaTLMTagdxQr2cMtbh8YUVTat% >> 3D0f0%3Dsskkz4A_rwvb9-JAWQg%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMTagdxQr2cMtbh8YUVTat%3D0f0%3Dsskkz4A_rwvb9-JAWQg%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/CAPGFgA2JRo0v0OB-F-TNbvCyGrzfnqZna4tws4juB82YG3BY > FQ%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2JRo0v0OB-F-TNbvCyGrzfnqZna4tws4juB82YG3BYFQ%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/CAPaTLMSKMUP%2B8y%2BeQC6LOBnK3p071iyXdW_2NjqOU95zhvGZ3w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
