JKR was needlessly bloodthirsty IMO. Why did she have to kill Hedwig and Dobby? And Tonks for that matter?
I think Dobby was killed to continue the mystery of Dumbledore and the mirror. Otherwise Dobby would have just told Harry that Aberforth sent him.