Best control structure for task of aligning motor with sensor

Computers work for people, not the other way around. If it is easier for you to write and maintain 500 lines then the 1-line wonder is counterproductive. The difficult part is the maintenance. Understanding what you wrote a few weeks ago can be surprisingly difficult.

To make a big system work, you just apply the same principles you just learned. Keep everything in small modules that have defined functions. Just moving the mouse pointer on the screen is a difficult program to write but once it's done, everyone can use that module.