"Well, well, well, two naughty little children gone. Three good little children left.” So begins a chapter of Charlie and the Chocolate Factory, Roald Dahl’s 1964 children’s novel that has enticed young readers for over four decades and has also inspired two films—a 1971 version starring Gene Wilder as the crazed chocolate maker, Willy Wonka, and now a nuttier and chewier version featuring Johnny Depp as a younger, more troubled Wonka. Charlie and the Chocolate Factory is directed by Tim Burton (Edward Scissorhands, Ed Wood), and scripted by John August, who wrote the wonderful, Burton-directed Big Fish.

The storyline, for those who never venture into the children’s section of the library, concerns the mysterious Wonka and his mysterious factory at the edge of a mysterious town. No one knows how his chocolate is made since no one has gone in or out of the factory in 15 years, though massive trucks deliver Wonka Bars all over the world. One day, Wonka announces a contest. Five children will be allowed to tour the factory and be eligible for even greater prizes. The five turn out to be four champion brats plus the gentle, impoverished Charlie Bucket.

The story might be viewed as a religious allegory, complete with a difficult journey that leads to a chocolate-covered paradise. That may be an outlandish interpretation, but the novel is open-ended enough to allow such musings. Burton’s version, by contrast, runs the risk of giving the viewer too much information about Wonka and what motivates him and thereby taking away some of the mystery of the character.

Burton creates a flashback sequence explaining that Wonka had a strict dentist father who wouldn’t allow him to eat any candy at all. Once he got his first taste of chocolate, his life changed. The story of Willy’s childhood woes is funny, but this psychological spin means we can no longer see the factory as a kind of paradise. Wonka is turned into another neurotic with family problems, a Woody Allen with big hair.

But the new version has its own strengths, including Depp’s performance. He plays Wonka as a fragile man who is a bit frightened of children and not even sure what he is doing on the tour.

The new version also is visually spectacular, including a circular nut room with hard-working squirrels and an all-white TV room where a Wonka bar morphs into the monolith from 2001: A Space Odyssey.

It is admirable that composer Danny Elfmann (a frequent Burton collaborator) has kept the cautionary songs sung by the Oompa-Loompas (“Augustus Gloop! Augustus Gloop! The great big greedy nincompoop! How long could we allow this beast, to gorge and guzzle, feed and feast . . .”) Unfortunately, the musical production numbers are so busy and chaotic that the lyrics get lost. (The DVD release should include an option for showing the lyrics in subtitles.)

This problem is accentuated by Burton’s decision to cast a single actor (Deep Roy) to play the role of all the Oompa-Loompas (something feasible by way of computerized effects). This approach removes a sense of humanity that should accompany these creatures, who were supposedly rescued by Wonka when they were being killed off by “hornswoggers, snozzwangers and wicked whangdoodles.” (Dahl had a way with names.)

The new version of The Chocolate Factory is every bit as entertaining as the first, and even better in certain respects. But it provides a valuable lesson about the tricky process of film adaptation. It would have been easy for the book to explain why Willy Wonka was the way he was. The fact that it didn’t suggests that Dahl wanted children who read it—naughty or good—to ponder that mystery for themselves.