• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What Are The Guidelines For The Class Where The main Method Is?

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose that I have a system. There are many classes within that system. What are the attributes and methods supposed to be in the class where the public static void main (String [] args) {} is?
And my second question follows: What if I have more than one system and these systems interact with each other?
Is there any principle to follow? Are there guidelines (patterns)? I raised these questions because from reading UML, I start to understand that
"an object-oriented system is composed of objects sending messages to other objects to complete operations. There is great variability in the potential quality of object interaction design and responsibility assignment.
Responsibilities are related to the obligations of an object in terms of its behavior and follow two types:
Knowing
oKnowing about private encapsulated data
oKnowing about related objects
oKnowing about things it can derive or
calculate
Doing
oDoing something itself
oInitiating action in other objects
oControlling and coordinating activities
in other objects
Responsibilities related to �knowing� are often inferable from the conceptual model because of the attributes and associations it illustrates. Responsibilities are implemented using methods that either act alone or collaborate with other methods and objects.
Some of these principles, applied during the creation of interaction diagrams and/or responsibility assignment, are codified in the GRASP patterns: Expert, creator, Controller, High Cohesion and Low Coupling. GRASP is an acronym that stands for General Responsibility Assignment Software Patterns. The GRASP describes fundamental principles of assigning responsibilities to objects, expressed as patterns."
 
Thomas Smets
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you main should be as small as possible !

public class Main
{
public static void main (String[] args)
{
new MyRealMainClass().do();
}
}

So the entry point can be the same while changing all the rest.
Your second question is far too generic to be answered in one post !
Choose a technology first (RMI, EJB's, JDBC, ...) & then you will be able to post a proper question i believe.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic