Code Reuse


I just added a guestbook to my site. Please feel free to sign it. If you goto my homepage you'll see a link there for signing and for viewing my guestbook. If you take a look above these links you'll see a link to my timeshare website. These are basically the same web page, from a web designer's perspective.

The timeshare website is basically a form (the home page for the timeshare website) where prospective timeshare sellers enter information about themselves so I could contact them and tell them what we (the timeshare resales company) could and couldn't do for them. The guestbook is also a form where people (just me so far) enter information about themselves. The same underlying code works for both web pages.

I did make three changes in the form I was using for the timeshare site to make it a good guestbook form. (1) I removed the "optin" checkbox - I'm not offering any optin services for people who sign my guestbook, (2) I put in a comments textarea where the checkbox used to be (so I couldv'e said I only made two changes - replaced the checkbox with a textarea, but this was really two tasks for me) so my guests could tell me why they visited my site, what they like about it (nothing to dislike, right?), etc., (3) I changed the background picture - the Disney World picture is perfect for a timeshare site but not for a guestbook. That's three changes, but I'd like to point out that it required just a few minutes of work; the advantage of code reuse.

Server side I tried to make no changes at all; this didn't work. My server script (I wrote it in Perl) makes an ODBC connection to a MS Access database and starts collecting row data using a SQL technique called "cursors"; I got a blank page. Since the only change to my database was the addition of a "Memo" field for the comments, I figured that was the problem. After searching the Internet for about 5 minutes I found out that Memo fields caused a problem with Perl searches because it is "Blob" data, so handling it like a normal text field doesn't work. I defined a large character array as the buffer to read my database table rows into, and voila, my data displayed. Once again, this took up very little time because of code reuse.

The only time consumer for creating the guestbook was getting the links to appear nicely; i.e., they look OK to me and they display a nice mouseover message (check out my homepage - all my links display a mouseover message, except my password protected link), and they do so in MS IE and Firefox (which means they should do so in other Browsers based on Netscape Navigator, too). BTW, this web page is a reuse of my "Looking For Work On The Internet" page; just the text is changed.

Return To My Blog Page Return To My Programming Page