Tuesday, November 25, 2003
Why Data Models Shouldn't Drive Object Models (And Vice Versa)
Bringing data professionals and application developers together.
by Scott W. Ambler, Copyright 2003
This essay is taken from Chapter 3 of Agile Database Techniques.
A common problem that I run into again and again is the idea that a data model should drive the development of your objects. This idea comes in two flavors: your physical data schema should drive the development of your objects and that a conceptual/logical data model should be (almost) completely developed up front before you begin to design your objects. Both of these views are inappropriate for non-agile projects and clearly wrong for agile projects. Let’s explore this issue in more depth.
Why do people want to base their object models on existing data schemas? First, there is very likely a desire to reuse the existing thinking that went behind the current schema. I’m a firm believer in reusing things, but I prefer to reuse the right things. There is an impedance mismatch between the object and relational paradigms, and this mismatch leads object and data practitioners to different designs. You also saw in Object Orientation 101 that object developers apply different design techniques and concepts than the techniques and concepts described in Data Modeling 101 that data modelers apply. Second, the database owner seeks to maintain or even enhance their political standing within your organization by forcing you to base your application on their existing design. Third, the people asking you to take this approach may not understand the implications of this decision, or that there are better ways to proceed.
Object Relational Mapping Tools
There is a large and growing number of projects that map relational databases into object models. This paper provides a basic review of each of the projects of which the author is aware. It is hoped that the it will prove useful to anyone that is trying to select such a tool.
The key contribution of this work is to discuss the core technical problems that need to be solved, and then classify the tools according to how they attempt to solve these problems. It is therefor focussed on the general design of each tool rather than specific performance or reliability issues.
Due to the large number of ORM tools most of these reviews are based on reading product documentation rather than direct experience using each tool. The reader should also note that the author is developing the www.SimpleORM.org tool and so has a natural bias towards its approach. However, the classification of approaches and general list of the tools should be helpful to anyone trying to select an Object Relational Mapping tool.
Implementing The Persistence Layer
6. Implementing The Persistence Layer
There are several issues that you need to be aware of with persistence layers if you wish to be successful.
These issues are:
· Buying versus building the persistence layer
· Concurrency, objects, and row locking
· Development language issues
· A potential development schedule
6.1 Buy Versus Build
Although this white paper is aimed at people who are building a persistence layer, the fact is that building and maintaining a persistence layer is a complex task. My advice is that you shouldn’t start the development of a persistence layer it if you can’t finish through. This includes the maintenance and support of the persistence layer once it is in place.
If you decide that you either can’t or don’t want to build a persistence layer then you should consider purchasing once. In my third book, Process Patterns (Ambler, 1998b), I go into detail about the concept of a feasibility study, which looks at the economic, technical, and operational feasibility of something. The basic idea is that your persistence layer should pay for itself, should be possible to build/buy, and should be possible to be supported and maintained over time (as indicated previously).
A feasibility study should look at the economic, technical, and operational feasibility of building/buying a persistence layer.
The good news is that there are a lot of good persistence products available on the market, and I have provided links to some of them at http://www.ambysoft.com/persistenceLayer.html to provide an initial basis for your search. Also, I have started, at least at a high level, a list of requirements for you in this document for your persistence layer. The first thing that you need to do is flesh them out and then prioritize them for your specific situation.
Hibernate in Action: "Hibernate in Action: Practical Object/Relational Mapping
Christian Bauer and Gavin King
April 2004, Softbound, 400 pages
Our price: $44.95
You can order this book from your bookstore
by using the ISBN and title listed above.
Hibernate in Action is both an introduction to the theoretical aspects of automated object/relational mapping and a practical guide to the use of Hibernate. The extensive example code implements an online auction application.
The book is divided into two parts. Part I discusses object persistence, the object/relational mismatch problem and emphasizes the importance of Plain Old Java Objects. It introduces Hibernate and explains the basic theoretical foundations of object/relational mapping.
Part II is dedicated to demonstrating more advanced ORM concepts and techniques, with practical examples using Hibernate. The impact of ORM upon application architecture and development processes is explored along with techniques for achieving high performance. Hibernate's developer toolset is demonstrated and best practices are recommended.
Writing your own mapping layer
It can be very tempting to write your own object-relational mapping. If fact, there are books and articles advocating this. The bottom line, however, is that unless you have a very simple mapping, it is a bad idea to write your own mapping layer.
I have talked with plenty of developers who tried writing a mapping layer. The result, although anecdotal, is universal. The mapping code, in each case, grew to be 30 to 40 percent of the code needed for the entire application. There are two problems that resulted from this. The first is that this is a lot of effort towards writing code that is not addressing the business problem that prompted the application development in the first place. The second is that, given the development models that show how code defects rise with total code, a significant number of additional defects appeared which, again, are not directly related to the business problem being addressed by the application development.
So, if you have a relational database and you want to use C++ or Java, by all means use an object-relational product. Writing a mapping layer is much harder than you might expect. Some of the reasons this is hard can be seen in the considerations for mapping:
For object-to-table mapping, see mapping objects to tables.
For table-to-object mapping, see mapping tables to objects.
Thursday, November 13, 2003
Javalobby Forums - IBM VM (WebSphere)
Re: IBM VM (WebSphere) Posted: Nov 7, 2003 8:51 AM
IBM has had one for some time, but they do not make it easy for you to get it. I found my copy in an installation of the latest version of Websphere MQ. You should be able to download it for free. Look in the install directory and you should find JDK 1.4x. This is the version info I'm showing. There may be a newer version now.
java version '1.4.0'
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0)
Classic VM (build 1.4.0, J2RE 1.4.0 IBM Windows 32 build cn140-20020902 (JIT enabled: jitc))
It obviously depends on your scenario, but for me I found the JRE to be comparable to the performance of SUN's 1.4x VM, and marginally slower than IBM's 1.3 VM.
Friday, November 07, 2003
Home - Enterprise Integration Patterns
Patterns and Best Practices for Enterprise Integration
This site is dedicated to making the design and implementation of integration solutions easier. Most solutions and approaches describe here are valid for most integration tools and standards such as IBM WebSphere MQ, TIBCO, Vitria, SeeBeyond, JMS, Microsoft Messaging, MSMQ, Web Services etc.
This site is maintained by Gregor Hohpe. I lead the Enterprise Integration practice for ThoughtWorks, an application development and systems integration firm. I hope you find this material useful. Feel free to contact me with suggestions or feedback. Also, my company happens to be pretty good at helping clients build integration solutions, so don't hesitate to contact me if you are interested in our services.
Thursday, November 06, 2003
POPFile - Automatic Email Classification
Excerpt from Software Development Newsletter:
Bayesian analysis is a relatively new technique for fighting spam. It also happens to be useful for classifying mail in general. To get Bayesian analysis to work, you must first train the system by classifying some messages on your own. After a while, the system gathers enough data about how you classify messages that it can essentially work untouched. Of course, the more you train it, the better it gets. This is why PopFile provides a simple, Web-based user interface that allows you to classify and reclassify messages whenever you want.
Like most software based on Bayesian analysis, PopFile isn't perfect -- it does misclassify messages from time to time. But it gets better over time as you train it on more messages. For the first week, during the "training period," I found myself using the interface a few times a day to reclassify messages. Now I go into the interface maybe once a week. It's a minor hassle, but the time I save overall is well worth it. If you, too, are tired of being managed by your inbox, PopFile just might be the answer.
Wednesday, November 05, 2003
Software Modeling on Whiteboards
by Scott W. Ambler, Copyright 2003
Whiteboards are my favorite modeling tool, and I stand by my claim that they are the modeling tool with the greatest install base worldwide. In fact throughout this web site you will see many whiteboard sketches, which is nice for an online article or even a book but can are they acceptable for real-world development? My experience is yes. Here’s how I make it work for me.