Towards Learning Non-Spurious Function: From Representation to Decision Through Data and Model Design