Optical and Electronic Properties at the Nanoscale