Informatik 1 – Schmiedecke

Lab X0 – Let Eliza Talk!


Objective: Learn the most basic programming steps.
                 Learn using the most basic programming environment – the command shell.
                 Learn writing reports.

In "real life", you will rarely have to write and run Java programs from a command shell. Yet, these basic programming tools will be present almost anywhere, so you use them can mend or alter Java programs immediately on the machine where they run. So you should know how to use them.

From Lab X1 on, we will be using an integrated development environment. But it is a good idea for you to sometimes take your programs and compile and run them in the command shell.

 

Note on lab experiments:
You get detailed instructions to lead you through your lab experiments step by step. The time will suffice, if you

1.       pay attention in the preparatory at the end of the lecture (take notes)

2.       read the full lab task before starting and plan your work.

The lab reports are to be written at home, but you must collect notes and screenshots during the lab.

 

Note on lab reports:
In this course, you are required to write a report about every lab experiment. A report consists of the following parts:

1.       The experiment task (in short terms, maybe linked to the exercise page)

2.       The core solution(s) – including the key lines of code, if applicable

3.       Any (non-trivial) problems you encountered and their solutions. Include screenshots of error messages etc.

4.       The experiment results (as screenshots, if applicable)

5.       Links to the complete source code.

6.       Any sources of information or support used (incl. friends)

7.       The amount of time spent on the experiment and the report.

A report is good, if it looks like a helpful document for your own use: You will encounter similar problems again, this is where to look for solutions  So a report needs not to be long (1-2 pages of text + screenshots) or in perfect literary style. Use keywords, tables, screenshots, and write some simple sentences to comment on them.

You are encouraged to cooperate even across groups and to look for information on the internet etc. But you must mention any help you received and any sources you used in your report! Non-compliance will cost you points!

 

Hand in: Upload your report in moodle.

Important: During this exercise, there will be enormous differences in proficiency among you. Rather than playing a lot in an environment you feel completely at home in, help your fellow students! If you state in your report that you knew the shell well and helped s.o. else, that's fine.

 

Lab Task:

 

Content:

1.       Get to know your working environment

2.       Learn how to compile and run Java Programs

3.       Let Eliza Talk

1. Get to know your working environment

In our new Lab, all computers are set up for dual boot, i.e. you can choose between Linux and Windows (XP). If you are familiar with Linux, you can use the Linux environment. Everything works there correspondingly, and both operating systems use the same home directory, so that you can even swap in the middle.

If you are not familiar with Linux, work on Windows. You will get to know Linux later. All my detailed notes for those unfamiliar with system matters refer to Windows.

On login, you are granted some 50 MB on the lab server (mounted to Z: under windows). You can store your work there  - and even reach it from your home computer via ftp (or scp or ssh.). Your data should be safe, but I strongly suggest to keep extra copies (e.g. on a usb stick). Loss of data is no excuse for handing-in late!

Now get to know your working environment – if you are happy with it, go on to the next part.

1.       Find out which programs are installed on your computer. We need notepad or notepad++ for  editing (or vi under Linux), eclipse (3.2 or europe), and some text processing, e.g. Open Office.

2.       Find your personal home directory Z:. Add a new Folder X1 and in it another folder Utils.

3.     Open any editor (not MSWord!) , type the famous HelloWorld program and save in in X1 as HelloWorld.java:

public class HelloWorld

{

          public static void main(String [] arguments)

          {

             System.out.println("Hello World!");

          }

}

 

2.      Learn how to compile and Run Java Programs

I will talk you through this section in the lab. If you want to repeat some of the steps or do it all again at home, follow the X0-Extension instructions. 

 

If you are familiar with

·          system path variables, esp. PATH and CLASSPATH

·          the main java command line tools, i.e. javac (compiler) and java (interpreter)

You may skip this passage – or help others with it.

 

3.      Let Eliza Talk

1.       Invent and edit your own little Eliza program – you may copy some code from the lecture slides to get started. Save it as Eliza.java.
Here are some instructions, but feel free to write a very simple program, if you run out of time!

a.       Write a simple dialog consisting of 10-15 cycles.

b.       Try to find a part that can be repeated a number of times without getting too boring. Include this part in braces {} and put the following line in front of it:
for (int i=0; i<5; i=i+1) // this means 5 repetitions

c.        (for fast workers:) Try to split your dialog into procedures. 
A procedure is defined just as the main-method, only using this headline:
public static void method(),
where
method  is a freely chosen name. You can use (call) your method inside the main method like this:
method();

2.       Read your program carefully and try to eliminate as many typos and errors as possible – it will save you a lot of time!

3.       Run your Eliza program through the compiler and repair any reported errors. Repeat, until the compiler stops complaining J

4.       Start Eliza and talk to her – does she behave as expected? (and do you?) If not, repair the bugs.

5.       Spend the rest of the lab elaborating Eliza, until you get really affected to her…

6.       Don't forget to take screenshots for your report!

 

 

 

That's enough for this time – if you just rushed through, remember to help other folks!   


© Ilse Schmiedecke 2006 – for remarks and corrections: schmiedecke@tfh-berlin.de