We report the results of density functional theory calculations of several properties of wurtzite-structured InGaN and CdZnO alloys. It is shown that the investigated properties, including the internal parameter, bandgap, mechanical moduli, and electric polarization are nonlinear functions of alloy composition, as they deviate from the linear behavior predicted by Vegard’s law. Based on these results, InGaN and CdZnO are materials whose properties can be tuned via In and Cd concentrations. The spontaneous and piezoelectric polarizations considerably affect the properties of alloys-based devices due to the huge electric fields that build up at the heteroineterfaces. In this work we propose a method of controlling such fields by employing the composition dependence of the total polarization. We support this proposal by showing that, in the case of InGaN, an optimal alloy composition can be found that effectively reduces the polarization-induced electric fields, thereby improving the efficiency of optoelectronic applications.