python - Best class naming conventions with multiple implementations -
i dealing project in have implement rather complex data structure p several ways (all of them in python). hoping of help, here how structured portion of project:
+ p/ |----+ a/ | |----p.py | |----+ b/ | |----p.py | |----factory.py |----abstractp.py
in p.py
have different implementations of p classes. named same, p
(they conform interface since inherit class abstractp
extends abcmeta
).
i planning on using factory pattern instantiate object of class p
specifying parameter. @ moment, in factory.py
avoiding name clashes using python import tricks:
from p.a.p import p p_a p.b.p import p p_b
i'm doing thinking use p.py
files indipendently in next project not naming classes p_a
, p_b
start.
is bad practice? best naming convention implementations in context?
you should name them after particular aspect of implementation.
take example couple of typical implementations of list type container:
- abstract class list (defines basic interfaces/behaviour of "list")
- class linkedlist (a linked node implementation of behaviour)
- class arraylist (an array based implementation of behaviour)
you name specific implementations after how implemented.
Comments
Post a Comment