The DX is good for that. There's enough space that you can see sample code without horrible wrapping, without using a tiny type size.
Also, unlike the iPad, if you get the kindle you can read your kindle books on a desktop computer using the appropriate kindle app.
Tip: If you're reading PDFs on a kindle, it can be useful to open them and crop out the margins. Preview.app on OS X will do it.