Novelist reveals how teaching in Brooklyn has shaped his work