But when it comes to dealing plausibly with magic, or imagining how a school for magicians might be, Ursula Leguin's Wizard of Earthsea is a much more thoughtful and far better written book. That's not to knock JK Rowling's enjoyable stuff, but it's not in the same league.
Incidentally, I see there's a fifth Earthsea book out - here is an extract