Successful software management requires careful organization of file locations and file names and proper documentation. Rules for locations and names and simple documentation standards given in this handout.
Every Java class is identified by a package and class names. In order to insert your Java program into a larger system, you must use the correct names.
Every programming assignment will list the packageclass names that must be used in submissions.
The Java conventions for naming packages requires
that all package names should be sequence of period-separated
lower-case words. It is suggested that organizations should begin
packages names with a reversed internet domain names. An example of
this would be edu.unca.cs.labaids
which was used
for CSCI 201 labs for years.
In this course, it would be cumbersome to use long period-separated
words, so package names will be simple and generally reflect the
homework assignment, such as homework1
.
By convention Java class names are supposed to be camel cased words, such as “NetBeans” or “AstroTurf”. This convention will also be followed in this course.
Let‘s assume that the assignment calls for use of the
package name packagename
and class name ClassName
.
If you are using NetBeans, it isn‘t hard to follow the
assignment rules. If you are creating a Java application;
start with the menu choice
New Project....
When you arrive the window labeled
New Java Application,
set the
Project Name to be the required package name.
Then set the textfield following
Create Main Class
to the required package name followed by a period and then the
required class name, such as
packagename.ClassName>
.
The first few lines of your Java program should contain the following:
package packagename; public class ClassName {
In some assigments, you will be asked to build a class which isn‘t the main class. An example of this is Homework 2.
For those assignments, you should start by defining creating
a Java application with the project name given in the assignment,
but use TestDriver
as the class name.
Often you will be given the code for TestDriver
.
Then you should use the menu choice New File... to add a Java class to your project. When you get to the New Java Class window, you will need to type in the class and project names in two different text fields.
You should endeavor to follow the
The Javadoc @author
must be completed
with your name and email address, similar to the example
shown below.
* @author Dean Brock <brock@unca.edu>