The quickest way to think of it is that the perfect tense is for actions that are done one time in the past and finished - ‘j’ai mangé la banane’ (implying that there was one banana and that you finished eating it) - whereas the imperfect tense has the sense that an action either went on for a longer period, or that it is something that happened repeatedly in the past. So, ‘l’année dernière j’allais à l’école en vélo’ - ‘last year I went to school by bike’ implies that you went by bike every day, or most days, rather than just one time. If you were doing something but something happened to interrupt it, you use the imperfect tense for the thing you were in the process of doing (‘process’ is a good word to associate with the imperfect tense), and the perfect tense for the thing that happened to interrupt - ‘je mangais use banane quand tu es entré’ - ‘I was eating a banana when you entered’. The imperfect tense is usually translated by ‘I was doing’ or ‘I used to do’ (‘je faisais), while the perfect tense is ‘I have done’ or ‘I did’ (‘j’ai fait’).