精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2006-11-23
* See http://tob.ableverse.org/benchmarks.html to get shock by extreme database performance! * See http://www.webofweb.net ( CDDL source code at http://wow.dev.java.net ) for TOB in action! * See the full artical for how easy it has been to write complex persistent applications! * Download a FREE version of TOB from http://www.ableverse.com/download-free.jsp * Learn TOB at http://www.ableverse.org/tutorials/index.html (Work In Progress) While Relational model is the most mature and popular database theory nowadays, it lacks the simple feasibility to be combined with Object Oriented Programming methodology. Intelligent people thus invented Object/Relational Mapping (ORM) technology to overcome this complexity. However, ORM should be taken as a workaround after you learned a true Object Oriented Persistent Data Model, like the Object/Relation/Kin (ORK) model behind TOB. Things will never get enough simplified unless the Persistent Object Topography is expressed in native OO semantics. In order to protect end customers' existing investment on relational database systems, as well as to retain RDBMS' rich and mature management abilities, TOB stores physical data to relational databases with a clear structure via standard JDBC™. RDBs are used as the so called SwapEngine in terms of TOB. As a result, statistics, maintenance, and interoperability could be well provided by interfaces and tools of the underlying RDBMS. This is like an ORM, but differs from ORMs in essential (revealed by deep look at TOB). In addition, TOB leverages code generation technology to ease application programmers' life. In the WoW project (http://wow.dev.java.net), TOB generates 4.38MB of .java code according to 121KB of application defined Java persistent class code, to support any of the 5 relational databases for physical storage (be the SwapEngine in TOB term). The currently supported RDBs are: * H2 Database Engine (by default shipped with WoW) — http://www.h2database.com * MySQL — http://www.mysql.com * PostgreSQL — http://www.postgresql.org * Hyper Sonic SQL Database — http://www.hsqldb.org * Oracle — http://www.oracle.com TOB persistent programming is extremely easy and straight forward, the only thing you need to work with is your Java source code. No XML maps, no DDLs, no SQLs outside your Java code (SQL needs have been fairly reduced, but find persistent objects with SQL whenever needed), and SQL criteria are automatically generated as class fields at compilatin, so SQL syntax is partially checked at Java compilation. And you don't even need to create the db schema by yourself, just run your java program and tables get created underground (But Oracle is an exception, which doesn't tolerant runtime schema changes, but SQL scripts will be generated for Oracle, simply run it before the java application will well solve). The key technology to enable TOB's extreme runtime performance and ease of development is a now named Object/Relation/Kin (ORK) persistent data model, which is a derivation from the broadly adopted Entity/Relation (http://en.wikipedia.org/wiki/Entity-relationship_model) model. The long standing ER model is going to be extended now. As RAM sizes of server machines ever getting increased today,the traditional disk storage targeted database systems shows inefficiency in large RAM setups, even added various cache mechanisms. To prove the ease of persistent development based on TOB, let's see a simplified demo, consists of a binary relation (the Marriage class) and a triple relation (the Parentage class). Once you obtained an instance of the Person class, i.e.(assume you've got his/her ID as 123): Persistent<Person> p = tob.get(123); You can directly and immediately get his/her spouse and children, by just a method invocation! Just these 3 class files, compile them with the Annotation Processing Tool (http://java.sun.com/j2se/1.5.0/docs/guide/apt/ which is going to be a standard procedure of Java compilation) with TOB jars on classpath, and run, nothing more needed to do! And when you create a persistent instance of Marriage: Persistent<Person> groom = ... // obtain the to-be husband Persistent<Person> bride = ... // obtain the to-be wife Persistent<Marriage> marriage = tob.birth(new Marriage(groom, bride)); The spousefield of each newlywed will get automatically filled by TOB. And when current transaction get commited, it goes permanent. So will the children, sonsand daughterscollection of the new father and mother when you birth a persistent instance of Parentage. And you can simply manage TOB transactions at framework level (i.e. for J2EE web apps, add a filter on /*, like the WoW Scener app does). In application code, you only need to annotate methods of persistent classes with @Reading, @Writingand @Retyingaccordingly. Leave the transaction handling to TOB! And the sonsand dautherscollections stand to prove that persistent collections maintained by TOB are able to be filtered by application logic. (Though the filter logic is as simple as judging the gender of a person, more complex criteria will work the same way) A simple demo of TOB persistent programming: Class Person: @MakeSwappable public class Person extends TheObject { @Kin(iAm = "child") protected Father father; @Kin(iAm = "child") protected Mother mother; @Kin(iAm = { "father", "mother" }, theyAre = "child") protected final Set<Child> children = new TreeSet<Child>( new ChildComparator()); @Kin(iAm = { "father", "mother" }) protected final Set<Child> sons = new TreeSet<Child>(new ChildComparator()) { private static final long serialVersionUID = 1L; public boolean add(Child c) { if (c.o.gender != Gender.MALE) return false; return super.add(c); } }; @Kin(iAm = { "father", "mother" }) protected final Set<Child> daughters = new TreeSet<Child>( new ChildComparator()) { private static final long serialVersionUID = 1L; public boolean add(Child c) { if (c.o.gender != Gender.FEMALE) return false; return super.add(c); } }; @Kin(iAm = { "husband", "wife" }, thisIs = { "wife", "husband" }) protected Spouse spouse; public Person() { birthday = new Date(); name = new Name(); } public Spouse getSpouse() { return spouse; } public Father getFather() { return father; } public Mother getMother() { return mother; } public Set<Child> getChildren() { return children; } public Set<Child> getSons() { return sons; } public Set<Child> getDaughters() { return daughters; } private static class ChildComparator implements Comparator<Child> { public int compare(Child c1, Child c2) { return (int) (c2.o.birthday.getTime() - c1.o.birthday.getTime()); } } } Class Marriage: @MakeSwappable public class Marriage extends TheRelation { abstract public class Spouse extends Role<Person> { protected Spouse(Persistent<? extends Person> person) { super(person); } } public class Husband extends Spouse { protected Husband(Persistent<? extends Person> man) { super(man); } } public class Wife extends Spouse { protected Wife(Persistent<? extends Person> woman) { super(woman); } } @Tie protected Husband husband; @Tie protected Wife wife; public Marriage(Persistent<Person> man, Persistent<Person> woman) { assert man != null : "Who is marrying noman?"; assert woman != null : "Who is marrying nowoman?"; this.husband = new Husband(man); this.wife = new Wife(woman); } protected Marriage() { } @Retying( { "husband", "wife" }) public void newPair(Persistent<Person> husband, Persistent<Person> wife) { this.husband = new Husband(husband); this.wife = new Wife(wife); } public Husband getHusband() { return husband; } public Wife getWife() { return wife; } } Class Parentage: @MakeSwappable public class Parentage extends TheRelation { public class Father extends Role<Person> { protected Father(Persistent<? extends Person> p) { super(p); } } public class Mother extends Role<Person> { protected Mother(Persistent<? extends Person> p) { super(p); } } public class Child extends Role<Person> { protected Child(Persistent<? extends Person> p) { super(p); } } @Tie protected Father father; @Tie protected Mother mother; @Tie protected Child child; public Parentage(Persistent<Person> father, Persistent<Person> mother, Persistent<Person> child) { assert father != null : "Who can make children without a father?"; assert mother != null : "Who can make children without a mother?"; assert child != null : "No child, no parent!"; this.father = new Father(father); this.mother = new Mother(mother); this.child = new Child(child); } protected Parentage() { } @Retying( { "father", "mother" }) public void adoptBy(Persistent<Person> newFather, Persistent<Person> newMother) { this.father = new Father(newFather); this.mother = new Mother(newMother); } @Retying("child") public void changeChild(Persistent<Person> child) { this.child = new Child(child); } public Child getChild() { return child; } public Mother getMother() { return mother; } public Father getFather() { return father; } } Links: * See http://tob.ableverse.org/benchmarks.html to get shock by extreme database performance! * See http://www.webofweb.net ( CDDL source code at http://wow.dev.java.net ) for TOB in action! * See the full artical for how easy it has been to write complex persistent applications! * Download a FREE version of TOB from http://www.ableverse.com/download-free.jsp * Learn TOB at http://www.ableverse.org/tutorials/index.html (Work In Progress) 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2006-11-23
有比较才知道好在哪里。
再美丽的闪电,最终都要亲吻大地。 作了实际点的示例出来吧,比如就拿springside里面的bookstore,看看你这个TOB是如何处理的。 |
|
返回顶楼 | |
发表时间:2006-11-23
partech 写道 有比较才知道好在哪里。
再美丽的闪电,最终都要亲吻大地。 作了实际点的示例出来吧,比如就拿springside里面的bookstore,看看你这个TOB是如何处理的。 现实世界的真正应用可以先看看 WoW http://wow.dev.java.net 我正在下载ss, bookstore回头搞一个 |
|
返回顶楼 | |
发表时间:2006-11-23
大概看了一下ss 的 bookstore, 很多功能好像还没实现呢.
持久数据模型单看还是很简单的, Category似乎是单层的, 好像一般都应该是树状的吧? Category的管理目前好像也没有做. 回头把TOB的相应模型写出来再说. |
|
返回顶楼 | |
发表时间:2006-11-24
|
|
返回顶楼 | |
发表时间:2006-11-24
complystill 写道 大概看了一下ss 的 bookstore, 很多功能好像还没实现呢.
持久数据模型单看还是很简单的, Category似乎是单层的, 好像一般都应该是树状的吧? Category的管理目前好像也没有做. 回头把TOB的相应模型写出来再说. 简单点,不妨事,领会精神。 |
|
返回顶楼 | |
发表时间:2006-11-24
partech 写道
Thomas 是你的帐户吗? 激活之前当然是登不上去, 现在可以了. 如果对MindMapping软件不了解, 可以看看 http://freemind.sf.net 的一些内容. 目前所有MindMapping软件基本都是桌面应用, WoW是Web版, 也有很多扩充, 比如即时消息, 节点硬链接, 权限控制, 类似Wiki的编辑历史 等等. |
|
返回顶楼 | |
发表时间:2006-11-24
用户名是ddddd,密码是什么? unchanged or [unchanged] 都登录不上 ddddd GpjJDENh 也不对
Hello ddddd, This email is sent to you by The Official WoW Site. Your account has been activated, now you are able to login The Official WoW Site with the following login ID(s) : (If your password is not shown here, you could check previous emails got from The Official WoW Site, or reset your password here) Login ID New(reset) Password ddddd [unchanged] And you can access your home node from this url: http://www.webofweb.net/traverse/Users/ddddd . Show yourself and start Instant Talking with peoples at The Official WoW Site! Yours, The Official WoW Site Hello ddddd, Thank you for registering with The Official WoW Site. You registration has been recorded and you are now in the waiting list for activation. You'll get informed as soon as your account was activated. You have the following login ID(s) at The Official WoW Site: Login ID New(reset) Password ddddd GpjJDENh And you can access your home node from this url: (but you will not be able to login and modify it until your account was activated) http://www.webofweb.net/traverse/Users/ddddd . Yours, The Official WoW Site |
|
返回顶楼 | |
发表时间:2006-11-24
I don't understand you, man. There's already a standard in the field, and more importantly it is much better than your way. You are playing a one player game under a private rule, while the rest of the players in the world are playing another game together, under a public rule, which is called STANDARD.
JDO works with POJO!! Don't you understand what that means? There's no, or at least low dependency, between the client application and the persistence layer. I really don't wanna bring up any argue with anybody, but I do feel sad when I see somebody walking down the wrong way. I have to say you are wasting your talent, your effort, your time! You may feel proud of it while the world won't buy it! I'm sorry! |
|
返回顶楼 | |
发表时间:2006-11-24
楼主,
tob没有文档,没有源代码,我只能揣测。 与o/rm+rdb的组合相比,tob+rdb组合的区别, 我这么理解对不对? 1。tob不需要我建表,它在后面自动替我建了。也就是说我只需领域建模,不需要数据建模,完全oo。 2。建立领域模型后,tob根据annotation运行时帮我生成class? 3。持久化是自动的,query是使用原生sql? 其它还有乱七八糟的很多疑问。 楼主有时间能写篇tutor最好,最起码把tob的那些annotation的含义说清楚。。 使用说明很重要。 楼主,我刚看到tob,很感兴趣。 |
|
返回顶楼 | |