The unity uses a component-oriented or data-oriented design .What is the main difference between them?
So, with component oriented design i assume you mean the default Unity workflow, and with data-oriented design i assume you mean DOTS? The default Unity workflow is very easy to use and enough for 99% of games. It is however single threaded by default and large quantities of entities (hundreds of gameobjects running scripts and upwards) eventually make it crumble. DOTS is the exact opposite, basically. It has a steep learning curve, is harder to work with for most things, but easy to multi-thread and can handle tens of thousands of entities easily.
As for “where does the code go”… i mean… into scripts? That’s either a very shallow question, or a way too deep one to explain in detail. So i’m not sure what kind of answer you want on that