Presentation is loading. Please wait.

Presentation is loading. Please wait.

© Janice Regan, CMPT 102, Sept. 2006 0 CMPT 102 Introduction to Scientific Computer Programming Course Organization.

Similar presentations


Presentation on theme: "© Janice Regan, CMPT 102, Sept. 2006 0 CMPT 102 Introduction to Scientific Computer Programming Course Organization."— Presentation transcript:

1

2 © Janice Regan, CMPT 102, Sept. 2006 0 CMPT 102 Introduction to Scientific Computer Programming Course Organization

3 © Janice Regan, CMPT 102, Sept. 2006 1 CMPT 102: Introduction to Scientific Computer Programming  Monday, Wednesday, Friday 9:30-10:20  Textbook:  C Program Design for Engineers Authors: Jeri R. Hanly, Elliot B. Koffman  Additional References:  Engineering Problem Solving with C, 3 rd edition Author: Delores M. Etter  The C Programming Language Authors: B. W. Kernighan, D. M. Ritchie

4 © Janice Regan, CMPT 102, Sept. 2006 2 Class web-site  All the information discussed today and more can always be found on the class web-site  To find the class web site go to http://www.cs.sfu.ca/CourseCentral http://www.cs.sfu.ca/CourseCentral  Select Course Home pages  Select the Homepage for CMPT 102  Course Central is also a useful link to abundant information useful to students taking a computing science course

5 © Janice Regan, CMPT 102, Sept. 2006 3 http://www.cs.sfu.ca/CourseCentral

6 © Janice Regan, CMPT 102, Sept. 2006 4 Course selection page Click here to go to CMPT10 2 website

7 © Janice Regan, CMPT 102, Sept. 2006 5 CMPT 102 Website

8 © Janice Regan, CMPT 102, Sept. 2006 6 My availability

9 © Janice Regan, CMPT 102, Sept. 2006 7 Exams Dates, Course Evaluation

10 © Janice Regan, CMPT 102, Sept. 2006 8 Exams and Evaluation

11 © Janice Regan, CMPT 102, Sept. 2006 9 Evaluation  Assignments: 30%  Weekly Quizzes: 15%  No quiz in week of midterm, week of Thanksgiving or week of Remembrance day  Lab Problems: 5%  Practice Problems: no credit  Midterm Examination: 15%  Final Examination: 35%

12 © Janice Regan, CMPT 102, Sept. 2006 10 Assignments  Four assignments  Each assignment worth 7.5% of your course grade  Assignments are to be completed individually  Problems similar to the assignments will appear on the midterm and the final.  Help is available during weekly lab hours  Complete solutions will be posted

13 © Janice Regan, CMPT 102, Sept. 2006 11 Lab Problems  Four short lab problems  Each lab problem is worth 1.25% of your final grade  Practice Problems: no credit BUT valuable experience that will be useful when completing lab problems and assignments  There are no Labs in the first week of classes (Sept. 5-8)  Lab hours are not held on statutory holidays (Thanksgiving and Remembrance Day)  Weekly Quizzes: 15%  One question on material covered in labs Monday-Tuesday of the same week  Each quiz marked out of 17, worth 1.7% of the final grade  All quiz results will be included in your final grade  Midterm: 15%  Final: 35%

14 © Janice Regan, CMPT 102, Sept. 2006 12 Quizzes  During each Wednesday’s lecture, you will be asked to answer one question based on material covered in the lab exercises that week.  You will be asked to write a short concise paragraph of 10-15 sentences, explaining a concept or method, or a short piece of code.  You will be given 10-15 minutes to answer.  Your answer will be graded out of 17 (each quiz is worth 1.7% of your final grade)

15 © Janice Regan, CMPT 102, Sept. 2006 13 Midterm and Final  One 50 minute in class midterm  One 3 hour final examination  35% short answer problems  65% longer problems that utilize several important concepts and require integration of those concepts.  A sample exam, including solutions, will be posted two weeks before the midterm and two weeks before the final exam

16 © Janice Regan, CMPT 102, Sept. 2006 14 Assignments, Labs, Solutions

17 © Janice Regan, CMPT 102, Sept. 2006 15 Important Dates

18 © Janice Regan, CMPT 102, Sept. 2006 16 Assignments  At least two weeks before the due date the assignment will be posted on the website  Assignments must be completed individually  Assignments will require you to combine and use many concepts and tools you have learned  Assignments will be much more demanding than lab problems or practice problems  Complete solutions to all assignments will be posted  Information of proper preparation of assignments and lab problems is available on the class website.

