How do you spell out the methods that have too many arguments?



  • The question does not concern the optimization of the code, which should lead to a reduction in the number of the code. Let's say we already have a method and it looks like this:

    package2.MyClassSystemName method1(MyClass1 argName1, MyClass2 argName2, AnotherClass1 argName3, AnotherClass2 argName4) {
    //Некоторый код
    }
    

    How to frame it, from the point of view of Java style, to make it more readable. My option seems scary anyway:

    package2.MyClassSystemName method1(
        MyClass1 argName1, 
        MyClass2 argName2, 
        AnotherClass1 argName3, 
        AnotherClass2 argName4) 
    {
        //Некоторый код
    }
    


  • http://www.oracle.com/technetwork/java/codeconventions-136091.html

    It says it's like that.

    package2.MyClassSystemName method1(MyClass1 argName1, MyClass2 argName2,
            AnotherClass1 argName3, AnotherClass2 argName4) {
       ...
    }
    

    It has been written that there are eight gaps


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2