Java: repetition, overuse -- ?

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:27 UTC
Read the original article Hit count: 348

Filed under:
|
|
|

I try to be as minimalist as possible. Repetition is a problem. I hate it. When is it really a problem?

  1. what is static-overuse?
  2. what is field-method overuse?
  3. what is class-overuse?
  4. 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

Related posts about java

Related posts about repetition