DOC PREVIEW
UMD CMSC 131 - Lecture 2: Programming

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 2 Programming Last time 1 Course information 2 Computer basics Today 1 Programming languages 2 Eclipse and CVS 9 1 2006 CMSC 131 Fall 2006 Rance Cleaveland 2006 Univeristy of Maryland Programming Languages Used to write programs that run on computers Generations of programming languages 1st 1GL 2nd 2GL 3rd 3GL 4th 4GL 5th 5GL machine code assembly code procedural languages application specific languages constraint languages CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 1 1st Generation Machine Code Recall computer data is 0 s and 1 s In machine code so are programs Program sequence of instructions Machine code instructions consist of 0 s and 1 s Next slide example machine code instruction from MIPS Microprocessor without interlocked pipeline stages architecture Popular in mid late 90s Instructions are 4 bytes long CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 2 Example MIPS Instruction Add data in addresses 1 2 store result in address 6 00000000001000100011000000100000 000000 00001 00010 00110 00000 100000 opcode 1st address 2nd address shift amount destination address CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland function specifier 3 Programming in 1GLs Courtesy of Microsoft Encarta Encyclopedia Online Copyright c Microsoft Encarta Online CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 4 2nd Generation Assembly Problem with 1GLs Who can remember those opcodes addresses etc as 0 s 1 s Solution 1950s assembly language Use mnemonics descriptive character strings for opcodes Let programmers give descriptive names to addresses MIPS example revisited add 1 2 6 instead of 00000000001000100011000000100000 for add contents of addresses 1 2 store result in 6 CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 5 Assemblers Computers still only work on machine code 1GL Assembly language is not machine code Assemblers are programs that convert assembly language to machine code object code asm assembler CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland obj 6 3rd Generation Procedural Languages Problems with 2GLs Platform dependency Different kinds architectures of computers use different instruction formats E g x86 Pentium 68K MIPS SPARC etc 1GL 2GL programs written for one kind of machine will not work on another Low level programs difficult to understand Solution 60s now procedural languages Higher level universal constructs Examples Fortran Algol Pascal C C Java C CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 7 Compilers Computers can only execute machine code Compilers are programs for translating 3GL programs source code into assembler machine code source compiler CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland asm 8 Interpeters 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 Fall 2006 Rance Cleaveland 2006 University of Maryland 9 This Course How to write programs in procedural languages Language is Java Principles are broadly applicable CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 10 Tools for Writing Programs The bad old days Text editor used to create files of source code Compiler generate executables from source Debugger trace programs to locate errors Today IDEs interactive integrated development environment Text editor compiler debugger rolled in one Examples Eclipse Visual Studio etc CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 11 Basics of Eclipse www cs umd edu eclipse EclipseTutorial Eclipse is used to Create Edit Compile Run Debug programs for this class Java programs CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 12 Basics of Eclipse speak Project collection of related source files To create a program in Eclipse Create a new project Create files in the project Perspective framework for manipulating programs Important perspectives in this class Java for creating running programs Debug for tracing removing errors in programs CVS repository for interacting with assignment submission system CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 13 Eclipse Demo CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 14 Class Projects with CVS You will use Eclipse for Java programming in this course How will you obtain turn in class projects CVS Concurrent Versions System Tool for project file management Maintains versions etc Allows different sites to work on same project CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 15 CVS Worldview commit checkout Files local copies Files repository checkout Client 1 Server Files local copies commit CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland Client 2 16 CVS in More Detail CVS server maintains current versions of files in project repository To access files from another machine client repository must be checked out Changes to files on client may be committed to server with changed files becoming new version Once a repository is checked out by a client subsequent versions may be accessed via update CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 17 What s Needed for CVS Server machine For CMSC 131 CS linuxlab machines User authentication For CMSC 131 student linuxlab accounts CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 18 How CMSC Project Submission Works Repository created for each student linuxlab account You check out repository to start work on project When you save changes in Eclipse commit automatically invoked by plug ins You submit when finished using Eclipse UMD plug in handles relevant CVS commands CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 19 To Checkout a Project Set repository location 1 Change to CVS Repository Exploring perspective in Eclipse Window Open Perspective Right click in CVS Repositories panel and select New Repository Location CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 20 Adding a CVS Repository Common to everyone Your linuxlab username Your linuxlab password Don t forget to set this CMSC 131 Fall 2006 Rance Cleaveland 2006 University of Maryland 21 To Checkout a Project cont 2 3 Open repository name then Head Right click on project name to save CMSC


View Full Document

UMD CMSC 131 - Lecture 2: Programming

Documents in this Course
Set #3

Set #3

7 pages

Exam #1

Exam #1

6 pages

Exam #1

Exam #1

6 pages

Notes

Notes

124 pages

Notes

Notes

124 pages

Load more
Download Lecture 2: Programming
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture 2: Programming and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 2: Programming and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?