CSC204 – Programming I

Download Report

Transcript CSC204 – Programming I

CSC204 – Programming I
Lecture 1
August 23, 2006
Today’s Topics




Syllabus – an introduction to the course
Roster – introduce yourself to the class
Get started- an intro to programming
[next time – an intro to OOP with Java]
8/23/2006
CSC 204 Programming I
2
About The Course

Instructor
Martin Q. Zhao, Ph.D.
201 B Computer Science Building
Phone: 301-2425
Email: [email protected]

Text
Java Program Design 5.0
by Cohoon & Davidson
Just Enough UNIX
by Andersen
8/23/2006
CSC 204 Programming I
3
Course Description


Learn how to program in Java
Structured & object-oriented programming






basic syntax and semantics
simple data types and control structures
classes and objects
arrays
and graphics
Learn how to analysis, design, implement, test
and debug programs
8/23/2006
CSC 204 Programming I
4
Other Elements (for assessment purposes)

Computer Ethics




A book will be loaned to you
A class session and one lab will be used
Test questions in the third mid term and the
final exam
AP A test

8/23/2006
Used as bonus points (up to 20)
CSC 204 Programming I
5
Grade Breakdown
One hour exams
(3 at 100 points each)
300 points
Comprehensive Final exam
200 points
Homework assignments
(10 at 10 points each)
100 points
Programming assignments
(6 total)
240 points
Lab assignments (14 total)
140 points
Maintain course portfolio
Total
8/23/2006
20 points
1000 points
CSC 204 Programming I
6
Grading Policy
8/23/2006
900 or higher
A
870-899
B+
800-869
B
770-799
C+
700-769
C
600-699
D
Lower than 600
F
CSC 204 Programming I
7
Chapter 1
Getting Started
What is Computer Science?

Is computer science the science of
computers?



Not exactly. It is the science of information
processes and their interactions with the
world.
It is the systematic study of algorithmic
processes that describe and transform
information: their theory, design, efficiency,
implementation, and application.
What is the main concern of computing?

8/23/2006
What can be (efficiently) automated?
CSC 204 Programming I
9
Areas of Computer Science
algorithm and data structure
 programming languages
 computer architecture
 operating systems
 software engineering
 data and knowledge base systems
 artificial intelligence and robotics
 human-computer interface

8/23/2006
CSC 204 Programming I
10
Automation Starts from Programs

What is a program?
public class AutomatedProcess {
public static void main(String[] args) {
System.out.println("Step #1");
System.out.println("Step #2");
System.out.println("Step #3");
}
}

How can the instructions defined in a
program be executed?
8/23/2006
CSC 204 Programming I
11
Computer Architecture – a simplified view
printer
processor
display
0
1
2
3
4
5
4194300
4194301
4194302
4194303
memory
keyboard
8/23/2006
disk
CSC 204 Programming I
12
Number Representation & More

Decimal or binary representation?



What does computers use and why?
Examples:
4,506
1101
Bit and byte


What is the largest number that can be represented
with a byte?
Units of measure


8/23/2006
Time:
File size:
ms, ns
KB, MB, GB, TB
CSC 204 Programming I
13
Software & Hardware



8/23/2006
CSC 204 Programming I
Machine
language
Assembly
language
High-level
language
14
Additional Background Info
8/23/2006
CSC 204 Programming I
15
History of Java






Java’s predecessor was Oak, a language designed
by James Gosling at Sun Microsystems.
Oak was given the more-marketable name “Java”
in January 1995.
Java was officially announced in May 1995.
The first official release of Java occurred in
February 1996, when Sun made available version
1.0 of the Java Development Kit.
Java 1.2 (released by the end of 98) and higher
is referred to as Java 2.
The latest Java version is 1.5, also known as Java
5.
8/23/2006
CSC 204 Programming I
16
Why Java?
 Simple
 Object-oriented
 Platform independent
“Write once, runs everywhere!”
 Built-in security
 Distributed
 Interpreted
 J2SE, J2EE, and J2ME targeted for various
development needs
 It’s free
8/23/2006
CSC 204 Programming I
17
Interesting Links about Java

General reading
http://java.sun.com/nav/whatis/index.html (A quick guide to
the Java technology)
http://www.zdnet.com/eweek/stories/general/0,11011,28049
67,00.html (Study: Java to overtake C/C++ in 2002)

For those who have programming experience
http://java.sun.com/docs/books/tutorial/

Java API
http://java.sun.com/j2se/1.5/docs/api/
8/23/2006
CSC 204 Programming I
18
What Do Computers Do?

A computer system is an integrated collection
of hardware and software components.

Hardware refers to the electronics inside a
computer.
Software consists of programs that tell the
hardware what to do.

8/23/2006
CSC 204 Programming I
19
Types of Computer Systems




Some computer systems are embedded within
other objects. These are called embedded
systems.
Other computer systems are intended for direct
use by humans (users).
Some systems support multiple simultaneous
users, while others are limited to one user at a
time.
Systems in the latter category are usually called
personal computers, although high-end singleuser systems are often called workstations.
8/23/2006
CSC 204 Programming I
20
Hardware

Processors



Memory




Central processing unit, or CPU
Specialized processors, such as a graphics processor
Main memory, or RAM (random-access memory)
ROM (read-only memory)
Hard disks, floppy disks, and other storage media
Peripheral devices


8/23/2006
Provide an interface to the world outside the system
Include keyboards, mice, monitors, printers, and
modems
CSC 204 Programming I
21
Software



Software consists of programs that instruct the
hardware how to perform operations.
A program is a step-by-step set of instructions.
Categories of software:


Operating systems. A collection of programs that
interact directly with the computer’s hardware.
Applications. Programs designed to perform useful
tasks for humans.


We are writing this kind of programs.
An operating system serves as a bridge between
hardware and applications.
8/23/2006
CSC 204 Programming I
22
Platforms



The combination of an operating system and a
particular type of CPU is often called a platform.
Software usually works only on a single platform.
Java programs, however, will run on multiple
platforms without change.



This is usually referred to as good portability.
Most of the time, a computer system has only
one operating system but many applications.
Applications are usually designed for one
particular version of an operating system.
8/23/2006
CSC 204 Programming I
23
File Systems
A file is a collection of related data.
 In many operating systems, a file name
includes an extension that indicates the
type of data stored in the file.
 Common Windows file extensions:

.exe (executable program)
.doc (document)
.gif, .jpg (image)
8/23/2006
CSC 204 Programming I
24
File Operations

Basic file operations:




Create, Edit, Copy, Rename, Delete
A file can be created or edited by using an
editor or word processor.
An editor is a program that can create or
modify a file containing text (ordinary
characters).
A word processor has the added ability to
format text.

8/23/2006
It is usually not used in our class, except you want
to make your homework more impressive.
CSC 204 Programming I
25
Directories

A directory is a place where files can be
kept.

Directories are also known as folders.
Directories are normally organized in a
tree-like fashion.
 Basic directory operations:




8/23/2006
Create a directory
Move from one directory to another
List the files in a directory
CSC 204 Programming I
26