19 © Janice Regan, CMPT 102, Sept. 2006 17 Labs  On or before Friday of each week problems will be posted for the next week. These problems will be identified as  Lab Problems: To be completed individually or in a small group (up to four students) Submitted for grading  Practice Problems: A chance to use a new idea in a simple application, before you need to integrate multiple ideas into assignments. Collaboration is encouraged Not submitted for grading  Complete solutions to all problems will be posted

20 © Janice Regan, CMPT 102, Sept. 2006 18 Grading Information  Assignments and Lab Problems should be:  submitted electronically using the submission server  submitted in hard copy to the 102 drop box  Bonus points (10%) are available for submitting assignments more than 72 hours early  No late assignments or lab problems will be accepted  Unofficial grades will be available on GradeBook  Login: your SFU computer ID, your student number as password. Find link on Course Central

21 © Janice Regan, CMPT 102, Sept. 2006 19 Where to submit assignments: 1

22 © Janice Regan, CMPT 102, Sept. 2006 20 Where to submit assignments: 2 Submission drop boxes

23 © Janice Regan, CMPT 102, Sept. 2006 21 Required Readings, Notes

24 © Janice Regan, CMPT 102, Sept. 2006 22 Readings and Notes

25 © Janice Regan, CMPT 102, Sept. 2006 23 Academic Honesty

26 © Janice Regan, CMPT 102, Sept. 2006 24 Academic Honesty Read the policy

27 © Janice Regan, CMPT 102, Sept. 2006 25 Getting Started  If you have not already done so activate your SFU computing account (CCN, Campus Computing Network account.)  Use your own machine at home, or go to the assignment lab (AQ 3145)  Email regarding the class will be sent to your Campus Account, so check it regularly  Steps to activate your account …

28 © Janice Regan, CMPT 102, Sept. 2006 26 Activating your CCN account (1) Select mySFU

29 © Janice Regan, CMPT 102, Sept. 2006 27 Activating your CCN Account (2) Select Apply for ID, the follow the instructions. You will need your student ID and your TeleReg PIN

30 © Janice Regan, CMPT 102, Sept. 2006 28 Computing Science Instructional Labs (CSIL)  The CSIL LINUX lab is available for your use at all times beginning in the second week of classes. (ASB 9838)  At particular times the instructor and/or TA will be available in the lab to answer your questions.  Instructor: Mon. 1:30-3:00 PM, Tue: 9:00-10:30 AM  TA:Tue: 10:00 – 10:30 AM . TBA

31 © Janice Regan, CMPT 102, Sept. 2006 29 Finding CSIL labs: 1

32 © Janice Regan, CMPT 102, Sept. 2006 30 Finding CSIL labs: 2 CSIL Labs

33 © Janice Regan, CMPT 102, Sept. 2006 31 Access to CSIL  CSIL is protected by a security card access system  As a student in a computing science course you are eligible to have a security access card for CSIL  If you are pre-registered your access card may be picked up from the card office at traffic and security (there is a $15 refundable deposit and a $3 processing fee)

34 © Janice Regan, CMPT 102, Sept. 2006 32 CSIL Rules  Before you can use any of the computers in the CSIL you must sign and return an ethics form.  By signing the ethics form you indicate that you have read and agree to abide by the SFU and CSIL regulations regarding use of computing resources and computer labs.  Links to these policies can be found on the class website or on Course Central  You can return your ethics forms during next class, or directly to the computing science main office.

35 © Janice Regan, CMPT 102, Sept. 2006 33 http://www.cs.sfu.ca/CourseCentral Select to reach Policies

36 © Janice Regan, CMPT 102, Sept. 2006 34 CSIL page IMPORTANT Read the Policies Before Signing Your Ethics form

37 © Janice Regan, CMPT 102, Sept. 2006 35 Getting Started in CSIL  Before you try programming in CSIL read the information provided for you  Read the general information pages  Browse the FAQs,  Now you are ready to start  Your CSIL computer ID and password and the ID an password you use for your SFU email account.

38 © Janice Regan, CMPT 102, Sept. 2006 36 CSIL page Read the general information Browse The FAQs

39 © Janice Regan, CMPT 102, Sept. 2006 37 Labs and using CSIL  The computers in CSIL are available 24/7  At some times your instructor or TA will be available to answer questions  At some times OPEN LAB TA’s will be available to answer questions.  A list of TA’s presently in the lab will be posted on the white board in CSIL.

40 © Janice Regan, CMPT 102, Sept. 2006 38 Optional Lab Hours  Attendance at optional Lab hours is strongly encouraged  Lab Hours are held in the LINUX area of CSIL labs  Lab Hours provide an opportunity to work with others sharing knowledge and experience.  Lab Hours give you an opportunity to ask the instructor or TA one on one questions about problems and assignments.  Lab Hours help you learn the required concepts one by one and allow you to ask questions to assure you understand each one.

