OO conventions

Nicola Musatti nicola.musatti at gmail.com
Mon Feb 6 11:51:56 EST 2006


Fredrik Lundh wrote:
> Nicola Musatti wrote:
[...]
> > What is important to me is to keep your get_initial_data() function
> > outside Klass if it's task is non trivial, e.g. it has to interact with
> > the OS or a DB.
>
> why ?

Separating the internal logic of an application from its interactions
with the outside world, e.g. retrieval from a file or a database and
presentation to a GUI, makes it easier to reuse the logic in different
contexts and may help make it possible to use highly generic solutions
for those interactions. I'm thinking of code generation or
introspection, which may be applied with very limited knowledge of the
application logic.

In larger projects I find that this separation tends to match the
different areas of expertise that are needed: database experts, GUI
experts, domain experts, etc.

Cheers,
Nicola Musatti




More information about the Python-list mailing list