Java: repetition, overuse -- problem?
Posted
by HH
on Stack Overflow
See other posts from Stack Overflow
or by HH
Published on 2010-05-01T08:22:11Z
Indexed on
2010/05/01
8:37 UTC
Read the original article
Hit count: 381
I try to be as minimalist as possible. Repetition is a problem. I hate it. When is it really a problem?
- what is static-overuse?
- what is field-method overuse?
- what is class-overuse?
- are there more types of overuse?
Problem A: when it is too much to use of static?
private static class Data
{
private static String fileContent;
private static SizeSequence lineMap;
private static File fileThing;
private static char type;
private static boolean binary;
private static String name;
private static String path;
}
private static class Print
{
//<1st LINE, LEFT_SIDE, 2nd LINE, RIGHT_SIDE>
private Integer[] printPositions=new Integer[4];
private static String fingerPrint;
private static String formatPrint;
}
Problem B: when it is too much to get field data with private methods?
public Stack<Integer> getPositions(){return positions;}
public Integer[] getPrintPositions(){return printPositions;}
private Stack<String> getPrintViews(){return printViews;}
private Stack<String> getPrintViewsPerFile(){return printViewsPerFile;}
public String getPrintView(){return printView;}
public String getFingerPrint(){return fingerPrint;}
public String getFormatPrint(){return formatPrint;}
public String getFileContent(){return fileContent;}
public SizeSequence getLineMap(){return lineMap;}
public File getFile(){return fileThing;}
public boolean getBinary(){return binary;}
public char getType(){return type;}
public String getPath(){return path;}
public FileObject getData(){return fObj;}
public String getSearchTerm(){return searchTerm;}
Related
© Stack Overflow or respective owner