473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Python Package Construction

Hi All,

I would like feedback on the proper/best 'Pythonic' approach.

This is a rather subjective question. Where is the trade-off between
package name lengths and faithfulness to the specifications?

[Discussion follows]

I am implementing a set of specifications for healthcare IT for Python
programmers to be able to develop interoperable healthcare applications.
I am using ZCA (aka.Zope3) extensively.

My desire is to implement the specs as faithfully as possible for two
reasons:
1) teachability - how easy/difficult is it to teach the framework and
specifications to new developers?
2) maintainability - which approach, if either, will make it easier to
maintain the framework if/when the specifications change?

My first pass was to develop a skeleton of the specs using Interfaces
from the ZCA approach and then the implementations following the
document structure of the specs.

The specs are available via SVN at:
http://www.openehr.org/svn/specifica.../architecture/

It is best to probably use real examples. Following the document
structure for packaging AND using the ZCA convention of having a
sub-directory for interfaces caused massive circular import issues due
to some classes being used in the interface definition of classes inside
the same interface file being imported into the implementation file. If
that sounds confusing; it is. It was confusing to write too. :-) If
anyone has questions I'll try to expand.

It is best to probably use specific, real examples.
http://www.openehr.org/svn/specifica...a_types_im.pdf

(note class names are converted from the upper case, underscore
separated style to CamelCase)

The package openehr.rm.datatypes.text defines the implementation class
CodePhrase. The associated interface file
openehr.rm.datatypes.interfaces.text needed CodePhrase as an attribute
type in DvCodedText and TermMapping needs both CodePhrase and
DvCodedText. This quickly got out of control.

So my solution to solving the circular imports is to take each interface
and implementation and put them into one file. Research tells me that
this is probably the second mostly popular ZCA approach. So,
ICodePhrase and CodePhrase are now in
openehr/rm/datatypes/codephrase.py, DvCodeText and IDvCodedText in
openehr/rm/datatypes/dvcodedtext.py, etc.

But wait, now I don't have a 'text package'. So if codephrase.py and
dvcodedtext.py were in openehr/rm/datatypes/text/ that would solve the
problem. BUT! Throughout the specs many of the names are VERY long
already. Adding another package name that is from 4 - 15 (or more)
characters long adds to the length of already long import statements,
i.e.

(sorry for the email line wraps)

from openehr.am.archetype.creferenceobject import
ICReferenceObject,CReferenceObject

should really be

from openehr.am.archetype.constraintmodel.creferenceobj ect import
ICReferenceObject,CReferenceObject

Thoughts, opinions and jeers all gratefully accepted. :-)

--Tim



--
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
Skype ID == timothy.cook
************************************************** ************
*You may get my Public GPG key from popular keyservers or *
*from this link http://timothywayne.cook.googlepages.com/home*
************************************************** ************

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBIWqvv2TFRV0OoZwMRAhE1AJ44+ZFv/1fP/btpKT54DukvkfkhXQCfboA9
yNbJVYMKg9qhThDNM7wZwRw=
=Cgb7
-----END PGP SIGNATURE-----

Jun 27 '08 #1
0 848

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Irmen de Jong | last post by:
QOTW: "Giving full access rights to a secretary or new programmer ought to insure an occasional random file deletion." -- Raymond Hettinger "I always use join, but that's probably because that...
0
by: Irmen de Jong | last post by:
QOTW: "Confronting the Martellibot is like flirting with an encyclopedia, I'd rather not do it myself, but I respect those who do, because it produces knowledge." -- Anton...
0
by: Irmen de Jong | last post by:
QOTW: "The best use for a bug report on comp.lang.python is as an object lesson for your grandchildren: 40 years from now you can search the archives for it, and tell the little darlings 'see? ...
0
by: Raymond Hettinger | last post by:
QOTW: "Of course it's still an ugly idiom. But there's a distinction between ugly-but-works and ugly-and-wrong." -- Michael Chermside commenting on one of the standard ways to simulate an...
0
by: Raymond Hettinger | last post by:
QOTW: "Python seems to encourage and reward incremental effort, and it leads one to explore extensions and improvements to programs because the language makes it relatively easy to see how to do...
0
by: Simon Brunning | last post by:
QOTW: "The security 'droids have decided that since the MS Office Suite is a 'standard' application then software written in MS Office VBA must be 'safe.' Any other development environments (such...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 393 open (+15) / 3315 closed (+17) / 3708 total (+32) Bugs : 908 open (+22) / 5975 closed (+49) / 6883 total (+71) RFE : 223 open...
11
by: Michael Spencer | last post by:
Announcing: compiler2 --------------------- For all you bytecode enthusiasts: 'compiler2' is an alternative to the standard library 'compiler' package, with several advantages. Improved...
0
by: Roger Ineichen | last post by:
Hi Tim For a usecase like this, I personaly recommend to defina all interfaces in one module which probably is a namespace if you need alot of interfaces to define. e.g. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.