The long Thanksgiving weekend was a good opportunity to make some progress with my comics database web application. I was actually surprised how easy it was to get something more or less fully functional running in a few hours spread across the weekend.
I ultimately decided to just go with CakePHP. For the reasons listed before, it ended up making to most sense based on what I’ve already had experienced with and what seemed to be installed by default with my ISP. I just followed the Cake Blog Tutorial, recasting blog postings into comic book titles with the appropriate field changes. Some retyping of code and minor editing of values and voila! a complete web application was born.
As I explained previously, my comic database has been more or less unchanged for the past two decades. While I introduced some relational aspects in the last few years by tracking individual issues (sometimes) along with the titles, my main use has been just to catalog issue numbers. To support my comic logging activities, I just need the following features:
- add, edit & delete a comic title
- browse all the comic titles
- browse only the “active” titles, those that I’m currently most interested in
- search for a specific title, generally based on the comic title’s name
Since I routinely see people at conventions doing similar activities with hand written lists or printouts, there isn’t much more that’s need. Of course in the future I’ll get fancy with issue specific data and tweak the interface with AJAX features or optimized for mobile device viewing, but that’s for another time.
Such a simple requirements meant my schema could be pretty simple:
title VARCHAR(128) UNIQUE,
There are of course other columns for tracking and maintenance of titles, but this gives the basic idea of a comic title’s structure. With a table based on this schema added to a little MySQL database, it was relatively painless to stitch together basic CRUD operations using CakePHP’s MVC approach and sample code. Afterwards, I easily added in some other functionality like a dedicated link that filtered out everything except comics marked as active. Getting more daring with my increasing confidence, I dropped in pagination support and even filter functionality. I thought I’d be slogging through data dumps to the browser and looking at SQL queries executed throughout the weekend but, given it was so trivial, it more or less worked without much debugging. I had a few problems because I didn’t read method and function documentation and didn’t realize from the error message that some calls were expecting an array but just receiving a single object. Easily corrected with a quick print_r call.
All in all it really was as easy as cake. Next on my agenda is to tweak the UI and perform some more serious testing with larger data sets.