Where I want everybody to be after demonstration 5:
- You know all the key concepts introduced in demonstrations 1-4. One of the most important things is that you understand how the syntax of a programming language allows you to create nested structures that have a meaning (i.e., semantics): They describe a sequence of computations that manipulate numerically encoded pieces of data within a computer's memory. All applications that you see on your computer are created in this fashion. No tricks or magic; only sequential computations.
- Syntax is one thing; it is a means of communicating a plan about how something is to be computed. The plan is called an algorithm. Algorithms and data structures (the way in which the numerical values are put together) are pretty abstract; they should emerge in the programmers mind before they can be written as a program.
- You know that you have to be careful in the way you communicate your ideas: You must follow code conventions; otherwise it is hard to understand your ideas about how computations are performed.
- You are comfortable with the concepts around subroutine (which we will call method from now on, because it is the Java terminology for the same thing. Other names, depending on who is talking, are at least function and subprogram)
- You know how a method is declared, and what is the interface of a method: In the statements of the method body, you rely on some parameters, and make computations based on those. You provide a return value from the method. Later we will see that a method can also have side effects on objects that are passed as references. That makes methods a very powerful tool. On the follow-up courses (Programming 2 etc.) the concept of method is taken a step further: the static modifier goes away, and these non-static methods (also called "member functions" start acting on a this -instance of an object. (You have already seen this in action: System.out.println() is a non-static method of class PrintStream. So calling System.out.println() will invoke an object via the reference System.out. More about objects and references very soon...)
- You understand, and are able to use, method invocation and the very basic control structures: if, for, while, do-while, return.
- You know all the primitive types available in Java. You have heard that in addition to these, there are reference types.
Demonstration 6 happened in the computer class Asia, where I was able to show you how programming can be done by first making some test cases for a method, and then gradually making the method perform as it should. You always make a very small change at a time, and before you get lost, you try to compile and run your program to see whether it gives correct return values for the given parameters.
It is important to learn how the computation operations happen one at a time, and what it means to invoke a method. We used the following tool in the computer class. You can try it out for small programs yourself:
This time there were no exercises; I hope you have been reading your textbooks, and trying to understand programming by yourselves, though.