After teaching in Zurich for some years, John became music master and violin teacher at Harrow in 1862, reportedly appointed as a result of being noticed while giving piano demonstrations at the London International Exhibition. During his time at Harrow, he introduced 'house-singing' (still part of a new boy's 'initiation' into the school community) and composed many school songs and other larger vocal works for the education and enjoyment of students and staff. He encouraged the participation of the boys in massed singing for school events and the serious study of instrumental music. This was during a period when the inclusion of music within public school education in England was in its infancy and its acceptance was often resisted by school boards and principals. Affectionately known as "Sweaty John", Farmer also introduced the smoking concert, or "Tobacco Parliament", that was held on Founder's Day, where school songs and musical contributions were welcomed from staff, boys and friends, with Farmer's items particularly memorable - he was remembered as a "capital entertainer" according to John Ivimey. His songs continue to be published in modern editions of the "Harrow School Songs" book. The school song, “Forty Years On”, was written in 1872 with fellow teacher Edward Ernest Bowen as lyricist. He also composed cricketing ditties like "Willow the King," one of the most famous of all cricketing songs. His opera, "Cinderella" was performed at Harrow in 1883.