All three of these indicate actions which occured in the past, but vary depending on duration.
The perfect tense ( he hecho) is used for past events which have just happened and are relevant to the speaker in the present.
The imperfect tense (hablaba/comia/dormia) is used for past events which were repeated and are relevant to the speaker in the present.
The preterite tense is used for past events which occured in a closed time period, these can be single events, or repeated over time BUT the duration must be clearly defined and cannot continue into the present.