Wednesday, May 11, 2011

May 11th - 2011

Read Chapter 1.
-----------------------------------------------------
At the bottom, a computer understands only binary patterns.
- instructions and data are both binary patterns.
- whether a particular group of bits is instructions or data depends entirely on context.

Progress to higher level languages.
- Machine language (binary patterns)
- Assembly language ( mnemonics in one-to-one correspondence with machine language)
- Fortran & Cobol : first high-level languages.
- Present day : hundreds of languages.

How do we translate a high-level language to machine language?

In particular , Java.

Two general techniques:

Interpretation : Execute line by line as lines of code are written / edit -> run
Compilation : translate to machine code as one unit / edit-> compile-> run


java source code ---> Compiler (JavaC) ---> Java byte code ---> java virtual machine (JVM java virtual machine executes java byte code ) ---> machine language .

Five steps for problem solving

1) Understand the problem
2) Design a solution
3) Consider alternatives & refine the solution
4) Implement the solution
5) Test the solution and fix any problems.

/** --> indicates a javadoc comment
demonstrates the basic structure of a java application
this example also shows the most basic use of javadoc comments.
the sentence above appears in many laces as a summary. this paragraph will appear only in the detailed description of the class. the text of the comment can be followed by special tags, such as '@author', below. the tag section starts at the first line beginning with '@'.
@author lewis & Loftus
*/

public class Lincoln
(

/**
prints a presedential quote/
*/
public static void main (string[] args)
( system.out.println(" A Quote by Abraham Lincoln:") ;
system.out.println(" Whatever You are, be a good one.") ; )

/*
some comment
*/

Comments

- convey the intent of the programmer what is this piece of code supposed to accomplish.
- design assumptions ( particularly implicit assumptions)
- sneaky or clever implementation technique

No comments:

Post a Comment