Four ways you can avoid a conviction.
Firstly the allegation against you may fall within the criteria for the Police issuing you a written warning. Secondly you may be charged with an offence but offered diversion. That is a police process where if you plead guilty and make amends the Prosecution will withdraw the charge against you. Thirdly you can apply to the Court for a discharge without conviction. This can be imposed if the consequences of the offending outweigh the seriousness of the offence. And fourthly there is the old fashioned way where you plead not guilty at trial and secure an acquittal. This results when the case against you is not proven beyond reasonable doubt.