Wednesday, September 12, 2007


http://www.sdmf.k12.wi.us/mfhs/java/notes.html
Pg. 24 - 42

*Java programming language allows software to be asily exchanged via the web.

1) Problem Solving : the purpose of writing a program is to solve a problem.
1) Understanding the problem.
2) Breaking the problem down.
3) Designing a solution. (where u write prog.)
4) Considering alternatives to the solution and refining the solution.
5) Implementing the solution.
6) Testing the solution and fixing any problems.

2) The Java programming language
1) A program is written in a particular programming language that uses specific words and symbols to express the problem solution.
2) Program Statements: combination of words and symbols in the program language, which is appropriate according to the rules given.

3) Java developed in early 1990s by James Gosling at Sun Microsystems.
4) Introduced to public in 1995.
*Java got a lot of attention b/c it was the first programming language created for the Web.

5) Java is an Object-oriented programming language.
6) In Java we focus on important issues and not the details.
7) Java has a library of extra software that can be used when developing programs.

3) Java program
1) Comments don’t affect what the program does.
2) Comments are used as guidelines for someone to read and to understand what the code means.
3) Documentation: any written comments or documents, including a user’s guide and technical reference.
4) Inline Documentation: Comments included in a program.

5) Class definition: the code of the program within these braces {code}.
6) All Java programs are defined using class definition.

7) Method: a group of programming statements that are given a name. Like a class definition, a method is also enclosed with braces.
2) All Java programs have methods, and this is where the processing begins.

3) println (pronounced “print line”): we invoke, or call, a method when we want it to execute.
4) The println method prints specified characters to the screen.
5) The characters that are to be printed are represented as a character string, enclosed in double quote characters (“)

4) Comments (in more detail)
1) For single line comment we use (//)
2) For muli-line comments we enclose with (/**/)

5) Identifiers and reserved words.
1) Identifier: the various words used when writing programs. There are three categories.
1) words that we make up. (Harvard, arg)
2) words that another programmer chose (String, system, out)
3) words that are reserved for special purposes in the language. (public, static, void)

2) Identifier arg (short for argument): Instead of Harvard we can use any identifier in its place.
3) The words that another programmer uses are pulled directly from the huge library of predefined codes.
4) Reserved words: identifiers that have a special meaning in a programming language and can only be used in predefined ways.
- (In Java reserved words are in blue type)
*A reserved word cannot be used for any other purpose, such as naming a class or a method.

5) Identifiers may be of any length, they consist of a combo of letters, digits, the underscore character ( _ ), and the dollar sign ($) (identifiers can’t start with a number).
*Java is CASE SENSITIVE (matters when you put in upper-case vs. lower-case)

6) Name: in Java, it is a series of identifiers separated by the dot (period) character.

6) White space
1) consists of blank, tabs, and newline characters
2) All Java programs use white space to separate the words and symbols used in a program.
3) Except when it’s used to separate words, the computer ignores white space.

*empty white space does not affect the execution of the program.

7) Programming languages
- suppose you are giving travel directions to a friend. You might explain those directions in one of several languages. (French, Spanish, English). ***Although you give the same direction the way you express it is different.
1) This is the same for programming languages, such as Java, Ada, C, C++.
2) The purpose of the program is the same no matter which language you use, but the particular statement to express the instructions vary with each language.

8) Programming language levels
Lower-level Languages
1) Machine (computers only read this)
2) Assembly (replaced Binary digits with mnemonic, short English-like words that represent commands or data.)

3) Higher-level (means that the programming statements are like natural language. Ex. Java, Ada, C, C++)
4) Fourth-generation. (4GLs): They are called 4GLs b/c these followed the first three generations of computer programming.

9) Compilers and Interpreters
1) Software tools: special-purpose programs need to help with the process of developing new progs.
2) Editor: you use this to type a program into a computer
3) compiler: a program that translates code in one language to another language.
4) source code: the original code.
5) target language: the language into which it is translated.
6) Interpreter: like a compiler, but translates and executes small segments of the whole.

