Q:

Naming variables in dynamically typed languages (such as Ruby)

Say I have a variable patients.  It could represent the number of patients (an Integer), a collection of patient objects (Patient class), an array of strings, or a hash. 
Sometimes I need a simple count, but number_of_patients seems too wordy.   patients_number is ambiguous because it could represent a patient's ID or the number of patients.  Substituting count for number is a little better, but doesn't always fit the context. 
This problem is worse in Rails because of the convention of using plurals for collections.  It feels wrong to use a plural noun to represent an Integer.  The problem extends from the view to the model, because models often need attributes to count things, plus they may have associated collections (e.g. a report has documents representing Document objects, a field called diseases representing an Array, and a field called evaluated representing an Integer). 
Are there any conventions for handling these cases? 

A:

I'd use patients_count because that's what ActiveRecord uses when :counter_cache => true is given to belongs_to, for example:
class Patient
  belongs_to :hospital, :counter_cache => true
end

would try to increment hospital.patients_count every time an associated Patient was added to the Hospital. ( Rails API docs)

