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
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
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
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
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
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
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
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:

9/1/2006 CMSC 131 Fall 2006Rance Cleaveland©2006 Univeristy of MarylandLecture 2: ProgrammingLast time:1. Course information2. Computer basicsToday:1. Programming languages2. Eclipse and CVSCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland1Programming Languages Used to write programs that run on computers Generations of programming languages 1st(1GL): machine code 2nd(2GL): assembly code 3rd(3GL): procedural languages 4th(4GL): application-specific languages 5th(5GL): constraint languagesCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland21stGeneration: 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 longCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland3Example MIPS Instruction “Add data in addresses 1, 2, store result in address 6”:00000000001000100011000000100000 ???000000 00001 00010 00110 00000 100000opcode1staddress2ndaddressdestination addressshift amountfunction specifierCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland4Programming in 1GLsCourtesy of Microsoft Encarta Encyclopedia Online. Copyright (c) Microsoft Encarta OnlineCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland52ndGeneration: 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, $6instead of00000000001000100011000000100000for “add contents of addresses 1, 2, store result in 6”CMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland6Assemblers 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”)asmassemblerobjCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland73rdGeneration: Procedural LanguagesProblems with 2GLs Platform dependency Different kinds (architectures) of computers use different instruction formatsE.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 2006Rance Cleaveland©2006 University of Maryland8Compilers Computers can only execute machine code Compilers are programs for translating 3GL programs (“source code”) into assembler / machine codesourcecompilerasmCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland9Interpeters 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 inspectedCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland10This CourseHow to write programs in procedural languages Language is Java Principles are broadly applicableCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland11Tools 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 2006Rance Cleaveland©2006 University of Maryland12Basics of Eclipse www.cs.umd.edu/eclipse/EclipseTutorial/ Eclipse is used to: Create Edit Compile Run Debugprograms (for this class, Java programs).CMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland13Basics of Eclipse-speak Project: collection of related source filesTo 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 systemCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland14Eclipse DemoCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland15Class Projects with CVS You will use Eclipse for Java programming in this course How will you: obtain turn inclass projects? CVS (= Concurrent Versions System) Tool for project-file management Maintains versions, etc. Allows different sites to work on same projectCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland16CVS WorldviewFiles =“repository”ServerFiles(local copies)Client 1Files(local copies)Client 2“checkout”“checkout”“commit”“commit”CMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland17CVS 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 2006Rance Cleaveland©2006 University of Maryland18What’s Needed for CVS? Server machineFor CMSC 131, CS linuxlab machines User authenticationFor CMSC 131, student linuxlab accountsCMSC 131 Fall 2006Rance Cleaveland©2006 University of Maryland19How CMSC Project Submission WorksRepository created for each student linuxlabaccount 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 2006Rance Cleaveland©2006 University of Maryland20To Checkout a Project1. Set


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 2 2 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?