Inheritance abuse in Java

Problem: I am going through the code, Written by somebody else.

public interface FileManipulator
public abstract class FileRepository implements FileManipulator
public class CommonFileRepository extends FileRepository
public class Project1FileRepository extends CommonFileRepository
Some where else they encapsulated Project1FileRepository class.

Given requirement: Program need to read license agreement for project only once. It is not going to change across the project.


public class ProjectLicense
public static String getLicenseText()
// Read the license text from file and return.
// Better to put in static variable and avoid reading again.


Interesting facts about Inheritance depth in Java.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.