If a Java Programmer Wrote Harry Potter and LOTR
Harry Potter, has an old, good wizard with a pointy hat. LOTR has an old, good wizard with a pointy hat. Harry Potter has a short hero. LOTR has a short hero. Of course, there's the bad wizard, the comic reliefs, the fallen evil overlord trying to regain his strength... present in both movies.
Why not make an Abstract class called "WizardMovie" and just extend this to create both movies?
Or perhaps a single class can't contain all of each movie. Why not make "package harrypotter" and "package lordoftherings", which simply implement standard interfaces or abstract classes in "package wizardmovie".
"package wizardmovie" would contain interfaces or abstract classes such as "wizardmovie.GoodWizard", "wizardmovie.ShortHero", "wizardmove.ComicRelief", "wizardmovie.BadWizardWhoYouThinkIsGoodI nTheBeginning".
For example:
package harrypotter;
import wizardmovie.GoodWizard;
class Dumbledore extends GoodWizard {
....
}
Some of the advantages:
* self-documenting code
* writers of spinoffs, sequels and prequels will not have difficulty making sure their code is compatible with existing code because they will be interfacing with standard interfaces
* the elimination of unpredictable outcome (you know from the start that the other wizard turns bad in the end), since unpredictable outcome is a sign of bad programming style.
Why not make an Abstract class called "WizardMovie" and just extend this to create both movies?
Or perhaps a single class can't contain all of each movie. Why not make "package harrypotter" and "package lordoftherings", which simply implement standard interfaces or abstract classes in "package wizardmovie".
"package wizardmovie" would contain interfaces or abstract classes such as "wizardmovie.GoodWizard", "wizardmovie.ShortHero", "wizardmove.ComicRelief", "wizardmovie.BadWizardWhoYouThinkIsGoodI
For example:
package harrypotter;
import wizardmovie.GoodWizard;
class Dumbledore extends GoodWizard {
....
}
Some of the advantages:
* self-documenting code
* writers of spinoffs, sequels and prequels will not have difficulty making sure their code is compatible with existing code because they will be interfacing with standard interfaces
* the elimination of unpredictable outcome (you know from the start that the other wizard turns bad in the end), since unpredictable outcome is a sign of bad programming style.
