97 Things Every Programmer Should Know

(Chris Devlin) #1

Collective Wisdom from the Experts 97


Another advantage of basing your code around an RDBMS involves the han-
dling of relationships between your data elements. You can describe consis-
tency constraints on your data in a declarative way, avoiding the risk of the
dangling pointers you get if you forget to update your data in an edge case. For
example, you can specify that if a user is deleted, then the messages sent by that
user should be removed as well.


You can also create efficient links between the entities stored in the database
any time you want, simply by creating an index. There is no need to perform
expensive and extensive refactorings of class fields. In addition, coding around
a database allows multiple applications to access your data in a safe way. This
makes it easy to upgrade your application for concurrent use and also to code
each part of your application using the most appropriate language and platform.
For instance, you could write the XML backend of a web-based application in
Java, some auditing scripts in Ruby, and a visualization interface in Processing.*


Finally, keep in mind that the RDBMS will sweat hard to optimize your SQL
commands, allowing you to concentrate on your application’s functional-
ity rather than on algorithmic tuning. Advanced database systems will even
take advantage of multicore processors behind your back. And, as technology
improves, so will your application’s performance.


*ttp://www.processing.org/ h

Free download pdf