Why extends is evil: Gosling che dice che se dovesse rifare Java lo farebbe senza classi?
E’ una provocazione interessante che serve ad Allen Holub per partire sul conflitto fra ereditarietà e aggregazione.
La banda dei quattro di Eric Gamma e il movimento dei pattern sono stati chiari in proposito: aggregare è meglio di ereditare.
“I once attended a Java user group meeting where James Gosling (Java’s inventor) was the featured speaker. During the memorable Q&A session, someone asked him: ‘If you could do Java over again, what would you change?’ ‘I’d leave out classes,’ he replied. After the laughter died down, he explained that the real problem wasn’t classes per se, but rather implementation inheritance (the extends relationship). Interface inheritance (the implements relationship) is preferable. You should avoid implementation inheritance whenever possible. “

Annunci

Autore: cosmic53

I have been into compilers and device drivers in the 80's, I have helped building the public Internet in Italy in the 90's. I have always loved programming languages and languages in general, writing about . Now I am into mobile apps. I am also a trained musician with a degree in jazz music. I play guitar, bass and flute.

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...