Java Software Solutions

aniseedsplashSoftware and s/w Development

Aug 15, 2012 (5 years and 4 days ago)

386 views

1
/73

Java Software Solutions

Chapter 1.1

Computer Systems

2
/73

1. Computer Processing


A
computer system

is made up of
hardware
and
software
.


Hardware
: Chips, keyboards, disks, wires, etc.


Software
: Programs and the data those programs use.


Key Components of a Computer System


central processing unit (CPU)


input/output (I/O) devices


main memory


secondary memory devices

3
/73

Memory


Programs and data are held in storage devices called
memory
,
which fall into
two categories
:


Main Memory (“primary memory,” “central memory”…)


The storage device (e.g., chips on the mother board) that holds the
programs
and

their data (software) while the programs are
executing.


Secondary Memory


Devices such as hard disks that store software in a relatively
permanent manner.


We save our software on
secondary memory
.
Copies

of the
software are brought into
main memory

when we
execute

our
programs.


Copies = data and programs

4
/73

Software Categories


We will be concerned with two categories of software.


The
operating system
.


Provides a user interface that allows us to interact with the
machine (enter input and view output).


Manages computer resources such as the CPU and main
memory.


Provides protection, and much more.


Application Software


Generic term for just about any software other than the
operating system.


Word processors, spreadsheets (office tools), web browsers,
games, hosts of search engines, twitter, facebook, …etc.


Scientific applications; business / commercial applications…


The
focus of this course

is development of
high
-
quality
application programs to be used in business / commercial
applications.

5
/73

What This Means to Us


We will be learning to create application
programs using the Java programming
language.


We will be using an IDE called NetBeans.


Current version of NetBeans is 6.7 but 5.0 and 5.5
should both be sufficient also.


IDE stands for
Integrated

Development

Environment
. (Know this)


There are many IDEs ‘out there.’

6
/73

More: What this means to us


You will download and install the J2SE
Standard Edition and Development Kit JDK
and NetBeans 6.7 (bundled together) from
links on my web page.


See: Link to Download NetBean and Java.


See the link on my web page and instructions
to download and install NetBeans 6.7 and the
Java JDK.


See NetBeans Tutorial and Project0 Details are
here.


See also the tutorial on how to use NetBeans
6.7 to develop and submit Project0.

7
/73

Analog versus Digital Signals


Analog information

and/or signals are
continuous
,
varying in direct proportion to the source of the
information


like the amplitude of a wave may vary
with volume. It’s period may vary with frequency…


(Hz (frequency) measured in cycles per second; Period is
seconds per cycle)



Digital technology

breaks information into
discrete
pieces

and represents the pieces as numbers.


Music on a CD is stored digitally, as a series of numbers.
The music is sampled about 40,000 times per second and
each number represents the voltage level of one specific
instance of the recording.

8
/73

An Analog Signal

versus a Digital Signal

analog

digital


1 0 1 0 0 1 …

9
/73

Binary Numbers


A digital computer stores information as
numbers: ones and zeroes.


These numbers represent ‘state’


On/off; one/zero, etc.


All information in a computer is stored and
managed as
binary values
.


The
bi
nary number system has only two digits,
0
and
1
.


A single
bi
nary digi
t

is called a
bit
.

10
/73

Converting Binary Numbers

to Decimal Numbers


Starting with the
rightmost bit

in a binary number,
each position represents a
power of 2
, with the
rightmost bit position representing
2
0

which is decimal
1
, the next bit position representing
2
1

which is
2
and
the next representing
2
2

which is
4
, etc.


Binary
1011

is
1* 2
3

or
8
+
0 * 2
2

or
0 +

1 * 2
1

or
2 + 1 *
2
0

or
1

which adds up to
11
decimal (base 10).


Binary
11001001

is
201

decimal.


CAN YOU DO THIS???? Yes, you need to know this!


In general,
n

bits can represent
2
n

unique items.


Computers typically manipulate sequences of
8 bits

with each
sequence of 8 bits referred to as a
byte
.

11
/73

2. Hardware Components


We use the term
computer architecture

to describe
how

the hardware
components

of a computer are put together.


A
program

and its
data
reside in
main memory

while

the
program runs.


The Central Processing Units (CPU) reads one program
instruction from main memory and executes it.


(Called ‘fetch


execute’ cycle)


If an instruction needs data, such as the amount in a bank
account, the CPU will acquire that information from central
memory (which may require the access of data in secondary
memory to be brought into memory first).


The process repeats until the program ends.

12
/73

Peripherals


Almost all
devices

in a computer other than
the CPU and main memory are called
peripherals
.


Controllers

are devices that coordinate the
activities of specific peripherals.


A unit with several disks attached will have a disk
controller for timing, contention, data access, …


Input/Output (I/O)

devices like disks and other
secondary memory

devices (Jump drives,
etc.)are considered peripherals.


We won’t pay much attention to them.

13
/73

Input/Output Devices


For our purposes, the primary I/O devices will be the
keyboard

and the
monitor
.


Output on a monitor is achieved by breaking the screen
picture into small pieces called
picture

elements

(
pixels
).


