Wait… what’s “proper” code? If it works it works, even if made of spaghetti 😅
Discussion
For the unlikely chance you actually want to know:
Glenford Myers - Reliable Software Through Composite Design
https://d.nostr.build/Opr3DxwoWKULhMs7.pdf
Also Clean Code and The Pragmatic Programmer.