









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










CMSC 131 Spring 2009 Jan Plane (adapted from Bonnie Dorr)
CMSC 131 Spring 2009 1 Jan Plane (adapted from Bonnie Dorr)
CMSC 131 Spring 2009 2 Jan Plane (adapted from Bonnie Dorr)
What Is This Course?
it doesn’t work to cram for these exams ask questions as soon as you realize you are confused
CMSC 131 Spring 2009 3 Jan Plane (adapted from Bonnie Dorr)
Textbooks & Course Web-Page
http://www.cs.umd.edu/class/spring2009/cmsc131/
Check daily!
Review:
CMSC 131 Spring 2009 6 Jan Plane (adapted from Bonnie Dorr)
Basics of Eclipse
http://www.cs.umd.edu/eclipse/EclipseTutorial/
Eclipse is used to:
Create
Edit
Compile
Run
Debug
programs (for this class, Java programs).
CMSC 131 Spring 2009 7 Jan Plane (adapted from Bonnie Dorr)
Basics of Eclipse-speak
Project : collection of related source files
Create a new project Create files in the project
Perspective : framework for viewing and/or manipulating programs
Java : for creating, running programs Debug: for tracing, removing errors in programs CVS repository : for interacting with assignment-submission system
Workspace: Where your files are stored locally
Buffer: Window where editing takes place
Demo
CMSC 131 Spring 2009 8 Jan Plane (adapted from Bonnie Dorr)
Class Projects with CVS
You will use Eclipse for Java programming in this
course
How will you:
CVS (= Concurrent Versions System)
CMSC 131 Spring 2009 9 Jan Plane (adapted from Bonnie Dorr)
CVS Worldview
Files in “repository”
Server
Files (local copies)
Client 1
Files (local copies)
Client 2
“checkout”
“checkout”
“commit”
“commit”
Demo
Making a new Repository Location
Checking Out a project
Making changes to that project
Committing the project
Program execution
Submitting the project
Looking at the runtime results
CMSC 131 Spring 2009 12 Jan Plane (adapted from Bonnie Dorr)
CMSC 131 Spring 2009 13 Jan Plane (adapted from Bonnie Dorr)
Adding a CVS Repository
Common to everyone
Your linuxlab username
Your linuxlab password
Don’t forget to set this!
CMSC 131 Spring 2009 14 Jan Plane (adapted from Bonnie Dorr)
Working on Project
You do not have this project showing in the Java
perspective.
You go to the CVS perspective and check it out.
When you switch back to “Java” perspective,
your project is now there!
Make sure you are in the Java perspective to
edit
When you save in “Java” perspective, changes
are automatically committed to CVS repository.
CMSC 131 Spring 2009 15 Jan Plane (adapted from Bonnie Dorr)
Submitting the Project
Edit the file
Make sure it runs correctly
Submit the project for grading
Go to submit.cs.umd.edu to see test results
CMSC 131 Spring 2009 18 Jan Plane (adapted from Bonnie Dorr)
Main Memory
Address Byte value
1
2
3
4
1 0 0 1 1 1 0 1
0 0 0 1 1 0 0 1
1 1 1 1 1 1 0 1
1 1 0 0 0 1 0 0
CMSC 131 Spring 2009 19 Jan Plane (adapted from Bonnie Dorr)
How Many Different Values in
a…
Bit?
2
Two bits?
4 = 2 x 2
Byte?
256 = 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 2^8
Word?
4,294,967,296 = 2^32
CMSC 131 Spring 2009 20 Jan Plane (adapted from Bonnie Dorr)
Other Standard Terminology
1 KB = 1 “kilobyte” = 2^10 bytes = 1,024 bytes
1 MB = 1 “megabyte” = 2^10 KB = 1,024 KB
1 GB = 1 “gigabyte” = 2^10 MB = 1,024 MB
CMSC 131 Spring 2009 21 Jan Plane (adapted from Bonnie Dorr)
How Are Characters, Etc.,
Represented?
Via encoding schemes
Example: ASCII (American Standard Code for
Information Interchange)
There are other character encoding schemes also:
Shift-JIS, Unicode, etc.
CMSC 131 Spring 2009 24 Jan Plane (adapted from Bonnie Dorr)
Programming Languages
Used to write programs that run on
computers
Generations of programming languages
1 st^ (1GL): machine code
2 nd^ (2GL): assembly code
3 rd^ (3GL): procedural languages
4 th^ (4GL): application-specific languages
5 th^ (5GL): constraint languages
CMSC 131 Spring 2009 25 Jan Plane (adapted from Bonnie Dorr)
1
st Generation: Machine Code
Recall: computer data is 0’s and 1’s.
In machine code, so are programs!
Next slide: example machine code instruction from
MIPS (= “Microprocessor without interlocked pipeline stages”) architecture
CMSC 131 Spring 2009 26 Jan Plane (adapted from Bonnie Dorr)
Example MIPS Instruction
“Add data in addresses 1, 2, store result in
address 6”:
00000000001000100011000000100000
???
000000 00001 00010 00110 00000 100000
opcode
1 st^ address
2 nd^ address
destination address
shift amount
function specifier
CMSC 131 Spring 2009 27 Jan Plane (adapted from Bonnie Dorr)
Programming in 1GLs
Courtesy of Microsoft Encarta Encyclopedia Online. Copyright (c) Microsoft Encarta Online
CMSC 131 Spring 2009 30 Jan Plane (adapted from Bonnie Dorr)
3
rd Generation: Procedural
Languages
Problems with 2GLs
Solution (60s -- now): procedural languages
CMSC 131 Spring 2009 31 Jan Plane (adapted from Bonnie Dorr)
Compilers
Computers can only execute machine code
Compilers are programs for translating 3GL
programs (“source code”) into assembler / machine code
source (^) compiler asm
CMSC 131 Spring 2009 32 Jan Plane (adapted from Bonnie Dorr)
Interpreters
Another way to execute 3GL programs
Interpreters take source code as input
Interpreters execute source directly
Much slower than compiled programs
Debuggers are based on interpreters
Debuggers support step-by-step execution of source code
Internal behavior of program can be closely inspected
CMSC 131 Spring 2009 33 Jan Plane (adapted from Bonnie Dorr)
Object Oriented Terminology
have procedures that can be reused
centered on the objects