473,582 Members | 3,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AW: [Zope3-Users] Python Package Construction

Hi Tim
Betreff: [Zope3-Users] 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
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:

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.
itecture/rm/data_types_im.p df

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

The package openehr.rm.data types.text defines the
implementation class CodePhrase. The associated interface
file openehr.rm.data types.interface s.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.arch etype.creferenc eobject import
ICReferenceObje ct,CReferenceOb ject

should really be

from openehr.am.arch etype.constrain tmodel.creferen ceobject
import ICReferenceObje ct,CReferenceOb ject

Thoughts, opinions and jeers all gratefully accepted. :-)
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.


openehr.interfa ces.foobar.IFoo Bar

the reason why:

- spearate interface from implementation. That's an
important aspect in a component architecture. If you
define your implementation and interfaces in one file,
then you don't need a component architecture.

- interfaces are separated in a well know place.

This means if you define a module and you like to import
an interface you can import just one line:

from openehr import interfaces

Which makes it very simple.
Roger Ineichen

Timothy Cook, MSc
Health Informatics Research & Development Services LinkedIn
Skype ID == timothy.cook
*************** *************** *************** *************** **
*You may get my Public GPG key from popular keyservers or *
*from this link http://timothywayne.cook.googlepages.com/home*
*************** *************** *************** *************** **
Jun 27 '08 #1
0 1058

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

Similar topics

by: Debian User | last post by:
Hi, I'm trying to discover a memory leak on a program of mine. I've taken several approaches, but the leak still resists to appear. First of all, I've tried to use the garbage collector to look for uncollectable objects. I've used the next: # at the beginning of code gc.enable()
by: Aroldo Souza-Leite | last post by:
Hi, The Rheinland section of the German Zope User Group (dzugRheinland) is announcing a Zope 3 Sprint on Producuts for December 2003. Sprint Topics: porting products from Zope 2 to Zope 3; creating new products in Zope3. Sprint Coaches: Martijn Faassen and Philipp von Weitershausen.
by: JZ | last post by:
I heard Zope3 has implemented CMF inside. What about Plone? Will it be added also? -- JZ
by: Sean R. Lynch | last post by:
I've been playing around with Zope's RestrictedPython, and I think I'm on the way to making the modifications necessary to create a capabilities-based restricted execution system. The idea is to strip out any part of RestrictedPython that's not necessary for doing capabilities and do all security using just capabilities. The basic idea...
by: Jean | last post by:
Hi. I am new to Python, but very eager to learn. I've browsed many postings and found conflicting opinions on the best backend and development setup. In fact, I am more confused now that when I first began investigating this problem. I need to create web pages with MySQL as the primary data source. What would be the best server set up...
by: Mir Nazim | last post by:
Hi, I wanted to know what will happen to plone once Zope3 will be official version. Is plone being ported to Zope3. I googled it but did not come accross anything stating the plone's migration to zope3. I am thinking to take up a project. plone is a candidate for it. should i want to take benifit of zope3 features too. what should be...
by: Markus Wankus | last post by:
Hi All, Does anyone know of any good Zope3 examples? I'm new to Zope and I just want to start with a simple website, and later move on to a more complex site with interactive calendar, obligatory blog/wiki/buzzword-of-the-day-thingy, etc. I started by installing Zope2 and Plone but it was very slow, and quite frankly I didn't want to...
by: Chris Calloway | last post by:
Registration ends Friday: http://trizpug.org/boot-camp/camp5 -- Sincerely, Chris Calloway http://www.seacoos.org office: 332 Chapman Hall phone: (919) 962-4323
by: Paul McGuire | last post by:
I just stumbled upon a great-looking project, to make Zope3 more approachable to mere mortals such as myself. Echoing the ROR mantra of "convention over configuration", the Grok project (http:// grok.zope.org/) aims to stand on the shoulders of Zope3, while providing the ease of development of ROR (for instance, no more ZCML). Philipp von...
by: Grzegorz Staniak | last post by:
Hi, In a couple of weeks I'm starting a medium-size project (using a web framework) involving a workflow implementation. Are you aware of any open source workflow engines/libraries that I could base the project on? Google returns hist for GoFlow (Django only, from what I can tell), itools.workflow, spiff (AFAIK tied to a CMS), but not much...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.