Ahhh... But let's not forget who we're talking about.
Montgomery Scott, engineer extraordinaire.
When something needs to be fixed, Scotty unfailingly figures out the fix in record time. I mean, he'll lie to you about how much time he needs first (to make himself look like a miracle worker) but he'll also figure it out quicker than anyone else.
Even Georgie LaForge would take an agonizingly long time to figure out how to couple a tachyon emitter to the main deflector dish to try to reverse the polarity of the phase shift anomaly. In that amount of time, Scotty would have been able to reroute power from the phaser emitters through the port nacelle to give a crippled Constitution-class vessel better than 3/4 impulse after the dilithium reserves are depleted. It willna be pretty, Captain, but it should git ye where ye need t'go. He kin do it in an hour, but since ye need it in fifteen, he'll do it fer ye in ten.
Could his nephew Peter Preston have done that? No. I mean, obviously we'll never know, as Khan killed him, but Preston was more the loyal and dutiful engineer than the whiz-bang engineer like his uncle.
So figuring out how to code at the level of a Stanford graduate circa 1986 should present no significant problems.