It might cop out by going too sentimental in the end, but for the most part “Eighth Grade,” while not eschewing empathy in its earlier stages, seems such an accurate depiction of life in a contemporary middle school that it will make you cringe—as well as laugh. The brainchild of Bo Burnham, who posted a few comic songs on YouTube when only sixteen and has evolved in the intervening twelve years into a recording artist, stand-up comic and actor, the movie could be described as a John Hughes tale of adolescent angst updated to reflect the culture of Generation Z (or iGeneration, or Centennials—whatever you want to call post-millennials). And though Burnham himself is a millennial, he seems to understand those younger than he—at least to the extent this baby boomer can see.

Burnham’s heroine is Kayla (Elsie Fisher, who provided the voice of Agnes in the “Despicable Me” franchise), a thirteen-year old living with her single dad Mark (Josh Hamilton). Shy and displeased with her appearance, she’s not so much ostracized as ignored at school, though her fellow graduating students do vote her “most quiet.”

Like so many girls her age have always been, she swoons over class jock Aiden (Luke Prael), a cool-looking jerk, but never approaches him. (Burnham follows pattern by going slo-mo as he preens.) She’s especially conscious of being treated like a non-person by class princess Kennedy (Catherine Oliviere). Kennedy is irritated when her mother (Missy Yager), who seems interested in Mark, insists she invite Kayla to her pool birthday party. Kayla doesn’t want to go, but Mark insists, and there she’ll meet endearing geek Gabe (Jake Ryan), Kennedy’s cousin, who might once have been played by Anthony Michael Hall, and whose interest in her she initially rejects.

Kayla’s relationship with Mark is best described as tense. She doesn’t want conversation with him, and is embarrassed by his attention. She’s devoted—like Kennedy and her other classmates—to her smart phone, to which she seems closer than anything or anyone else. She posts little videos on YouTube in which, like a mini Ann Landers, she offers advice to her peers on the importance of being yourself and being confident, and how to put yourself out there for other people to get to know. Her viewership is negligible, of course, and she struggles to follow her own advice, with awkward results.

There does come an opening for Kayla to spread her wings when, during a class project in which she shadows a high school student to prepare her for the next step up the educational and social ladder, she’s befriended by her “mentor” Olivia (Emily Robinson), and even goes on an outing to the mall with the older girl and her pals Riley (Daniel Zolghadri), Trevor (Fred Hechinger) and Aniyah (Imani Lewis). One wonders whether such a mall clique isn’t a bit passé in 2018, but in any event things don’t go all that well. The conversation is absurdly pretentious, especially when Trevor argues that Kayla is living in a “whole different world” because of changes in technology over a mere four years, and she’s at a loss about how to respond. But things are made even worse by some helicopter parenting, and by an effort by Riley, who drives her home, to put the moves on her. (This boy could get into serious trouble, fast.)

But Burnham doesn’t want to go the melodramatic route. Having thus far skirted with edgy humiliation (Kennedy’s upturned nose over Kayla’s birthday gift and an embarrassing attempt at karaoke), he follows the Hughes formula by choosing to go with a more hopeful turn in the last act. That can be seen in Kayla’s greater assertiveness rather than living online, in her making a new personal “time capsule” to replace the glitter-covered one she prepared a few years earlier, in her warming to Mark’s attention, and even a first “date.”

Still, the last-act turn isn’t fatal to the incisive portrait Burnham has drawn of a generation who are often so obsessed with their “devices” that they pretty much cut themselves off from real contact with other people. Even Kayla, played with a remarkable degree of nuance by young Fisher, is treated with clarity as well as affection: she’s as self-absorbed as most teens seem to be nowadays, as devoted to her self-image as any narcissist, and as intent on air-brushing that portrait to the outside world as anybody. That makes her tentative move from the virtual universe to the real one gratifying, even if to some it might take the story into a rather unreal mode.

Burnham is equally successful in eliciting nice turns from his other young performers, although he encourages Ryan to take the nerdiness to extremes. Hamilton is sweetly supportive as the clueless dad, but among the other adults one might single out Greg Crowe, whose evocation of the middle school principal trying desperately to connect with his students might get lost in the shuffle. The scene in which he walks his charges into the high school for their “shadowing” exercise is priceless.

Nicely produced for a small film (the production design by Sam Lisenco and costumes by Mitchell Travers are unostentatiously right, with the cinematography by Andrew Wehde and editing by Jennifer Lilly unfussy and straightforward), the picture is visually appealing without becoming glaring, even in the scenes set in Kayla’s wildly decorated bedroom.

“Eighth Grade” is ultimately like the “Sixteen Candles” of a new generation, but one more clear-eyed and less fanciful than Hughes’s fairy-tale vision: there’s no handsome prince for Kayla in the end, though there is the suggestion that things can get better if she’ll only put down the phone. Insightful without being mean and revealing without taking itself too seriously, Burnham’s picture could help today’s adolescents understand themselves better, and will certainly assist us older folks to appreciate the minefield they’re navigating their way through.