Should I include code in my research paper?
Depends on the field and journal - check other papers in the same journal on how they do it. In my field (Bioinformatics) we usually do not put code into the paper but provide the full source code via the department web-page and/or git.