Friday, August 31, 2007

Book Review: Database Design

Database Design
Ryan K. Stephens and Ronald R. Plew
Sams Publishing 2001

submitted to Amazon.com 8/31/2007

Recently, I worked with a few developers who were tasked with developing their own database, and soon realized that many developers are not disciplined database designers (myself included). Instead of struggling through ambiguous database designs and creating more work in the coding of business objects, I picked up a book. Database Design, by Ryan K. Stephens and Ronald R. Plew, provided a great foundation for me, and would probably be a good reference for many levels of developers, business analysts, and DBAs.

The book starts with an overview of the database design process. At times this section seemed basic for someone that has been through countless development cycles, but the section reiterates concepts that many may take for granted. For instance, the database design process of requirements gathering, logical modeling, and normalization is discussed. Also, from an academic perspective some history and non-traditional methods are reviewed that provide interesting contrasts to how the process of database design has evolved over time.

The second section begins to get into the technical meat. The second section discusses gathering business and system requirements. This also provides many good examples of how to translate the business model into database entities. The different forms of normalization are discussed with examples from the first, second, third, Boyce-Codd, fourth, and fifth normal forms. The authors also take the readers through the process of developing Entity Relationship Diagrams (ERDs) and uses accompanying examples.

The third section takes the concepts that are used from part two to design tables within the database. Consideration of storage, referential integrity, ownership, performance is all discussed as part of the physical design process. The authors also discuss enforcing business rules and view designs as well. The final chapter of this section ends in a real world scenario of a grocery store owner that wants to model his business activities into a live database. The book provides step by step re-iteration of the process involved in collecting business requirements, modeling data, normalization, and design. The author walks the reader through the process and shows how a designer would create a database from the information provided by the business owner. I thought this was a great example of how the books brought together concepts into real world situations. Kudos for the authors including some non-academic material.

Last, the authors discuss other areas that affect the database after the initial design. These areas include security, change control, analyzing legacy data. Each area includes examples and scenarios a DBA might encounter.

Overall, I thought this book laid down the foundations for database design very well. I think the authors had some very specific real world experiences that seemed useful during the discussions of the design process. The only con of this book was brief discussions about toolsets being used. It seemed apparent after a few of these examples that the authors are used to working in high budget software shops. Also, some of the tools may have been a bit outdated (2001). No mention of open source options was given which was a bit disappointing for someone who uses and develops open source products regularly (yes I am biased). The cons however, seemed minor in the big picture. This book lays down the framework for good process and also is very practical in its examples of the nuts and bolts of the database design process. I will definitely keep this somewhere close on my shelf, and do not expect the design aspects of the book to become outdated anytime soon. I think the authors did a great job at providing a good reference book on database design. I only wish more developers would read it :)

Friday, August 17, 2007

Portable Wikipedia

I thought this article was a bit innovative. It appeared on Slashdot the other day and described how to create a portable search engine from the Wikipedia mysql dump file. I have to admit that I'm not quite sure of the necessity of this, but the process this person used to design his system with garden variety open source tools was clever.

Turbo-charging JVM startup times

Startup time on JVMs especially when running standalone classes, JFrames, etc on a client has always been a bit slow. In many cases the JVM is often run multiple times asynchronously. Enter class data sharing.

JDK 5+ for the Java HotSpot client VM has included a feature that loads a series of startup classes in a common shared location. This is good, so that when the JVM starts up it no longer needs to load common classes because they are shared in memory. The more core classes being used, the more time is saved on startup. Woohoo!

See a more detailed description here...

Friday, August 10, 2007

Handling multi-part form data without pain

Apache commons uploader has some nice built-in frameworks to handle multi-part form data. In this example part of the form data are file uploads and other parts are form fields. As you will see Apache commons uploader makes this task extremely easy...

        // Check that we have a file upload request
boolean isMultipart = ServletFileUpload.isMultipartContent(request);

if (!isMultipart) return ;

// Apache commons upload section
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);

// Parse the request
List items = new ArrayList() ;
try {
items = upload.parseRequest(request);
} catch (FileUploadException fue) {
LOGGER.error("Error uploading file: " + fue.toString());
}

// Process the uploaded items
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();

if (!item.isFormField()) {
// **************************************************
// Process your file input here! *****
// **************************************************
} else {
String name = item.getFieldName();
String value = item.getString();

// **************************************************
// Process your name and value pairs here! *****
// **************************************************

LOGGER.debug("Found field " + name + " and value " + value) ;
}
}

Friday, August 3, 2007

Adding Multiple Files for Upload

Here's a nice little Javascript that allows multiple file uploads in a fashion similar to Google's gmail attachments.

http://www.petefreitag.com/item/587.cfm

Thanks to Pete Freitag for this nice little piece of work.