Some questions people had in class #4

 

What does that (program) do?

 

            The compiler translates the program into bytecodes – binary representation of the program. The development environment (or Browser for Applets) then interprets these binary files step by step, the CPU carries out the instructions, whatever they say to do.

 

Why does the computer have so many ways to do things?

 

            Programmed that way to give people (users) flexibility in how they do things, so individual preferences can be followed.

 

Difference between block and methods body?

 

A method’s body is a block. There are other blocks too – for example the entire contents of a class.

 

 

How are the steps of programming decided for Java?

 

You must figure out the steps that need to be taken, and then translate them into the language (Java). Figuring out the steps requires logical thinking. You know what the starting point is and where you want to go, and what is legal to do, and you must piece together a solution. Brainstorming, planning ahead, breaking down anything difficult into smaller tasks, and trial and error all play a part. Practice and experience are invaluable for developing this skill.

 

 

Do “public static void main” ever change?

 

Yes, for instance if we are writing an Applet instead of an application, there is no main; other methods are used instead.. We will also have other methods in addition to main that will be different. All or almost all of the programs this semester will have a public static void main method.

 

What types of Programming are we going to be doing?

 

More “text-based” than Graphical User Interfaces (GUI), because setting up GUIs takes a fair amount of effort and is a little complicated. I will pick out programs that I think are interesting. I hope you will find them interesting too.

 

 

How does Java code differ from other OO programming languages?

 

Really, in many ways from minor points of syntax to detailed differences in meaning. CIS 636 spends a lot of time on Java vs. C++ (Which is actually a hybrid OO / procedural language).

 

What is the purpose of /** and how is it particularly special?

 

There is an extra “utility” called JavaDoc which scans Java files, and finds comments that start /** and take the info from them and puts them in a documentation file. The usual use is to put a /** comment before each method, then JavaDoc assumes that the comment applies to the method and puts the method in the documentation along with the comment. Somebody building on your work could rely on the documentation, and less on reading your code (which is hard).

 

Why does programming language have to be so abstract? Why not make it simple?

 

Abstraction is desirable in order to make things general. A language that is too specific could do fewer things. There is a language for controlling factory machinery that can be fairly specific (e.g. turn left 30 degrees), but it only works for controlling factory machinery. Efforts to make programming more simple include Visual Basic (VB). In VB, you can create a button on the screen by dragging an icon to the screen. However, VB is not a cure all; there are still a lot of details to deal with.