The pixels are represented in the computer as numbers (as
is everything else) and each pixel has a specific ‘screen
address.’


A typical monitor can display a number of ‘
screen

resolutions
’ such as 640x480, 800x720, 1280 x 1024
and others…


These numbers represent the number of pixels used to
display the screen information.


Aspect ratio

14
/73

Main Memory and Secondary
Memory


Main memory is made up of a series of consecutive
memory locations called
addresses
.


Associated with each memory location is a
unique

address
.


On many computers, each memory location consists of 8
bits, or one
byte

of information.



The
storage capacity

of a device such as main
memory is the total number of bytes it can hold.


A
kilobyte

(KB) is
1,024 bytes

or
2
10

bytes.


Larger units are a megabyte (MB), a gigabyte (GB), and a
terabyte (TB).


It is usually easier to think about these capacities by
rounding them off.

15
/73

Characteristics of Main Memory


When data is stored in a main memory
location, it
overwrites

(thus destroying) any
information that was previously stored there.


Main memory is said to be
volatile
.


The information stored in it will be lost if its power
is lost. (meaning of volatile in this context)


You should frequently
save

your work onto a
secondary memory device (such as a disk).

16
/73

Secondary Memory Devices


A
disk

is a
direct access

(also called
random access
) device
since the read/write head moves quickly to the information needed.


In the prerequisite to this course, you have seen pictures of disks and
how they operate.


Disk is both a
direct access device

and can be accessed
sequentially

just like a tape unit.



A
tape
must be
sequentially processed

/ rewound / or fast
-
forwarded to get to the desired information.


A tape is thus a considered a
sequential access

device.


While tapes were the medium of choice when disks were expensive and
access was controlled to
those types of applications

really needing
disks, tapes now are almost exclusively used for
backup storage
.


Very inexpensive and can store
huge quantities

of data


often
archival
.

17
/73

Two More Terms


Random Access Memory (RAM)


The terms
RAM

and
main memory

are basically
interchangeable. Sometimes called
primary memory.


RAM should probably be called
read
-
write memory

since
data can be both written to it and read from it.


Read
-
Only Memory (ROM)


After information is stored on ROM, it cannot be altered
(easily). Data in ROM is ‘burned’ into the chips


Can sometimes be reprogrammed (PROMs) and sometimes
we have Erasable Programmable Read Only Memories
(EPROMs) (Need special equipment)


ROM chips

are often embedded into the
main circuit board

to provide the preliminary instructions when the computer is
initially turned on.

18
/73

Other Memory Devices


Additional memory devices include CD
-
ROM, CD
-
Recordable (CD
-
R) drives, CD Rewritable (CD
-
RW) discs, DVD devices, jump drives, ….


(Know the differences)


The speed of a CD drive is expressed in multiples of X,
which represents a data transfer speed of 153,600
bytes per second.


Due to improvements in technology, storage
capacity approximately doubles every 18 months.

19
/73

Central Processing Unit



The ‘processor’ interprets and executes your
program’s instructions one at a time


sequentially.


Consists of the arithmetic and logic unit, the control
unit, and the registers (usually in the ALU and Control
Units)


Registers store bits (16
-
bit registers; 32
-
bit registers, …)


Control Unit

dissects the instruction and directs the
ALU

to perform the calculations / comparisons using
the registers.


CPU has other registers too:


Instruction register; program counter, more

20
/73

CPU
-

more


The notion of a stored
-
program computer


a
von Neumann

machine


stored both program
instructions and data together in main memory.


Fetch
-
decode
-
execute cycle


Fetch instruction from primary memory (RAM)


Decode instruction (to see what it is to be done)


Execute the instruction using registers


Repeat

21
/73

CPU
-

more


CPU on a chip called a microprocessor


Circuit board also contains communications sockets,
etc. for connection with video displays, etc.


Main circuit board also contains the system clock
which pulses.


Instructions are in synch with these pulses


Some take a single pulse; others, more.


Often called clock speed.


All activities in a computer and controlled by the clock
with something we call ‘clock cycles.’


We may say that an instruction executes in two clock cycles.

22
/73

3. Networks


A
network
is two or more computers connected
together to exchange information.


Each computer of a network has a
network address
.


One technique to improve network speed is to divide
large messages into segments, called
packets
.


Packets have fixed formats and other constraints…


Then send the individual packets across the network
intermixed
with pieces of other messages sent by other users.

23
/73

Local Area Networks and

Wide Area Networks


A
Local
-
Area Network (LAN)

is designed to span
short distances

and connect a relatively small
number of computers.


Within a building or small area


You may connect to the LAN here in this classroom and see
these slides/ take notes on them, etc.


A
Wide
-
Area Network (WAN)

connects two or more
LANs, often across long distances.


LANs connected by a WAN are often owned by different
companies or organizations, and might be located in
different countries.


Generally, one computer takes care of communications.

24
/73

The Internet


The
Internet

is a network

of networks.


Grew out of U.S Government ARPA (and ARPAnet)


In 2000, number of computers connected to Internet = 10 million.


A
protocol

is a set of rules that governs how two things
communicate.


