You Already Know How to Program

 
This page is for people who have already programmed in some other language like Python or JavaScript.
If you never programmed a computer, or are unsure of your skills please follow our Main Tutorial.
(ToC)

Please Read This, So You Don't Get Stuck...

This curriculum was designed for people who never programmed but wanted to learn. Apparently there are also a significant number of people who have programmed a beginner's language like Scratch or Python, and now you want to learn Java. This page is a fast track past our introduction to the basic concepts of programming in a more forgiving language than Java, in this case my Kitchen computer.

Turning ideas into code is the subject matter of the segment you just skipped over. The rest of this course is making Java do what you already know you want it to do

If you already know how to turn ideas into code, or if you don't want to learn that important part of programming, but only want to be able to make programs the Java compiler won't puke all over, at least read this page so you know what you missed.

If you want to try programming the Kitchen computer, you need to remember that it tries to be English, not a regular programming like you are used to, so if your command (statement) doesn't read like normal English, it probably won't work properly (for example "+=" is not a single word in English, and the two words together don't make sense in English), and also, all Kitchen statements (including assignment) start with a keyword.

The introductory material in the main tutorial attempts to convey three important facts about programming, which apply to all languages, but which do not usually get taught in other classes or books on programming.

First, The computer is stupid, it does just exactly what you tell it to do, even if you didn't want to tell it to do that. If you are not Observant, Careful, and Determined, you can probably learn how to write small programs like we present here in this curriculum, but you may find it difficult to do the big stuff that programmers get paid for. I think everybody should spend their life doing something that they enjoy: if it's not fun, find something that is. It helps if you can find enjoyment doing something that makes the world a better place, because you can get paid for that, and if you really like doing it, you will do a better job (and therefore get paid more).

Second, we have six simple operations that every computer can do, each of which most programming languages express in a single command, and which if you understand them and how to spell them in any particular programming language such as Java, you can program anything in that language that can be programmed. Five of them refer to basic one-line computer operations, and the sixth is a way of collecting and giving a name to a group of operations, so that you can refer to (and run) that whole group by a single command. We have given these short names to the operations, and a big part of how we teach you to program in Java is by reference to these six concepts:

Sequence, the idea that programs execute in the order you specify in your program, and that any program or program fragment is a sequence of operations, each one of these six.

Iteration is the idea that a sequence of steps can be repeated multiple times in the computer, but written as a single sequence in the program.

Conditional is the name we give to the idea that the computer can make a decision based on some data (see Variables, below), and then do one part of the program or another (but not both, at least not at that time).

Variables are places in the computer memory where numbers or other data values are stored, and we use the term to collectively refer to the process of computing a single value to be stored in a variable.

Input/Output refers to the transfer of data to variables from outside the computer, and from variables to outside the computer. Input is whatever values the programmer did not know when the program is written, so it must enter the computer when the program is run. Output is computer results that are saved off outside the computer, or else presented as text or images and sound to be seen (and heard) by humans. Controlling external hardware (like steering a car or making a robot walk) also is output.

Subroutines, also called Objects, are any collection of data and program code to which a name can be given, so that that code can be "called" from anywhere in the program where the name is visible, and it runs as if the code had been fully spelled out in the sequence from where it was called. Subroutines are code-centric and Objects are data-centric (the contained subroutines can only be called by reference to some existing data), but otherwise there is no fundamental difference.


Third, we teach "Top-Down" design, where any program is initially described in general terms in English (or Spanish or Chinese, or whatever language you think in), and then each line of that program is understood to be one of the six concepts, usually starting mostly with subroutine names, that is, one-line descriptors of some part of the program that may be descriptive but not very precise or detailed. Then each line that is not already one of the first Five is treated as a new program to be spelled out in more detail and precision, until all the subroutines are fully spelled out in terms of the Five concepts only, except that some of the subroutines may already exist and can simply be referred to by name.

If any of this is confusing, you might want to go back and read through the main tutorial -- and work the examples! -- to get a better understanding of these ideas, because the Java segment depends on a good understanding here.

Otherwise, you can proceed to the Java segment. Note that many of the programs we offer for developing your skill in Java start with English. It is not necessary to run the English code on the Kitchen computer, but we think it helps to separate the design from the language details. If you get lost, we suggest you go back and do the English portion of this curriculum, and try not to skim too fast, you might miss something. If it feels like there is too much text to read, you might consider some other profession, because programming a computer is mostly text-based. To get started in Java, turn the page.

<<Previous | ToC | Next >>

[2021 August 30a]