Files application architecture
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Fri Sep 5 19:03:30 EDT 2008
Benjamin Watine a écrit :
> Hi,
>
> I'm about to develop a small python application and I wonder how to
> organize files in this application.
> I'm familar to java, so I'm tempted to use the same convention
http://dirtsimple.org/2004/12/python-is-not-java.html
> : 1 file
> per class and 1 folders per package.
Don't. This is a waste of time and a pain to maintain, and more over it
doesn't make any sense since Python doesn't force you to put everything
in classes.
> I know that packages doesn't exists in python,
Did you actually read the doc ? While Python's packages are not the same
thing as Java's, they do exist.
http://docs.python.org/tut/node8.html#SECTION008400000000000000000
> they are modules instead.
> May I create specific module for each "group of class" ?
The usual way to get cohesive modules is indeed to group closely related
objects (classes, functions, etc) in a same module.
> My application
> follow the MVC paradigm, so basically, I've a package Model, a package
> View, and a package Controller.
If your app is small, having _modules_ models, views and controllers
should be enough.
> So, what are best practices for organizing files and folders in a small
> python project ?
The best practice is to keep things simple, as usual.
More information about the Python-list
mailing list