One ActiveRecord Naming Convention To Take With Me
You can say what you want about the way ActiveRecord pluralizes table names. I for one, do not like it much! But hey, I could get used to it, so what the heck. But one naming convention I noticed that I have taken with me back into Java land, is the one about naming properties on the model, that have temporal datatypes, either _at or _on.
- If the property is to hold a date, but no time, name it xxx_on
- If the property is to hold a timestamp (a date + time), name it xxx_at
Of course, I do not use the ugly underscores, but simply CamelCase it
There is so much (Java) code out there, where you are unable to determine if a property is holding a date only or a full timestamp, simply by looking at the name. The model could use java.sql.Date for date only and java.sql.Timestamp for full timestamps. That way, you could determine it from the property datatype (something that is much harder in Rails land). But, I have previously advocated, that using the java.sql types on the model is a leakage of concerns, that should only be in the persistence layer (whatever that is, in these days).
By the way. I think Java land is doing great on stealing stuff from Rails these days. Projects like Grails is getting so many of its ideas from Rails, and I like that. It is everywhere. Suddenly, people in Java land started to implement Convention over Configuration. And then, there are the small things. Like when Tapestry got Rails’ flash persistence built into it.

