So I've been hacking away happily with Catalyst on my VegGuide.Org 3.0 project for quite some time, and I'm still liking Catalyst, which is a good thing
When I first started this project, I also looked at Jifty. It looked neat, but
Jifty, like Rails, is opinionated software. It has opinions about what ORM you should use, as well as what templating system you should use. It's ORM has opinions about your schema design, much like Rails (ugh, id is the worst column name evah!).
There's nothing wrong with opinionated software. I'm certainly opinionated myself. The problem with opinionated software is that it's really only appropriate for writing an app from scratch.
The main focus of my VegGuide 3.0 project is to completely revamp the UI of the site, and improve the user experience. I'm also aiming to make the system as RESTful as possible. Along the way, I'm slipping in some features like Google Maps integration, but mostly it's about UI & REST.
The existing VegGuide code uses Alzabo as its ORM. I like Alzabo, since it mostly does exactly what I want, though I'm not sure I'd recommend it to others for new projects these days. Nonetheless, I don't want to switch to another ORM as part of this project.
All this gets back to the opinionated software thing. I could've tried to integrate my Alzabo-using classes with Jifty, but it would've been a huge (perhaps monumental) amount of work. Catalyst, OTOH, has very few expectations. In fact, the core Catalyst code has no expectations of a model, you don't even have to have one!
This has made revamping the controller and view (UI) pieces of my app much easier, because I can reuse my existing model code without any changes to accomodate my framework. In a few cases, I've had to make some custom bridge code to make plugins (Session, Authz, etc) work with my model, but this has really been trivial to implement.
With Catalyst, you can convert an existing app to Catalyst without rewriting every aspect of the app in one fell swoop. That is a huge plus for Catalyst in my mind, since 100% rewrites are rarely possible. This may in fact be the number one selling point of Catalyst. Better code for old apps!
"id" fields (Score:2)
Why do you say that "id" is the worst column name ever? While I know that some people have issues with surrogate keys, I find them to be very useful so long as people understand that the removal of surrogate keys should still leave sets of records instead of bags (of course, this also means that people should understand that "real" primary keys are not the same as surrogates, but the latter frequently makes working with our current crop of non-relational databases much easier).
That being said, I know you
Re: (Score:1)
Re: (Score:2)
The problem with naming your primary key "id" is twofold. One, when you want to refer to that key in another table, you have to use a different name. For example, you might have User.id in one table and Mes
Re: (Score:2)
I completely agree that every id should be a different type and thus not comparable, but if you have SQL using two tables with id fields, you have to fully qualify them if you reference them or else the ambiguity is a compile-time error. As a result, you can at least see that comparing customers.id and orders.id doesn't make sense.
The type problem, of course, is more serious than this. Someone not being careful might not notice that customer.age should not be comparable to customer.weight, but in the ca
Re: (Score:2)
Customertablecustomer_id. It's not really the case that you alyays have the table name in front of the column name, and I like the clarity. Similarly, if I have a customer object I'd rather type$customer->customer_id()than$customer->id(). Again, it distinguishes it from other types of ids that the table (or object) may have, and this way the column names are always the same, so theOrderandCustomertables both have acustomer_idcolumn.As far as ty
Re:`id` fields (Score:1)
That argument doesn’t really hold up, though. No matter how you turn it, renaming tables is a maintenance nightmare anyway: you will already have to rename all the FKs to the table that’s being renamed.
Re:`id` fields (Score:1)
Personally I tend to use
idfor the surrogate key and then$adjective$tablefor foreign key columns. So in your case I’d haveuser.idfor the PK andmessage.authoruserfor the FK. I pretty much stumbled onto this scheme by accident, but it has stuck since – I found that having a uniform way of expressing not only the existence of a relatioWoops (Score:1)
Please disregard this comment, there was a markup error in it that I didn’t spot in the preview.
Re:`id` fields (Score:1)
Personally I tend to use
idfor the surrogate key and then$adjective_$tablefor foreign key columns. So in your case I’d haveuser.idfor the PK andmessage.author_userfor the FK. I pretty much stumbled onto this scheme by accident, but it has stuck since – I found that having a uniform way of expressing not only the existence of a relatApple and Oranges (Score:1)
Re: (Score:2)
Re: (Score:1)
Re: (Score:2)
Re: (Score:1)
I can't argue with that... : )