Liam Clarke wrote:
Hi Kent,


So the layering is


GUI - user interaction
Application functionality
CbDao - application-specific database access
DbAccess - generic database access, easy to use
JDBC connection - raw database access, not so easy to use


This sounds a lot like what I'm aiming for in a project, the layers &
objects passed up and down, are you able to provide an example of your
CbDao class for my learning edification?

(btw, is it Dao as in Lao Tzu?)

The Way that can be known is not the true way. Which makes it hard to provide examples. :-)

Actually DAO stands for Data Access Object which a common pattern for database access, and Lao Tzu's version is usually spelled Tao. Though I do appreciate the pun.
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html


My CbDao is work code so I can't just post it. It's actually pretty long and ugly too. But the idea of it is simple - it includes all of the SQL code of the main application and exposes it as application-specific methods. For example my app has a Category object that gets linked into a tree and is saved to the database. CbDao has methods like
def saveCategory(self, category):
def saveCategoryAsChild(self, category, parent):
def moveCategory(self, catToMove, newParent, pos):
def deleteCategory(self, cat):
def findOneCategory(self, uniqueGroupId, treeId):


The higher levels of the application don't have to worry about the implementation of these methods in terms of database operations.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to