Compiler and Interpreters work hand in hand.
7) The Java compiler translates Java source code into Java byte code, which is a low-level form something like machine language code.
8) The Java interpreter reads Java byte code and executes it o a specific machine.
9) Another compiler would translate the byte code into a particular machine lang. for execution.

**The diff. b/t Java byte code and true machine language code is that Java byte code is not tied to any particular processor type. This make Java architecture neutral. Works on many types of machines. *only restriction is that there must be a Java compiler and interpreter.

**Java byte code could be compiled into machine code.

10) The Kits
1)SDK or JDK (Software/Java Development Kit): contains several other software tools that may be useful to a programmer.
2) IDE (Integrated Development Environments)
Combines an editor, compiler, and other Java support tools

11) Syntax and semantics
1)

Monday, September 10, 2007

pg. 16 - 24

1) The CPU
- uses main memory to perform all the basic processing in a comp.
- consists of 3 components
1) Control unit: handles the processing steps
2) Registers: small amounts of storage space in the CPU itself.
3) Arithmetic/logic unit: does calculations and makes decisions.

- program counter: holds the address of the next instructions to be executed

2) von Neumann architecture
- the idea of storing program instructions and data together in main memory. (first advanced in 1945)

- fetch-decode-execute cycle.
1) Fetch an instruction from main memory
2) Decode the instruction and increment program counter.
3) Execute the instructions

3) Parts on main circuit board
- the CPU is on a chip called a microprocessor
- System clock: sends out an electronic pulse at regular intervals, so that everything on CPU happens on schedule.
- The clock speed tells you how fast the CPU reads instructions. (clock speed: rate of pulses)

4) Networks
- two or more computers connected together so they can exchange info.
- each computer on the network is a file server.

5) Network Connections
- point-to-point connection: two computers close to each other.
- In this connection, every computer is connected to a wire to every other computer in the network.

- In a network each computer has its own network address. (like the address in main memory but for computers!)

- Sharing a communication line is less expensive and makes adding new computers to the network easier.
- but a shared line means delays.
- the computers on the network cannot use the line at the same time. They have to take turns (busy).

- too improve network delay, we use packets (dividing the large messages into small pieces)
- The individual packets are sent across the network mixed up with pieces of other messages sent by other users.
- Packets are put back together to make original message.
*** This “packets” method is faster than waiting in line.

6) Local-area networks (LAN) & WAN
- designed to span short distances and connect a small number of computers.
- Wide-area network (WAN) connects two or more LANs, often across local distances.

7) The Internet
- During the 1970s, a US gov’t organization called the Advanced Research Projects Agency (ARPA) funder project to explore network technology.

- Result was APRANET, a WAN that eventually became known as the Internet.
- The internet is a network of networks
- the term ”internet” comes from the word internetworking - connecting many smaller networks together.

- In 1983, there was only 600 computers connected to internet, by 2000 there was over 2 million!

- a protocol is a set of rules about how two things communicate.
- the software that controls the movement of messages across the Internet must follow a set of protocols called TCP/IP (Transmission Control Protocol/ Internet Protocol)
1) IP software defines how info is formatted and transferred.
2) TCP software handles problems such as pieces of info arriving out of order or getting lost.

- IP address: every computer connected to the internet has this to ID itself among all other computers in the internet.
- Internet address: internet name of computer.

- the first part of an Internet address is the local name of a specific computer. The rest is the domain name. (there are sub domains also)
- Top-level Domain (TLD) indicates the type of organization to which the computer belongs.
- Domain Name System (DNS): Software that translates the IP address.

8) World Wide Web (WWW)
- based on the ideas of hypertext and hypermedia
- hypertext: first used in 1965 to describe a way to organize info. “jumping for one document to another”
- when graphics, sounds, and animation are mixed in we call this hypermedia.

- Browser: a software tool that loads and formats web documents for viewing
- Mosaic, the first graphical interface browser for the web, released in 1993.
- Some people who developed mosaic went on to discover NETSCAPE (today’s browser)

