In the fifth book and film, Harry Potter and the Half-Blood Prince, Snape is tasked with a new job in addition to his responsibilities as Potions master when Hogwarts headmaster Albus Dumbledore (Michael Gambon) asks him to work alone with Harry. Per Dumbledore's instructions, Snape tries to teach Harry the art of Occlumency so that Voldemort can stop accessing Harry's unconscious mind; if you know anything about Snape and Harry's relationship, you can roughly guess how poorly this goes.
In the process, Snape accidentally accesses several of Harry's memories, including instances of abuse at the hands of his awful Muggle relatives... and Harry manages to see some of Snape's, which depict an equally unhappy childhood. Eventually, Harry discovers a hidden memory in Snape's office where James relentlessly bullies and abuses Snape, at which point Snape abruptly ends their Occlumency lessons.
However, this raises an important question: why wouldn't Snape show a little more understanding and mercy to Harry after seeing that they both had fairly miserable childhoods? Instead, based solely on James' behavior — which isn't Harry's fault — Snape simply abuses this young boy. Ultimately, this points to a larger, more concerning trend: Snape's unwillingness to emotionally connect or develop in any way.