Re: [Zope] Multi tier partitioning meaningful in some Zope apps ?
[Moved to ZOPE-DEV for hopefully further discussion] [Greg Ward, on Thu, 09 Dec 1999] :: My preference -- after only a few weeks with Zope, mind you -- is to put :: as little logic as possible in DTML. Restrict it to display/user :: interface logic; anything more than that, and you'll be in :: teeth-gnashing-land pretty quickly. It's not a general programming :: language; that should be obvious from the fact that it doesn't have :: variable assignment (except in the limited "let" sense). :: :: Business logic should be coded in Python, and interfaced via External :: Methods. (I guess you could use these newfangled Python Method :: thingies, but I want *more* in the filesystem and *less* in ZODB, thank- :: you-very-much.) Note: *interfaced* via External Methods; I like my :: External Methods to be fairly short little things that deal with stuff :: like translating Web/HTTP/Zope pecularities to the more general world :: addressed by my back-end Python classes. :: :: > Data Access -> ZSQL-methods -> Data API (JDBC-like) :: :: Hmmm. It's entirely possible that data access could/should be managed :: by just making all those back-end Python classes inherit from the ZODB :: Persistent class -- bang! no more SQL to worry about. That's an awfully :: big leap of faith to take, though... This is worth further discussion, expansion, IMO. I'm curious if you (Greg) are finding that your External Methods that "deal with stuff like translating Web/HTTP/Zope peculiarities" are shaping up to be reusable code. I'd also like to see an example or two to see how you're approaching this, if possible. I wonder if we could have a few base classes which would take care of the majority of these situations. I'd certainly welcome further thoughts/comments from others on this approach, particularly pros/cons on the "big leap of faith" part in the last paragraph.
On 09 December 1999, Patrick Phalen said:
This is worth further discussion, expansion, IMO.
Hey, I'm always happy to rant about something that I have only a bit of experience with. At least that way I can use ignorance as an excuse to bow out when things get too heated.
I'm curious if you (Greg) are finding that your External Methods that "deal with stuff like translating Web/HTTP/Zope peculiarities" are shaping up to be reusable code. I'd also like to see an example or two to see how you're approaching this, if possible. I wonder if we could have a few base classes which would take care of the majority of these situations.
In a word: no. As I said, I have only a few weeks' experience with Zope, so I have not given a moment's thought to making Yet Another Grand Framework that encapsulates my pet theory about using Zope as a tool for putting my Python objects on the web quickly and not-too-painfully. (I was going to say "painlessly", but in all honesty that word does not apply when DTML scoping and namespace rules are anywhere in sight.) I'm happy to explain the architecture that we're devising for putting our Python objects on the web, though. (For the record, "we" means the MEMS Exchange, a rather commercially-oriented research project that lives at CNRI -- meaning we have loads of Python expertise around. We all love Python, Linux, and free software; we think Zope is pretty neat but has some serious problems -- DTML being the big one. What we're trying to do is build a distributed manufacturing network for semiconductor processing, in particular for fabricating MEMS devices [aka microsystems, aka micromachines]. MEMS fabrication borrows a lot of technology from IC fabrication, but puts it together in weird and wonderful ways to build mechanical components in addition to electronic circuitry.) If you're into thinking in terms of "n tiers", I think we have 4 of them, but "n tiers" is a pretty fuzzy concept. The bottom tier is what a certain class of wanker would call "business objects": we have a bunch of classes to represent fabrication processes, customer orders, user accounts (a person that logs in to our web site), customer accounts (an organization that we send bills to), fabrication sites, fabrication equipment, etc. (Our persistence "layer" is a jumbled mish-mash of SQL, raw pickle files, text files, and DBM files full of pickles. Mostly the persistence code is in the same classes as the "business logic", so I consider it all one tier.) Tier 2 is the user interface. There are actually three sub-layers here (which is why I'm not sure if we have 3 or 4 or 5 or what "tiers"). Closest to the core, fundamental classes (aka "business logic") are a bunch of functions that might belong in those fundamental classes, or they might just be artifacts of our current user interface -- hence, they stand alone. Call that layer 2a. This is straight Python code that has nothing to do with Zope and knows nothing about the web. Farthest from the core (layer 2c) is all of our DTML: presentation, interaction, and as little logic as possible to make interface meaningful and usable. (Turns out that you still need a lot of logic to make a meaningful, usable web interface, and IMHO doing this stretches DTML to its limits.) In the middle -- layer 2b, if you will -- are our external methods, which provide an interface between the DTML and both the convenience functions of layer 2a and the core "tier 1" classes. (Sometimes parts of the user interface need the convenience functions, and some don't.) Of course, the beauty of Zope and DTML is that from our highest-level user interface components -- the DTML methods and documents -- we can go straight down to the fundamental classes, calling methods on the objects that represent fabrication processes, user accounts, fab equipment, etc. Having the whole system based on a single modern, dynamic, object-oriented language is an enormous win for ease-of-understanding and rapid development. Tier 3 is Zope itself, including ZODB -- the only thing we (currently) use ZODB for is what Zope uses it for, ie. to store all those DTML methods and documents and folders and external methods. So for now, ZODB and Zope are indistinguishable in our architecture. Tier 4 is of course the user's web browser, warts 'n all. Now, back to your original question: what do those external methods look like? Well, they tend to be fairly tightly tied to the DTML methods (or HTML hyperlinks, or form-actions, or whatever) that invoke them. If DTML method "foo" calls external method "bar", then "bar" is written with a full understanding of what's in foo's namespace. If an HTML form invokes external method "blah", then "blah" is keenly aware of the form variables it expects to see in REQUEST.form. Etc., etc. I see no need to invent Yet Another Grand Framework, because Zope does that for me. I think some of the details are stupid and annoying, but hey -- at least it's a Grand Framework, which is what web development really needs.
I'd certainly welcome further thoughts/comments from others on this approach, particularly pros/cons on the "big leap of faith" part in the last paragraph.
I was referring to ZODB; two aspects in particular: * involuntary use: all my user interface code (DTML methods and documents) goes into this big mysterious object database. I have nothing against object databases, and I'm glad to see a free one for Python. But dammit, to me this stuff isn't data, it's *CODE* -- and code is far too precious to entrust to a database. I want it in a filesystem with full CVS control over it. I want to be able to back it up with tar or afio, one file at a time (or rather, restore it one file at a time, if need be). I don't want my code locked up in this big box of data. * voluntary use: object database are good. Python is good. Why can't I put my Python objects into an object database, dammit? Well, I suppose I can, now that there is ZODB. However, it's a bit new and -- AFAIK -- has really only been put through its paces in the context of Zope. More importantly is the limitiation of one data store per Python interpreter. I want to draw a strict line between "my" objects (those "business objects" that represent the stuff important to what we're doing) and Zope's objects (all those DTML things that I really wish were in the filesystem where I can see them). Seems to me that the best way to do that is to give Zope a data store, and to give me a data store. Oops. Can't get there from here... sigh... Enough ranting for now. Guess I should do as AMK recommended and join zope-dev... sigh... I'll *never* get any work done now... Greg -- Greg Ward - software developer gward@cnri.reston.va.us Corporation for National Research Initiatives 1895 Preston White Drive voice: +1-703-620-8990 Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
[Greg Ward, on Thu, 09 Dec 1999] [snip lots of wonderful stuff deserving of further separate discussion] :: I was referring to ZODB; two aspects in particular: :: :: * involuntary use: all my user interface code (DTML methods and :: documents) goes into this big mysterious object database. :: I have nothing against object databases, and I'm glad to :: see a free one for Python. But dammit, to me this stuff isn't :: data, it's *CODE* -- and code is far too precious to entrust :: to a database. I want it in a filesystem with full CVS control :: over it. I want to be able to back it up with tar or afio, :: one file at a time (or rather, restore it one file at a time, :: if need be). I don't want my code locked up in this big :: box of data. :: :: * voluntary use: object database are good. Python is good. Why :: can't I put my Python objects into an object database, dammit? :: Well, I suppose I can, now that there is ZODB. However, it's a bit :: new and -- AFAIK -- has really only been put through its paces in :: the context of Zope. More importantly is the limitiation of one :: data store per Python interpreter. I want to draw a strict line :: between "my" objects (those "business objects" that represent the :: stuff important to what we're doing) and Zope's objects (all those :: DTML things that I really wish were in the filesystem where I can :: see them). Seems to me that the best way to do that is to give :: Zope a data store, and to give me a data store. Oops. Can't :: get there from here... sigh... OK, I'm completely ignorant about everything I'm just about to say, and anyone with something remotely useful to do right now should just move on; but I'll say it anyway, in the hopes of learning something or provoking someone who knows what they're talking about to come up with another thought. I *think* this is akin to what I was thinking about yesterday when I asked Merlin (Jim Fulton) if he'd ever considered using the ReiserFS under Linux as an alternative way to get around the one big bag of data (and maybe even the 2GB file limit) for an object store. I'm thinking that ReiserFS, now that it has journaling, might offer the chance to implement a filesystem-based, balanced-tree store of objects, with some optimized intermediary metadata store. I'm guessing this might just be too painfully slow; and of course it isn't portable. If this is too stupid to deserve comment, please comment anyway, so I'll at least know that it's finally time to go get that job wearing a paper hat. ;) would-you-like-fries-with-that-sir?-ly y'rs -patrick
Greg Ward wrote:
I was referring to ZODB; two aspects in particular:
* involuntary use: [...] I want it in a filesystem with full CVS control over it. I want to be able to back it up with tar or afio, one file at a time (or rather, restore it one file at a time, if need be). I don't want my code locked up in this big box of data.
I tend to agree with you, as far as the involuntaryness of the ZODB appears, sometimes. However, it's not at all clear to me how you pull off aquisition, cataloging, factories, etc, using fs objects. As a soon-to-be zope ISP (spring 2k), I find the monolithic approach rather annoying, as it forces me to go through a rather convoluted song and dance to set space quotas. I should just be able to set them like they've been set in linux/unix since time immemorial and forget about it. XML/RPC (SOAP?) might get us out of this... Since I can have my objects exported as XML, why can't all my objects be XML files residing on the filesystem, with some special case files for the behavior of folders? At the very least, why can't I have some magic file that looks like a folder to the fs that gives me a filesystem-like view of Zope the way I can get a ftp-like view of Zope?
* voluntary use: object database are good. [...] I want to draw a strict line between "my" objects (those "business objects" that represent the stuff important to what we're doing) and Zope's objects (all those DTML things that I really wish were in the filesystem where I can see them). Seems to me that the best way to do that is to give Zope a data store, and to give me a data store. Oops. Can't get there from here... sigh...
I have a similar problem, but I want to draw a line between clients, so I want n data stores (at the minimum)
Enough ranting for now. Guess I should do as AMK recommended and join zope-dev... sigh... I'll *never* get any work done now...
I'd like to help with this... I'm on the first few chapters of Learning Python, but I'm not the slowest monkey in the tree, and I've got some "free" time coming up. -- Ethan "mindlace" Fremen you cannot abdicate responsibility for your ideology.
participants (3)
-
Ethan Fremen -
Greg Ward -
Patrick Phalen