Further Steps with Derby: Derby Embedded in a Browser
Software is still hard to write because the present generation of programming languages has what might be called a low level of granularity (that is, coding still involves thinking at a low level of abstraction). In some respects, things have improved (for example, automatic garbage collection in languages such as Java and C# have obviated the need for destructor code), so you can instantiate objects without having to worry too much about the destruction phase. But on the other hand, you still have to do a lot of grunt work—handling files, opening network connections, interacting with databases, and so on.
All of the latter are hard to do and are error-prone, and in many ways distract programmers from the task at hand. Frameworks do attempt to abstract a lot of low-level details, but some frameworks are a bit top-heavy; others are hard to learn and some don’t even work properly.
Integrated Computing Environments
It’s when you join entities together during integration that the coding gets more difficult. For example, suppose that you want to display some database information in Java GUI. Sounds simple enough, right? Well, if you want to use the JTable component, you must present the data as an array of arrays of objects.
The latter is not the natural format of data retrieved from a relational database. So, when you want to logically join your database information in your GUI, you have a reasonably difficult coding problem on your hands. It’s not insuperable; it’s just a rather annoying problem associated with integrating different components.
All of this is an introduction to this article: how to embed Derby in a web browser. Why is this important? Well, integrating a database inside a browser is a big step in the direction of an integrated computing environment.
The only reason why you couldn’t host a database engine on a low horsepower desktop machine up to now was the scale of database products. Traditionally, complex database engines are hungry entities that require lots of disk space, RAM, and CPU cycles. My previous articles about Derby (see the "References" section at the end of the chapter) show that for low-end database applications, there is no longer a pressing need to spend big bucks. We’re now in an era of lightweight, low-footprint, powerful database engines. (Later on, I’ll briefly discuss the growing level of commitment to this area from organizations such as Sun Microsystems.)
The good news is that a database can now be integrated into a browser with relative ease (this is a good example of helping programmers and developers to move up the value chain [2]). Also, you can control the entire integration process without having to rely on a framework to do it for you.
Let’s look at why and how it’s done.