A method for designing and/or optimizing an implant that has one or more through holes with a central axis for receiving a bone fixation element. The method includes: providing a general collection of three-dimensional bone quality data obtained from a patient population identifying in the patient population N>2 categories of patients with significantly different N>2 homologous sub-collections of bone quality data and designing an implant or optimizing an existing implant for each of the N>2 sub-collections such that the at least one through hole is located at an optimal place and with an optimal direction of the central axis relative to the implant. The optimal position and direction is chosen based on each of the N>2 sub-collections of data so as to obtain an optimal anchorage of the bone fixation element in the bone when introduced through the through hole.