The PEAK Developers' Center   Diff for "PeakDatabaseApplications" UserPreferences
 
HelpContents Search Diffs Info Edit Subscribe XML Print View
Ignore changes in the amount of whitespace

Differences between version dated 2004-09-20 08:42:53 and 2005-03-08 15:03:29 (spanning 2 versions)

Deletions are marked like this.
Additions are marked like this.

= Introduction =
 
Note: this page is an incomplete draft; please see IntroToPeak for a tutorial.
 
 
PEAK is an excellent platform for building Python database applications. Using a combination of several PEAK packages one can build powerful and flexible database applications quickly and easily.
 
= First Steps: Binding and Naming =

This small example is already a working database application. It opens a connection to a [http://www.sqlite.org/ SQLite] database file, runs a query against a table, and prints the results. It also demonstrates one of the most useful aspects of the binding package: the ability to create an object once and make use of it in another part of the application. In database applications you usually want a single connection to a database server which will be shared throughout the application. Without binding one would have to either create the connection object and pass it to every new object that needed it, or provide it to the rest of the application using a singleton mechanism of some kind.
 
The former technique is highly error prone and forces the application to be "tightly coupled" -- that is, objects need to know quite a bit about each other and are usually highly dependent on each other's interfaces and structure. Changing one object in a tightly coupled application often requires changes to a number of other objects, and in large applications these inter-dependencies are not always known by every programmer or are easily missed. Tightly coupled software tends to be extremely brittle as a result.
[http://ww3.zhiliaotuofa.com 深圳机票][http://ww4.zhiliaotuofa.com 胶袋,深圳胶袋][http://ww5.zhiliaotuofa.com 胶带,深圳胶带][http://ww2.voip99.com 机票][http://ww5.voip99.net 光端机][http://wwb1.freewebpage.org 钢管][http://wwb2.freewebpage.org 风机][http://wwb3.freewebpage.org 锅炉][http://wwb4.freewebpage.org 变频器][http://wwb4.freewebpage.org 润滑油][http://wwb5.freewebpage.org 离合器][http://wwb6.freewebpage.org 狐臭][http://wwb7.freewebpage.org 糖尿病][http://wwb8.freewebpage.org 电容][http://wwb9.freewebpage.org 灰指甲][http://wwb0.freewebpage.org 近视眼][http://wwwm1.freewebpage.org 脱毛][http://wwwm0.freewebpage.org 净水器][http://wwwm3.freewebpage.org 蜂蜜][http://wwwm4.freewebpage.org 紧固件][http://wwwm5.freewebpage.org 制服][http://wwwm6.freewebpage.org 健身器材][http://www0w.91i.net 太阳能][http://wwa0.91i.net 婚纱摄影][http://wwa1.91i.net LED][http://wwa2.91i.net 酒店][http://wwa3.91i.net 水表][http://wwa4.91i.net 锅炉][http://wwa5.91i.net 打包机][http://wwa6.91i.net 痔疮][http://wwa7.91i.net 发电机][http://wwa8.91i.net 深圳装饰][http://wwa9.91i.net 切割机][http://wwz0.91i.net 深圳印刷][http://wwz1.91i.net 深圳条码][http://wwz2.91i.net 激光设备][http://wwz3.91i.net 照排机][http://wwz4.91i.net 餐具][http://ww3.voip99.com 私家侦探][http://www01.agreatserver.com 六合彩][http://www.zhiliaotuofa.com/ 脱发治疗网][http://jipiao.voip99.com/ 深圳机票][http://sudi.voip99.com/ 快递|速递公司][http://www1w.freewebpage.org 网络电话][http://shuijing.zhiliaotuofa.com 水晶][http://rongzi.voip99.net 融资][http://weixiu.voip99.net 电脑维修][http://chuguo.voip99.com 出国][http://kuaiguan.voip99.com 开关电源][http://mojv.voip99.net 模具][http://nami.voip99.net 纳米][http://chuli.zhiliaotuofa.com 污水处理][http://wuye.zhiliaotuofa.com 物业管理][http://voip2.freewebpage.org VOIP网关][http://wwwip2.freewebpage.org IP电话][http://www5d.freewebpage.org 软交换][http://www6d.freewebpage.org GK][http://voip.freewebpage.org 网络电话][http://www002.freewebpage.org 治疗脱发][http://www03.freewebpage.org 治疗脱头发][http://www2w.freewebpage.org 网络电话卡][http://voip1voip.freewebpage.org VOIP][http://voip1.freewebpage.org VOIP网络电话][http://yimin.zhiliaotuofa.com 移民][http://muqiang.voip99.net 幕墙][http://wujin.zhiliaotuofa.com 五金][http://www04.freewebpage.org 脂溢性脱发][http://www05.freewebpage.org 脱发特效药][http://www06.freewebpage.org 生发产品][http://www07.freewebpage.org 脱发产品][http://www08.freewebpage.org 治疗白发][http://www09.freewebpage.org 毛发移植][http://www81.freewebpage.org 头发移植][http://shipinhuiyi.zhiliaotuofa.com 视频会议][http://zuche.voip99.net 汽车租赁][http://tiezhi.zhiliaotuofa.com 贴纸][http://yinshuiji.zhiliaotuofa.com 饮水机][http://buxiugang.voip99.com 不锈钢][http://www82.freewebpage.org 自体毛发移植][http://wwwe2.freewebpage.org 皮肤病][http://wwwe3.freewebpage.org 伟哥][http://wwwe4.freewebpage.org 高血压][http://wwwe5.freewebpage.org 交换机][http://wwwes1.freewebpage.org 注册香港公司][http://jipiao.voip99.com/ 深圳机票][http://wwwes2.freewebpage.org 六合彩][http://vod.voip99.net 视频点播][http://sudi.voip99.com/ 速递公司][http://guojihuoyun.voip99.com 国际货运][http://baojingqi.voip99.com 报警器][http://chaye.voip99.com 茶叶][http://www7d.freewebpage.org 补品][http://www8a.freewebpage.org 增高][http://www9a.freewebpage.org 壮阳][http://wwwo1.freewebpage.org 青春痘][http://wwwo2.freewebpage.org 化妆品][http://wwwo3.freewebpage.org 治脚气][http://www32.freewebpage.org 鱼鳞病][http://wwwe1.freewebpage.org 白癜风][http://mudiban.voip99.net 实木地板][http://qianzheng.voip99.com 签证][http://kaoqinji.voip99.com 考勤机][http://jiudian.voip99.net 深圳酒店][http://www.shuangchuang.com/product/ip_super.htm 科迅公用电话通用计费系统][http://www3w.freewebpage.org 语音网关][http://wwwip.freewebpage.org ip超市][http://www4d.freewebpage.org 话吧][http://wwwip1.freewebpage.org ip公话超市][http://www.voip99.com/bbs/ voip在线交易中心][http://wwwes3.freewebpage.org 集团电话][http://wwwes4.freewebpage.org 保健品][http://www1a.91i.net 板蓝根][http://wwwd1.freewebpage.org 防盗门][http://wwwd2.freewebpage.org 监控][http://wwwd2.freewebpage.org 包装机][http://wwwd3.freewebpage.org 电缆][http://wwwd4.freewebpage.org 门禁][http://wwwd5.freewebpage.org 瓷砖][http://wwwc1.freewebpage.org 电机][http://ww0.voip99.com 耳机][http://ww1.voip99.com 卫星电视][http://ww0.voip99.net 监视器][http://ww1.voip99.net 变压器][http://ww2.voip99.net 对讲机][http://ww3.voip99.net 传感器][http://ww4.voip99.net 电子元器件][http://ww0.zhiliaotuofa.com 刀具][http://ww1.zhiliaotuofa.com 地毯][http://ww2.zhiliaotuofa.com 竹炭]
 
The singleton approach can help quite a bit by ensuring that only one instance of a certain type of object exists and that it can be found relatively easily. In Python this is often achieved through a separate module and module-level variables. The great drawback of a singleton, however, is that there's only one of it. Classes that use singletons are less reusable, because you can't create instances that use different values for a singleton. (Because then it wouldn't be a singleton!) So, classes that use singletons are still tightly coupled.
 
What is typically needed in larger applications is a flexible way to create, lookup, and use "singleton-like" objects. PEAK calls such objects "service components", and part of what PEAK's `binding` package provides is easy access to such components, using looser forms of coupling such as:

PythonPowered
ShowText of this page
EditText of this page
FindPage by browsing, title search , text search or an index
Or try one of these actions: AttachFile, DeletePage, LikePages, LocalSiteMap, SpellCheck