You should get the best letters from those who meet most (or all) of the above criteria.
Also, be sure that you give your letter-writers plenty of time before your deadline (e.g., three to four weeks).
And, give your letter-writers an organized packet of materials (e.g., pre-addressed and stamped envelopes, all necessary forms to be completed, any specific instructions that need to be made clear, obvious deadlines for each letter to be written, etc.).
The more you do (in school and out), the more your letter-writers can write about, AND the more impressively you will come across.
You WILL NOT get strong letters if you do any/all of the following:Generally, it is a good idea to get to know your professors. This allows them to get to know you.