.Tutorial # 2.

Terminology Overview
(borrowed this from another TA)


code - lines of text that represent a particular computer programming language (in our case Java)

program - a program is made up of code and usually follows a particular logic to do a specific task (program/code can be used synonymously)

source file - a text file or files that holds the code, usually written using any of your favourite text editors

executable - a machine language file that represents your source file in binary

compiling/making - to generate an executable that the machine can understand, your source file must be translated from its "English" format to machine format; this process is called compiling/making

running - the actual execution of your program to see its results

debugging - the process of stepping through your code to find mistakes

GUI - Graphical User Interface (Windows environment)

CLP - Command Line Processor environment (DOS/UNIX environment)

IDE - Integrated Development Environment (CodeWarrior, MS Visual C++) - has all the tools for development right at your fingertips

JDK(SDK) - Java(Software) Development Kit - Sun Microsystems' version of a Java development environment; comes in UNIX/Windows versions for CLP development

ps - Post Script file extension that can be read with GhostView (gsview)

pdf - Portable Document Format can be read with Adobe Reader, freely available from Adobe

method - A self-contained section of code belognging to a class that defines a specific behavior for that class. It is referred to in a message by its method-name.

Comments


What types of comments are there in Java
    Single line comments, use the //

    Example:
        // this is a comment, notice i don't have to end it,
        // but it is only good for commenting what comes after it, on that line

    For Multi-line comments, your comment must be enclosed in a set of /* */

    Example:
        /* This Is The Comment */
        /* This
            Is
                The
                    Comment */

Why use comments?
    It helps other programmers understand how your existing code works
    It helps you organize your thoughts


Testing


Testing is a neccesary step in programming. You may miss some important cases, where your program would fail, and that wouldn't be good. Your testing must be well thought out.

Here are some guidelines for testing..

    Look at the type of input your program takes. How does it (your program) cope with empty input, normal input, large input, very large input

    Look at the boundary values for each feature in your code

    Your purpose in testing is not to say that everything works, it is to find bugs. If you don’t find them, someone else (other workers, your boss, or me!) will!

    Each test case must be well defined. Do not simply run your program 457 times with slightly different input and claim that it works.     Test those boundary cases!



Objects versus Classes

If there was any single point, that was most important during this tutorial, it was that of Objects versus Classes. You can think of a Class as being a blueprint for Objects. Objects, are created FROM classes, and thus for every class, there can be a many of Objects which are born from it. The behavior of objects is emplemented by the methods their class provides.

Class - A category of objects that share the same behavior.

Object - An entity in Java that models something; a member of a class.

We will be covering this over again next week, and the week after, just to make sure everyone completely understands it.

Sample Class


CarProgram.java - Calls Car.java, to initialize (instantiate), and use its method.
Car.java - This class represents a car, and holds variables to represent its various charactoristics.
sitemap