How are field tables named? I am looking at my Drupal 7 database, and I think that I see the following pattern: 


Fields that are defined programmatically are stored in tables named field_data_fieldname
Fields that are defined via the UI are named field_data_field_fieldname.


I don't find this convention documented anywhere. Did I take it right?
Any field created with the core Field UI module has its name prefixed with field_.
Any field created programmatically is named exactly as the module creating it wishes, without the prefix.
The field data tables are named directly from the field names


Yes, you have it absolutely right.

It's worth noting that the data is also stored in field_revision_foo, regardless of whether you're using revisions or not. The field_data_foo tables will always contain the most up-to-date data whether revisions are enabled or not.