"Little tyke wants his money's worth, just like his father. 'Atta boy, Dudley!" He ruffled Dudley's hair. (Harry Potter and the Sorcerer's Stone)
Why is the apostrophe put before Atta boy?
English Language Learners Stack Exchange is a question and answer site for speakers of other languages learning English. It only takes a minute to sign up.Sign up to join this community
‘Atta boy is short for That’s a good boy or, as M-W online says, “attaboy: probably alteration of that’s the boy”.
Because it's a shortened form, the apostrophe replaces the two missing letters of “that”, just as it replaces the initial “i” in “‘Twas” (“It was”).