Barney was inspired by Barney Rubble, Fred Flintstone's best friend and next-door neighbor from the animated series The Flintstones [REF].
Castellaneta thought of the idea of Barney sobering up early in the series.