Ish Del wrote:Java Main Class(Main program Name) creates an instance of some other class which has a start() function and that class is what creates most of the other objects and calls most other functions etc... Or should i just use main for that?
Seems like I am just using another class for the sake of not having much code in main.
Ish Del wrote: . . .
I know this is a small program so it doesnt matter but would you have MAIN create the ARRAY that holds movie objects and Main makes an instance of input and output?
yesyesyesyesyes And a 3rd class, a 4th class, a 5th class, a 6th class …
Or should i create a 2nd class . . . And all main does is instantiate the MovieProgram and run the start method.
I take a more extreme view. One statement to start the application and that’s it. I know I am at the extreme end of the spectrum; there are probably very few people who advocate main methods with fewer statements in than I do
Winston Gutkowski wrote: . . . a main() method should be easily understood by someone other than yourself; and that usually means keeping code to a minimum, but whether that minimum is 2 lines or 20 is up to you. . . .
Campbell Ritchie wrote:there are probably very few people who advocate main methods with fewer statements in than I do
Manuel Petermann wrote:@Mike Simmons
I would argue that you should write an argument parsing class for that.
Campbell Ritchie wrote:That might be a small program, but if you want to store movies and show them on screen with a GUI, you will be lucky to get away with only using 100 classes. A lot of those will be ready made for the display, fortunately.
You are going about it the wrong way by trying to work out how many classes you need. You need as many as you need. A bit like when us men cook. We need as many pots and pans as we need (as any woman will tell you!)
What you ought to do is work out how to store movies, and then later on you can think about a GUI to go on top. Remember the amount of effort to store 2000 movies is only slightly more than that required to store 2 movies (≡time to type in the other 1998 movies:wink:).
Start by writing a description of how you would store your movie details. Only when you have worked that out can you even think of writing any code.
Manuel Petermann wrote:@Winston Gutkowski: pre Java 7:
would do the trick...