Java: repetition, overuse - problem?

I try to be as minimalistic as possible. Repetition is a problem. I hate this. When is this really a problem?

  • What is static-overuse?
  • What is the use of the field method?
  • What is an overuse class?
  • Are there more types of overuse?

Problem A: when is it too much to use 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 is it too much to get field data using 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;}

Similar

+3
source share
2 answers

Are there more types of overuse?

Yes ... excessive use of dogmatism.

, (, , , , ..) . - .

, , JVM. , , ; . , , , JVM, .

( . , . , - , - /.)

+3

" , , !"

- (, , , ), , . "" , , . : " , X, , ". , t - .

+1

Source: https://habr.com/ru/post/1743609/


All Articles