Re: [Sunuml-developers] File naming
Status: Planning
Brought to you by:
lazaruslong
From: Steven G. <laz...@gm...> - 2008-11-04 01:47:54
|
Hey Javier, I will replay on the developer list. Perhaps someone has an idea. Methods grouping seems necessary. In c++ importing methods instead of the whole class has compile & link advantage. Do you know if it is is the same in Python? One more thing, the file names are a pain. > > In python each file is a module, so if you put one class per file you get > the same number of modules as classes. > > The problem is when you want to use that class. > > For example in the file "SunUMLWorkspaceTreeUITool.py" there is a class > named "WorkspaceTreeUITool", if you want to use that class in another file > you write: > > import SunUMLWorkspaceTreeUITool #import the module > .... > tool = SunUMLWorkspaceTreeUITool.WorkspaceTreeUITool(parent) #Create an > instance of the object > .... > > We can do one of various things, the first is to group classes and > functions according to they're functionality, for example name the file > "workspace_tree.py" and put there all the classes necesary to make the > workspace tree work. This will reduce the amount of files and also the code > will be more visible. > > The other choice would be to use the import differently, like this: > > from SunUMLWorkspaceTreeUITool import WorkspaceTreeUITool #import the > module > .... > tool = WorkspaceTreeUITool(parent) #Create an instance of the object, you > don't have to put the name of the module > .... > > The second choice could be dangerous with name clashes, is like putting > "using namespace xx" in C++. > > > I think that grouping more classes inside one file would be better, as each > file would be a module of the program. Do you think this is ok? Or do you > think another way could be better? > > Regards > Javier > |