First off, I would like to touch base upon the mention of the Question's Comments
Are you trying to produce good programmers or good theoreticians? Making one ruins the other. ~Kevin Krumwiede
As an avid Programmer and Theoretician (both in my spare time), I can clearly state, that, with my Logical Mind, it is very difficult to grasp at new theories without first ripping them apart and reconstructing them myself, figuring out WHY they work, HOW they work, and WHAT is broken that requires the modification of my Mathematical Formula which I've Constructed and Applied to the Simulation. It makes things very difficult to explain to me, because I simply can not for the life of me figure out why it is broken.
As far as a way to explain Theoretical Application to Coding, perhaps it might be easiest to go Old School on them using Variable Arrays
and ForEach Loops
.
If you have 500 Items to Sort through, and pair up, you could do it Logically, writing out a single line of Code for each and every available option, but if I'm not mistaken, that would be 500 to the 500th power number of lines of code.
It's not Impossible, by a long shot, but is takes much longer than explicitly stating the 500 items within a few simple Groups, and running a ForEach Loop
on the Array you have created, which if my estimates aren't too far off, might be around 2,500 lines of code depending upon the Grouping layout.
The sheer workload difference might jog them out of their lack of interest, but your real challenge is yet to come, You will also want to provide some type of applicable example to keep their attention.
If they are Logical like I am, they will have one major Deal Breaker for whether or not they should actually attempt to learn it, it is simple in practice, very optimal in application, and created for efficiency of Brainpower (as ironic as that might sound to you, I'll get back to that in a sec):
How can I use this to improve my Build?
Try asking them for an example of what they are working on in their spare time, see if you can get the Class involved in improving their Program, similar to what everyone does here on StackOverflow, or to put it into more familiar terms: Brainstorm and Think Tank their Projects in order to display Practical Application of the Theories, they will absorb it like a Sponge once they find out it is useful to their interests.
Back to the Brainpower Optimization comment, I realize you find it odd that their lack of interest in such things would be a Mechanism to actually improve Brain Performance, but if you pay really close attention, you might notice that some of the more optimized students seem to be more forgetful, absentminded, or simply focus on whatever interests them (sound familiar?).
There have been a few studies done on this subject already, I forget if the Larger Scale Studies are already ongoing or if they are still gathering Funding, but initial results have shown extremely promising results, along with studies of behaviors of some of the most notable scientific minds in our distant past.
Einstein for example was noted as stating that he never Memorized how to get Home from Work, he never saw the need for it as someone would always Drive him Home, so why would he need to learn their Job? The Logic behind why is that he had better things to think about, such as his work, which we've come to reference long after he has died. The Theory behind the Logic is that he had more Brain available to apply to his Active field, because he didn't fill it up with things he never used, such as the path Home, that is what the Study is trying to figure out specifically.
If I have anything that needs Editing/Correcting in this Answer, let me know in the Comments and I'll edit accordingly should you not feel up for suggesting the Edit yourself.