Bad code is just plain bad. Eventually it will be exposed by way of program crashes, data inconsistancies, and resource usage. Your friend still should owe you for the project he requested if he ended up doing it himself or not.