41 © Janice Regan, CMPT 102, Sept. 2006 39 Operating System  In the CSIL labs you will be using computers that run the LINUX operating system  In the first optional lab hours there will be tutorials on how to use the LINUX operating system (1 per hour)  The tutorial will also be posted so you can try it yourself at another time

42 © Janice Regan, CMPT 102, Sept. 2006 40 Reading Assignment  Visit and read the information on the class website  Be sure you can find  Posted notes  Reading assignments for each lecture  Assignment due dates  Instructions on using the CSIL labs  Instructions on using your own computer for assignments  Have any questions ready for next lecture

43 © Janice Regan, CMPT 102, Sept. 2006 41 CMPT 102 Introduction to Scientific Computer Programming Chapter 1: Computer Components

44 © Janice Regan, CMPT 102, Sept. 2006 42 Hardware and Software  A computer is a machine designed to perform operations specified with a set of instructions called a program.  Hardware refers to the computer equipment.  keyboard, mouse, terminal, hard disk, printer, CPA  Software refers to the programs that describe the steps we want the computer to perform.

45 © Janice Regan, CMPT 102, Sept. 2006 43 CPU Computer Hardware  CPU –  Central processing unit  ALU –  Arithmetic and logic unit  ROM –  Read only memory  RAM –  Random access memory Internal Memory External Memory InputOutput Processor ALU Cache/ Memory

46 © Janice Regan, CMPT 102, Sept. 2006 44 Software: Operating System  A system of computer programs that control the interaction of the user and the computer hardware. Examples: Linux, Windows, QNX,…  Purposes of the operating system  Controls communication between input and output hardware and each process running in the computer.  Directs and orders all operations of the computer  Allocates and shares resources (memory,processor…)  Controls access to resources and data (security)  Provides a user interface (UI) and/or graphical user interface (GUI)  Stores and accesses data and applications

47 © Janice Regan, CMPT 102, Sept. 2006 45 Example: Command Line UI  Windows Command Prompt

48 © Janice Regan, CMPT 102, Sept. 2006 46 Example: Graphical UI (GUI)  Windows explorer

49 © Janice Regan, CMPT 102, Sept. 2006 47 Computer Software: Applications  Application Software (Software Tools)  Word processors (Microsoft Word, WordPerfect,...)  Spreadsheet programs (Excel, Lotus1-2-3,...)  Computer games  Communication software (email, chat, web browser…)  Telecommunication software (VOIP, …)

50 © Janice Regan, CMPT 102, Sept. 2006 48 Computer Software: Languages  Some Computer Languages  Machine language (machine instruction set)  assembly language  high level languages C, C++, Ada, Fortran, Basic, Java Do YOU know of any others? mathematical computation tools (MATLAB, Mathematica,...)  Application software is written using computer languages.

51 © Janice Regan, CMPT 102, Sept. 2006 49 Machine language  Each type of processor (like Pentium 4, Athalon, Z80, …) has its own instruction set  Each instruction in an instruction set does a single thing like access a piece of data, add two pieces of data, compare two pieces of data …  Each instruction is represented by a unique number This # may be different for different instruction sets, but no two instructions in the same instruction set will have the same #

52 © Janice Regan, CMPT 102, Sept. 2006 50 Machine Language programs  In machine language a program is a list of instructions  Each instruction is represented by a number  Inside the memory of the computer each number is represented in binary (as a constant length string of 1’s and 0’s)  The long string of 0’s and 1’s is easy for the computer to understand and very difficult for a Human to read or write

53 © Janice Regan, CMPT 102, Sept. 2006 51 Assembler  Assembler languages make it easier for the programmer.  Assembler is easier for humans to read/write  The numbers that identify each of the instructions in the instruction set are replaced with mnemonics like ADD, CMP, …  The code, written using these mnemonics is written into a text file.

54 © Janice Regan, CMPT 102, Sept. 2006 52 Assembler Programs  The code for an Assembler program is written into a text file.  The computer read 1’s and 0’s not text  How do we translate to machine readable form?  A computer program called a compiler is used to translate the text file (called a source file) containing the assembler code into machine readable code  The compiler writes a binary file containing the machine readable code (called an object file)

55 © Janice Regan, CMPT 102, Sept. 2006 53 Programs in High Level Languages  Assembler is easier to read/write than machine language. It is still very cumbersome  High level languages are easier to write than assembler  The compiler is more complex, but that is a tool you use, not one you write  In this course we will learn the language C  The rest of today's discussion is equally applicable to C or to any other compiled language (C++, Fortran, …)

56 © Janice Regan, CMPT 102, Sept. 2006 54 Writing your program Editor, Type in your program Source File Text saved on hard disk Compiler Translate text into Machine Readable code

