Is code written for NXT bricks compatible with EV3 brick (for Johnny 5 building)? My son is mad on the robot from Short Circuit (Johnny 5) and I want to build robots with him. We have a copy of Daniele Benedettelli's "Creating Cool Mindstorms NXT Robots" and I was planning to start with the simpler Johnny 5 build (miniJohnNXT) which is on the author's website. We only own simple Lego at the moment so I need to invest in a kit which has bricks, sensors etc. So I have a few questions. I've looked around the web but most questions focus on NXT/EV3 compatibility of hardware, not software.


Which kit should I buy given that we want to build the miniJohnNXT
(but will obviously also do other builds)? The NXT kit (8527,
currently about £170), the EV3 retail kit (31313, currently £218) or
the EV3 education kit (45544, currently £371)? I realise I'll have
to get extra parts whichever kit I get, but the brick seems the main
cost.
Will the code written for the NXT brick to control Johnny5 work on
the EV3 brick? (I assume so, but need to check)
Given that the "eyes" part of the robot is an ultrasonic sensor
(53792) in the NXT kit, and in the EV3 retail kit is an IR sensor
(95654), will this cause big problems with the coding, or can I just
modify it relatively easily (or put and ultrasonic sensor elsewhere
on the robot?).


My gut feeling is to get the EV3 retail kit as the EV3 brick is newer technology than NXT, so likely to be more forwardly compatible (I think we have years of Lego ahead of us) and the EV3 education kit seems really overpriced, but if the coding won't work except with NXT then I'll get an NXT kit instead.
I would advise the EV3 retail version. An NXT costs more than it should because it is getting difficult to find. You can buy additional motors and sensors separately in an official LEGO store or order them from the S@H website. The EV3 education kit cost more than it should because it's "educational". You will not need to modify the Johnny 5 build much to accommodate for the different motors sensor and intelligent brick.  
No, but you'll be able to view the NXT code in the new software and it shouldn't be to hard to reproduce the EV3 equivalent. The code blocks are similar.
There is a new ultrasonic sensor (45504) just for the EV3 brick. It's sold as part of the educational kit but you can also buy it separately (which is in my opinion more cost effective). I suppose you could also modify the code to work with the EV3 IR sensor, but range and precision are significantly poorer for distance sensing. However with the IR, you can set it up to track the IR beacon, or you could use it as a remote control.