Module 1: Programming vs. Computerese


Objectives

 

By the end of this module you will be able to:

 


The Edit-Compile-Test process

 

The ECT process:

What we mean by computerese:

 

In-Class Exercise 1: Go back to the HelloWorld example in Module 0 and identify the computerese involved in the compile and execute phases.
 

About computerese:

 


Basic computerese for the Edit-Compile-Test process

 

Let's start with hardware: what do you need to know?

  • Reasonable skill with the keyboard: moderate speed.
 

The operating system (OS):

  • The Big Three: Windows, Mac, Unix.

  • Analogy: OS = support staff between you and hardware.
           => Without an OS, it would be much harder to use computers.

  • What we need the OS for: files, directories and executing programs.

  • Files and directories:
    • Navigating to a directory.
    • Making a new directory (and deleting, if needed).
    • Files: opening, moving, copying, deleting.

  • Executing programs: how to run editors, compilers etc.
           => It's not always "double click".
 

The two ways we interact with the OS:

  • Using a Graphical User Interface (GUI), e.g., to see what files are on the T: drive:

  • Use the command-line. Here is the same list of files from the command-line interface:

  • You are already accustomed to the former.

  • Analogy for the command-line: think of this as "texting" the OS, asking it to do things for you.

  • Thus, above, we asked the OS to dir list the files in that directory.

  • With a GUI, when you want to run a program, you double-click.
           => But with a command-line, you type in the name of the program.

  • Unfortunately, the command-line languages for Windows and Unix/Mac are different.

  • There are minor differences in the commandline in various "flavors" of Unix.
 

The table below summarizes the most common ways of carrying out the edit-compile-test process on various systems.

For each, we provide instructions to:

  • Create a new directory.
  • Edit-compile-test the simple HelloWorld.java program in that directory.

Where Edit Compile Test Submit Instructions Comments
T411 Windows Windows Windows Windows Instructions Edit/compile/test on Windows in T411
T411 Unix Unix Unix Windows Instructions An all-unix process won't handle GUI applications
T411 Unix Unix Windows Windows Instructions Edit/compile on Unix, run on Windows
Home (Windows) Windows Windows Windows Windows Instructions Edit/compile/test on Windows at home
Home (Windows) Unix Unix Unix Windows Instructions Edit/compile/test on Unix from Windows machine at home. For non-GUI programs.
Home (Mac) Mac Mac Mac Mac Instructions Edit/compile/test on Mac at home
Home (Mac) Unix Unix Unix Mac Instructions Edit/compile/test on Unix from a Mac at home. For non-GUI programs.
 

In-Class Exercise 2: Try all the T411 options above, and at home, try out both options for the computer you have.
 

About the editor:

  • As it turns out, there are a variety of editors you can use for Java programs.

  • For this course, at least for the first half, you need to use the specified editors
           => Notepad on Windows, Pico on Mac/Unix.

  • Please DO NOT use the so-called development-environments (such as Eclipse), nor even Notepad++.
 

Finally, let's explain how you can upload a Java file when submitting an assignment:

  • Login to Blackboard.

  • Navigate to the appropriate assignment.

  • When the assignment asks you to upload your Java file (e.g., HelloWorld.java), use "browse" to locate your file and upload it.
 

In-Class Exercise 3: Login into Blackboard and check the assignments section for this course. There is a trial-upload assignment. Upload your HelloWorld.java file.
 


GUI vs. command-line programs

 

We have seen the difference between GUI and command-line interaction with the OS:

  • Command-line: e.g., command-prompt (Windows) or terminal (Unix, Mac).

  • GUI: e.g., Windows Explorer.
 

Now let's look at the same in Java programs:

  • The programs we've seen so far are command-line programs
           => They produce output to the command-line window.

  • A GUI program, on the other hand, itself brings up a window.
 

In-Class Exercise 4: Download DrawTool.java and TestDraw.java and save in the same directory as HelloWorld. Compile and execute the file TestDraw. (No need to edit, since it's already written.)
 

What we observe:

  • Java programs can bring up windows
           => These can draw something, or allow user interaction.

  • Programs can be written across multiple files.
           => There were two files involved above, but executed only one.



© 2011, Rahul Simha