57 © Janice Regan, CMPT 102, Sept. 2006 55 Source files  Contains the text you type into a text editor  The text is a program  The program is a list of instructions written in a special Human readable language (C)  The program can be translated, from the Human readable language (in source file) to a machine readable language (in object file), by a compiler  A compiler is a special piece of software used to translate from source files to object files

58 © Janice Regan, CMPT 102, Sept. 2006 56 Source files  Source File:  Write using a text editor like Kate  Do not write your code using a word processor like Microsoft Word. A word processor will save in a special format.  The compiler reads only text, not special formats.  Beware: your text does not differentiate between a word processor and an editor

59 © Janice Regan, CMPT 102, Sept. 2006 57 Perfect Code? Finding Errors 1  It is highly unlikely than any of us will always write perfect code that contains no errors  How do we find errors?  Are there different kinds of errors? Yes  A computer program can contain syntax errors. semantic errors, or logical errors  When and how can we detect and correct errors?  Compile errors  Link errors  Run Time Errors

60 © Janice Regan, CMPT 102, Sept. 2006 58 Syntax Errors  A computer program can contain syntax errors  A computer language follows simple rules  how words and punctuation of different types may be combined.  In English syntax is similar to grammatical structure  The compiler for a high level language can detect errors that break those simple of syntax (syntax errors)  Syntax Errors are usually detected at compile time

61 © Janice Regan, CMPT 102, Sept. 2006 59 Semantic Errors  A computer program can contain semantic errors  Semantics relates to the meaning of the words in a sentence or a computer language command  Just like a grammatically correct English sentence can be nonsense, a syntactically correct high level computer language command can also contain semantic errors  Some semantic errors may be found by the compiler, some will be found when the program is linked, some may be found at run time

62 © Janice Regan, CMPT 102, Sept. 2006 60 Logical Errors  When your program completes but gives an unexpected answer it usually means there is a error in the logic in your solution of the problem  Logic errors can also cause a program to fail part way through execution

63 © Janice Regan, CMPT 102, Sept. 2006 61 Writing your program Editor, Type in your program Source File Compiler Translation to Machine code Syntax or Semantic Errors, Compiler Generates error Messages. To help us find and Correct errors in the Source File Object File Binary, machine readable file Syntactically Correct code Code with syntax Or semantic errors Editor, Correct Syntax Errors

64 © Janice Regan, CMPT 102, Sept. 2006 62 Perfect Code? Finding Errors 2  If your code contains compile time errors is it correct? NOT NECESSARILY  How do we find the remaining errors?  Use a tool that does more checks than the compiler (splint).  Move on to linking the code to libraries etc.  The linker resolves references, words in your program than are defined elsewhere  Errors occur when the definitions cannot be found  Errors occur when the use of the word does not correspond to the definition

65 © Janice Regan, CMPT 102, Sept. 2006 63 Linking your program Editor, Enter program Source File (Text) Compile Find Syntax and SemanticErrors Object File (binary) Correct Errors Linker Resolves References among object files Other Object Files Libraries … Executable File (load module) (binary) Semantic Errors Reported: Finds words with no defined meaning. Code has linker errors

66 © Janice Regan, CMPT 102, Sept. 2006 64 Perfect Code? Finding Errors 3  If your code compiles and contains no errors that can be found by the linker (or splint) is it correct? NOT NECESSARILY  How do we find the remaining logic and semantic errors?  When you run your executable program  it may not complete (may or may not generate error message)  It may complete and give the wrong answer

67 © Janice Regan, CMPT 102, Sept. 2006 65 Loading/Running your program Editor, Enter program Source File (Text) Compile Find Syntax and some SemanticErrors Object File (binary) Correct Errors Linker Resolves References Other Object Files Executable File (binary) Link Errors Reported: Loader Copies Executable And Runs Input data output results CPU

68 © Janice Regan, CMPT 102, Sept. 2006 66 Summary: Executing a Computer Program  Compiler  Converts a source file (containing your human readable program in C) to and object file (computer readable binary file)  Linker  Converts object program to executable program CompileLink/loadExecute C language Program in Text file (source file) Machine language Program In binary file (object file) Program output Input data Other object files

69 © Janice Regan, CMPT 102, Sept. 2006 67 Summary: Types of Errors  Syntax errors  Errors in syntax, how words are combined and used reported by the compiler or splint  Semantic errors  Errors in the meaning of words, Reported by the linker (linker errors) Reported by the compiler (compile time errors) Found at execution time (run-time errors)  Logic errors Errors causing the incorrect results, not reported Errors causing program failure (run-time errors)


Download ppt "© Janice Regan, CMPT 102, Sept. 2006 0 CMPT 102 Introduction to Scientific Computer Programming Course Organization."

Similar presentations


Ads by Google