Should main method be only consists of object creations and method calls?

Posted by crucified soul on Programmers See other posts from Programmers or by crucified soul
Published on 2012-03-26T15:31:35Z Indexed on 2012/03/26 17:38 UTC
Read the original article Hit count: 351

A friend of mine told me that, the best practice is class containing main method should be named Main and only contains main method. Also main method should only parse inputs, create other objects and call other methods. The Main class and main method shouldn't do anything else. Basically what he is saying that class containing main method should be like:

public class Main
{
    public static void main(String[] args)
    {
        //parse inputs
        //create other objects
        //call methods
    }
}

Is it the best practice?

© Programmers or respective owner

Related posts about object-oriented

Related posts about programming-practices