The software that controls the movement of messages across the
Internet must conform to a set of protocols called
TCP/IP

for
Transmission Control Protocol/Internet Protocol.


IP defines how information is formatted and transferred


TCP software handles the transmission and reconstituting of
messages, error control, etc. (contention, …)


Have layers of communications and different protocols…


Every computer

connected to the Internet has an
IP

address

that
uniquely

identifies it among all other computers on the
Internet.

25
/73

IP Address vs Internet Address


An IP address is of the form 204.192.116.2.


Fortunately, Internet allows each computer to be
given a

unique name

-

often referred to as its
Internet Address
.


The
first part

of an Internet Address is the
local name

of a specific
computer.


The
rest of the name

is the
domain name
.


Ours is:
osprey.unf.edu
.


Osprey

is local name


unf.edu
is the
domain name
.


Can have ‘subdomains’ within domain for departments, etc.


Last part

of domain name is the ‘top level domain name’.


Some are: .edu .com, .org, .mil …

26
/73

The Domain Name System


The Internet uses
another software program
,
the
Domain Name System

(
DNS
) to
translate

an
Internet Name

(
osprey.unf.edu
) to a
corresponding
IP Address

(139.62.37.20)
.


Each organization connected to the Internet
operates a
domain server

that maintains a list of all
its computers and their IP addresses.


Used for mapping.

27
/73

The World Wide Web


The
World Wide Web

(also known as WWW or the
Web) makes the exchange of information easy.


Web software provides a
common interface

through which
many different types of information can be accessed with a
mouse click.


Web: based on concepts of
hypertext

&
hypermedia
.


Hypertext


based on
links

to support jumping as needed.

To
manage large amounts of information. Basically used to originally
link ‘documents.’


Hypermedia

incorporates graphics, sound, animations, and video.

28
/73

Hypertext and Browsers


Web Server: computer dedicated to
providing access to Web documents.


Web documents are written in a variety of
languages now. Originally, there was just
html. Now there are many with many
variations…


Browsers load / interpret documents provided
by a Web server.


Many documents are formatted using the
HyperText Markup Language

(
HTML
).


Links to Java programs can be embedded in html
documents and executed through Web browsers.

29
/73

Uniform Resource Locators


Information on the Web is found by identifying a
Uniform
Resource Locator

(
URL
)


A
URL

uniquely specifies
documents

and
other information

for a
browser to obtain and display.


An example URL is
http://www.unf.edu


We sometimes now just say, web address…


URL:


First piece

of URL is the
protocol

(
HyperText Transfer Protocol



HTTP

in this example) which determines the way the browser
should communicate.


The
second piece

is the
Internet address

of the machine on which
the document is stored.


A typical
third piece

of information is the
file name

of the file you
wish to view.


Default third piece: index.html

30
/73

Another Sample URL


http://www.unf.edu/~broggio/Fall2009.html


In this URL, the protocol is http (HyperText Transfer Protocol).


Machine referenced is
www

(web server found at
unf.edu
)


Information is stored in a ‘file’ in my home directory named
Fall2009.html (programmed in html)


www.unf.edu/~broggio

by itself, refers to an index.html file stored in a
directory, broggio, within some UNF web server


The
Internet

vs the
World Wide Web


The
Internet

makes it possible to communicate via computers
around the world.


Internet IS a
network
;
Communications



The
Web
makes that communication a straightforward and
enjoyable activity via software.


The
Web

can be used on a LAN or even a single machine that is not connected to any
network.


Information service based on a set of software applications

31
/73

The Internet


A global
network

connecting millions of
computers
.
Hundreds of countries are linked into exchanges of
data
,
news and opinions.


Unlike
online services
, which are centrally controlled, the
Internet is
decentralized

by design.


Each Internet computer, called a
host
, is independent. Its
operators can choose which Internet services to use and which
local

services

to make available to the global Internet community.


Remarkably, this anarchy by design works exceedingly well.


There are a variety of ways to
access

the Internet. Most
online services offer access to some
Internet services
.


Internet Service Providers (ISP): Comcast, AOL, etc.


The
Internet

is
not

synonymous

with
World Wide Web
.

32
/73

World Wide Web

A
system

of
Internet

servers

that
support

specially

formatted

documents
.


The documents are formatted in a markup language
called
HTML

(
HyperText Markup Language
) and a host
of other languages that support links to other documents,
as well as
graphics
, audio, and video
files
.


This means you can jump from one document to another
simply by
clicking

on
hot spots
. Not all
Internet servers

are part of the World Wide Web.


There are several
applications

called
Web browsers

that
make it easy to
access

the World Wide Web; Four of the
most popular being
Netscape Navigator
,
Microsoft's
Internet Explorer
,
Mozilla

Firefox
,
Safari
, and others.


World Wide Web

is
not

synonymous with
the Internet
.

33
/73

Programming


The rest of this course explores the process
of designing and developing programs using
an object
-
oriented language. Ours is Java.


All of the software we have discussed including
the Internet and Web protocols are simply (but not
simple) programs some programmer has written.


Next section discusses the purpose of
programming in general and introduces the
Java Programming Language
.