473,748 Members | 10,569 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
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...ublishing/arch
itecture/

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...ublishing/arch
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.

e.g.

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.
Regards
Roger Ineichen
--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*
*************** *************** *************** *************** **
Jun 27 '08 #1
0 1067

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

Similar topics

10
8711
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()
0
1016
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.
0
1140
by: JZ | last post by:
I heard Zope3 has implemented CMF inside. What about Plone? Will it be added also? -- JZ
30
2569
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 behind capabilities is that you don't give any piece of code you don't trust a reference to something...
8
1271
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 for this? RH? Windows? mod_python? Spyce? Some other templating mechanism? To develop such a...
2
1496
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 done.
7
1600
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 end up looking like "another Plone site". I did a bunch of surfing and found some suggestions along...
0
1287
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
2
1437
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 Weitershausen has a set of slides at http://philikon.de/files/grok-bbq-sprint.pdf, and the Grok...
11
5821
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 else. I don't think I'll have enough time to get acquinted with Plone and its offer of products....
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3315
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
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.