- Web Server: a computer dedicated to providing access to web documents.
- Many of these docs use HTML (HyperText Markup Language). Java can be embedded.

9) Uniform Resource Locators (URLs)
- Every web document has this.
- URLs contains several pieces of info
1) protocol: which determines the way the browser should communicate.
2) Internet address of the machine on which the document is stored.
3) the third is the file name

http://www.gestalt-llc.com/vision.html.

1) In this URL, the protocol is http, which stands for HyperText Transfer Protocol.
2) The machine referenced is www (a typical reference to a web server), found at domain gestalt-llc.com.
3) Finally, vision.html is a file to be transferred to the browser for viewing.

10) The Internet vs. The World Wide Web
- The term internet and world wide web do no mean the same thing.
- The internet is a network of computers all over the world.
- The Web is a set of software applications that lets us used the internet to view and exchange programs.
- The Web is not a network, it is a software.

Sunday, September 9, 2007

Pg.16 - 24



*b/t = between

1) Binary Numbers (BN)
- Computers file info using Binary.
- A single binary digit is called a bit.
- base value for BN is two

2) Hard Drive (magnetic)
- magnetized area = 1
- demagnetized area = 2

3) Hard Drive (electric)
- less likely to fail if they switch b/t only 2 states.

4) Signals
- Digital signals are concrete, while analog signals vary (look at pg. 8 in the book for illustrations)
- Signal gets weaker as it moves down a wire. Analog signals become distorted easily (because the scale can be from 5 to -5), and do not contain the original info; while the digital signals are of two extremes (1 & 0), so the original info doesn’t change much.

5) Signals (representation)
- For a light bulb, we can use one digit. 1 meaning it is on, and 0 meaning it’s off.
- When using two bits, there are exactly four ways we can arrange the bits: 00, 01, 10, 11.
- 3 bits è 8 combos
- 4 bits è 16 combos
- 5 bits è 32 combos
- 8 bits è 256 combos
- In general, N bits can represent 2n unique items.

---------------------------------------------------

1.1 Hardware components

Computer Architecture
- Computer architecture is the term used to describe how the hardware components of a computer are put together.
- Info travels b/t components across a group of wires called a bus.

2) The CPU (central processing unit) and the main memory make up the core of the computer.
- Main memory stores programs and data that are being used.
- CPU executes program instructions one at a time.


3) Peripherals
- Almost all devices in a computer sys. Other than the CPU and Main memory are called peripherals.
- Peripherals operate at the periphery, or outer edges, of the system.
- Without the Peripheral devices the CPU and main memory would be useless.
- They include: the monitor, keyboard, etc.

4) Controllers
- devices that send info back and forth from CPU and main memory to the peripherals.

5) Types of peripherals
- Input/output (I/O)
- data transfer devices (i.e. modem, which lets info be sent across a telephone line.

I/O Devices

- most common input devices are the keyboard and mouse.
- Others include: bar code readers, joysticks, microphones, virtual reality devices, scanners.

- most common output devices are the monitors and printers.
- Others include: plotters, speakers, goggles.

- Touch screen can handle both input and output.
- Pixels = “picture elements” (picture created by breaking it up into small pieces)

Main memory & Secondary memory

- each memory location has a unique number called an address.
- storage capacity is the total number of bytes(8 bits) it can hold.
- B/c computer memory is based on the binary sys., all units of storage are power of two.
- kilobyte (KB) is 1024, or 210

- Main memory is volatile (lost easily if not supplied by power), Secondary memory is nonvolatile.
- floppy disk can store 1.44 MB of info.

- Magnetic tapes = secondary storage (inconvenient, works like a video tape, have to rewind to right place for info). It is a direct access device.

- RAM (random access memory) & ROM (read only memory), both are a type of direct(or random) access. - RAM: data can be both written and read from it.
- ROM: data can only be read from it.
- CD-ROM stores about 650 MB.
- CD speeds = 153,600 bytes of data per sec.
- CD - RW has 24x/10x/40x max speeds, 24x = speed for writing CD - R, 10x = speed for writing CD - RW, and 40x = speed for reading.