Where to put business logic?
I know that this issue has been up before, at least partly. Is there an "unwritten" rule on where to put business logic in an Zope app? Example: where to validate data input? In the submit method or somewhere in the underlying database (PostgreSQL, MySQL, Oracle etc.)? What could the underlying motives be for choosing one or the another strategy? In the particular case I'm going to use it for a db case in school and I intend to use Zope to present the data etc. instead of using MS VC++ 6.0 which I don't get the idea of anyway. -- Best regards / Mvh., Steen Suder, sysadm kollegie6400.dk -|- OpenSource --- Sign of the time Scan-Aqua ADVARSEL WARNING http://www.uk.k64.dk/sfs/Scan-Aqua/
Steen Suder wrote:
I know that this issue has been up before, at least partly.
I've been thinking about this...
Is there an "unwritten" rule on where to put business logic in an Zope app?
Well, right now I'm thinking the answer might be, "in a Java servlet".
What could the underlying motives be for choosing one or the another strategy?
Well, good design and experience suggests that web apps need a middle layer. Possible Solution: Make python classes that implement the business logic. These classes get called as external methods. I have some doubts about this, though. Zope hasn't been too stable for me, and I have a fairly plain installation. Also, I'm not sure if the behavior of the Python external objects are really well defined. (Maybe I just haven't found it.) Here's what I mean: With Java servlets, the lifetime of the objects is defined like this: + A servlet implements the methods init() and get(). + The first time a request comes to the servlet, one instance is created, and init() is called on it. + Then, on that and every other other request, that instance's get() parameter is called, and is expected to produce the results to the client's request. Thus, servlets are long-lived objects. It's easy to do things like program web agents that cache their data, make connections to databases, poll web sources, and automatically rebuild those connections if the system goes down and comes back up. I'd like to check out doing this in Python, but I haven't seen the "life cycle" of Python server objects explained. -Robb
Robb Shecter wrote:
Steen Suder wrote:
I know that this issue has been up before, at least partly.
I've been thinking about this...
Is there an "unwritten" rule on where to put business logic in an Zope app?
Well, right now I'm thinking the answer might be, "in a Java servlet".
What could the underlying motives be for choosing one or the another strategy?
Well, good design and experience suggests that web apps need a middle layer.
Possible Solution: Make python classes that implement the business logic. These classes get called as external methods.
Well, I wasn't thinking loud enough ;-) What is the case if I only use Zope and an external SQL server connected via a DA? I use PostgreSQL. This way I'll have no middle layer as you describe it, no servlets and no external methods. <Cut> -- Best regards / Mvh., Steen Suder, sysadm kollegie6400.dk -|- OpenSource --- Sign of the time Scan-Aqua ADVARSEL WARNING http://www.uk.k64.dk/sfs/Scan-Aqua/
participants (2)
-
Robb Shecter -
Steen Suder