I'm working on a programming book, which will be distributed both electronically and (potentially) in print. It includes many coding samples, which readers may wish to use. To avoid the hairy, and usually-ignored issue of whether readers can use snippets of my code in their own works, I would like to release the code (but not the text of the book) as open-source--probably with the MIT license.
What is the best way to do this? I see a couple of options:
I can mention on the copyright page that the code samples are released under the MIT license, then include the MIT licence in the appendix.
I can mention that the code is available for download elsewhere, and provide a link. That link could include the MIT license and appropriate notices.
Something else?
In case it's unclear, I'm not seeking legal advice, only for practical advice on how to best express a software license in an otherwise non-software work.