We present a new method for determining the age and relative contribution of different stellar populations in galaxies based on the genetic algorithm. We apply this method to the barred spiral galaxy NGC 3384, using CCD images in U, B, V, R and I bands. This analysis indicates that the galaxy NGC 3384 is mainly inhabited by old stellar population (age >109 yr). Some problems were encountered when numerical simulations are used for determining the contribution of different stellar populations in the integrated color of a galaxy. The results show that the proposed genetic algorithm can search efficiently through the very large space of the possible ages.