© janice regan, cmpt 128, sept 2007-2012 0 cmpt 128 introduction to computing science for...
TRANSCRIPT
© Janice Regan, CMPT 128, Sept 2007-2012 1
CMPT 128Introduction to Computing
Science for Engineering
Students
Course Organization
© Janice Regan, CMPT 128, Sept. 2007 -2012 2
CMPT 128: Introduction to Computing Science for Engineering Students
Monday, Wednesday, Friday D100: 12:30-13:20 D200: 15:30-16:20
Textbook: Problem Solving with C++, Walter Savitch, Addison-Wesley, 2012, 9th Edition
Additional References: The C++ Programming Language, third edition,
Bjarne Stroustrop, Addision Wesley, 1997: Not easy to read, but this is the definitive C++ reference.
© Janice Regan, CMPT 128, Sept. 2007 -2012 3
Class web-site All the information discussed today and more
can always be found on the class web-sitehttp://www.cs.sfu.ca/CourseCentral/128/jregan/
You have received an email containing this address
Course Central is also a useful link to abundant information useful to students taking a computing science course
Class web-site You can also find links to the class web-
site by going to
http://courses.cs.sfu.ca
More useful information for students can be found at
http://www.sfu.ca/computing/undergraduate/course-central.html
© Janice Regan, CMPT 128, Sept. 2007 -2012 4
© Janice Regan, CMPT 128, Sept. 2007 -2012 5
CMPT 128 Home Page
6© Janice Regan, CMPT 128, Sept. 2007 -2012
© Janice Regan, CMPT 128, Sept. 2007 -2012 7
Your Teaching Assistants
© Janice Regan, CMPT 128, Sept. 2007 -2012 8
CMPT 128 Website
© Janice Regan, CMPT 128, Sept. 2007 -2012 9
My availability
CMPT 128 Home Page
10© Janice Regan, CMPT 128, Sept. 2007 -2012
© Janice Regan, CMPT 128, Sept. 2007 -2012 11
Evaluation
Exceptions to Grading rules In order to obtain a clear pass (C- or
better) you MUST Have a combined score on the Lab Quizzes and
Midterm Quizzes (weighted as indicated on the previous slide) that exceeds 50% (36/72)
Have a combined score on lab reports and assignments (weighted as on the previous slide) that exceeds 50% (12/24)
© Janice Regan, CMPT 128, Sept. 2007 -2012 12
© Janice Regan, CMPT 128, Sept. 2007 -2012 13
Dates of Quizzes
© Janice Regan, CMPT 128, Sept. 2007 -201214
In lecture Midterm Quizzes Practice midterm quiz Sept. 29
Midterm quiz Oct. 17
TO RECEIVE A GRADE YOU MUST WRITE QUIZZES IN THE SECTION (LECTURE TIME) YOU OFFICIALLY REGISTERED IN
NO EXCEPTIONS
© Janice Regan, CMPT 128, Sept. 2007 -2012 15
In lab quizzes During two of your scheduled lab periods a lab
quiz will be given. You will be asked to answer one or two programming questions based on material covered in previous labs
You will be asked to write code that demonstrates your understanding of the concepts practiced in the preceding labs.
You will be given 100 minutes to write your code. Your answer will be graded out of 50
© Janice Regan, CMPT 128, Sept. 2007 -2012 16
Assignments Two assignments
Each assignment is worth 8% of your course grade
Problems similar to parts of the assignments may appear on the midterms and the final.
Assignments will combine many concepts learned in lectures and the labs
© Janice Regan, CMPT 128, Sept. 2007 -2012 17
Final Exam One 3 hour final examination 50% short answer problems 50% longer problems that utilize several
important concepts and require integration of those concepts. Will Include coding (written on paper)
A sample exam, including solutions, will be posted two weeks before the final exam
© Janice Regan, CMPT 128, Sept. 2007 -2012 18
Labs There will be no labs
In the first week of classes (Sept. 2-5) In the week of November 11
Each lab includes two lab problems For the first lab you will receive full points for successfully
submitting the lab solutions
For 2 labs you will submit a lab report that will be graded
Complete solutions of all labs will be posted. Lab report solutions will be posted
© Janice Regan, CMPT 128, Sept. 2007 -2012 19
Lab participation / attendance Lab participation points (you may earn >1.5%)
Participation in some labs, awarded by TA’s and instructor ( 0.38% good, 0.75% outstanding)
AEP 1%
Lab attendance points (you may earn > 1.5% ) Attendance in same labs Sign in at start of lab, Sign out at end of lab (0.38%
per lab)
Weeks when there are quizzes or midterms in the lab you will not be able to earn participation or attendance points
© Janice Regan, CMPT 128, Sept. 2007 -2012 20
Assignments, Labs, Solutions
© Janice Regan, CMPT 128, Sept. 2007 -2012 21
Important Dates
Return, Grading questions Marked work will be returned as soon as
possible (1-2 weeks from the due date of the work)
You must review your work and the grading when you received the marked work. You have 1 week from the return date to review and submit any questions about grading.
© Janice Regan, CMPT 128, Sept. 2007 -2012 22
© Janice Regan, CMPT 128, Sept. 2007 -2012 23
Assignments At least two weeks before the due date the
assignment will be posted on the website 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.
© Janice Regan, CMPT 128, Sept. 2007 -2012 24
Labs On or before Saturday of each week Lab
problems will be posted for the next week. Lab Problems are to be completed
individually or in a small group (up to five students in the same lab section) Collaboration within your groups is
encouraged Complete solutions to all problems will be
posted Lab reports should be written individually
© Janice Regan, CMPT 128, Sept. 2007 -2012 25
Grading Information Assignments and Lab Reports (and code)
should be: submitted electronically using the course
management system Bonus points (5%) are available for submitting
assignments or lab reports more than 48 hours early
No late assignments or lab problems will be accepted
Unofficial grades will be available on the course management system https://courses.cs.sfu.ca/
© Janice Regan, CMPT 128, Sept. 2007 -2012 26
Required Readings, Notes
© Janice Regan, CMPT 128, Sept. 2007 -2012 27
Readings and Notes
© Janice Regan, CMPT 128, Sept. 2007 -2012 28
Academic Honesty
© Janice Regan, CMPT 128, Sept. 2007 -2012 29
Academic HonestyRead the
policy
© Janice Regan, CMPT 128, Sept. 2007 -2012 30
Information about the class Be sure to check your SFU email account
regularly Email regarding the class will be sent to your
Campus mail Account, so check it regularly
© Janice Regan, CMPT 128, Sept. 2007 -2012 31
Computing Science Instructional Labs (CSIL) The CSIL is available for your use at all times
beginning in the second week of classes. Either ASB 9838 or ASB 9840 or ASB9700 will be
available If there is a lab for another course in one or more of
these rooms the other will be available At particular times the instructor and/or TAs will
be available in the lab (ASB 9838) to answer your questions. Instructor and TAs:
Tuesday 8:30-12:30 Thursday 8:30 – 4:30
© Janice Regan, CMPT 128, Sept. 2007 -2012 32
Finding CSIL labs: 1
© Janice Regan, CMPT 128, Sept. 2007 -2012 33
Finding CSIL labs: 2
CSIL Labs
http://www.sfu.ca/computing/about/school-facilities/access-card.html#requisite-02
© Janice Regan, CMPT 128, Sept. 2007 -2012 34
© Janice Regan, CMPT 128, Sept. 2007 -2012 35
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 refundable deposit and a processing fee)
© Janice Regan, CMPT 128, Sept. 2007 -2012 36
CSIL Rules Before you can use any of the computers
in the CSIL you should Read the policies governing the use of CSIL These policies can be found on the CMPT
web site (see following slides) When you log in you will be asked to confirm
that you agree to abide by these policies
© Janice Regan, CMPT 128, Sept. 2007 -2012 37
http://www.sfu.ca/computing/about/school-facilities/csil.html
IMPORTANTRead the Policies
© Janice Regan, CMPT 128, Sept. 2007 -2012 38
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.
© Janice Regan, CMPT 128, Sept. 2007 -2012 39
Labs and using CSIL Computers in CSIL are available 24/7
Labs for many classes are scheduled in CSIL When a lab (not your own) is scheduled in one of the
CSIL areas you are requested to work in another area of CSIL. The schedule showing which areas are in use can be found at
http://www.sfu.ca/content/dam/sfu/computing/csil/csil_lab_schedule_burnaby.pdf
© Janice Regan, CMPT 128, Sept. 2007 -2012 40
Required Lab Hours Attendance at Lab hours is required
Lab Hours are held in the Windows 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.
© Janice Regan, CMPT 128, Sept. 2007 -2012 41
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
© Janice Regan, CMPT 128, Sept 2007-2012 42
CMPT 128Introduction to Computing
Science for Engineering Students
Computer Components
© Janice Regan, CMPT 128, Sept. 2007 -2012 43
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. Peripheral Input devices: keyboard, mouse, Peripheral Output devices: screen, disk, DVD, printer Processing/storage devices: cpu, RAM, ROM, DVD
Software refers to the programs that describe the steps we want the computer to perform.
© Janice Regan, CMPT 128, Sept. 2007 -2012 44
CPU
Computer Hardware
CPU – Central processing unit
ALU – Arithmetic and logic unit
ROM – Read only memory
RAM – Random access memory
InternalMemory
ExternalMemory
InputDevices
?
OutputDevices
?
Processor
ALU
Cache/Memory
© Janice Regan, CMPT 128, Sept. 2007 -2012 45
Central Processing Unit (CPU, ALU) Performs arithmetic
The processor adds, subtracts, multiplies and divides binary numbers using the Arithmetic Logic Unit, ALU
Makes comparisons The processor can check if two “numbers” are equal,
and determine if one is “larger” or “smaller” than the other
Moves bits (binary digits) Knows how to access any RAM (or ROM) address Can copy data to or from any memory address and
its own onboard memory
Information storage Primary Storage: RAM, ROM
requires power to store information Secondary Storage: Disk, DVD, thumb
drives, SD cards … Less expensive (so more plentiful) Information persists even without power Stores information that is loaded into primary
storage (like programs and data) to be used
© Janice Regan, CMPT 128, Sept. 2007 -2012 46
© Janice Regan, CMPT 128, Sept. 2007 -2012 47
Example: Command Line UI Windows Command Prompt
© Janice Regan, CMPT 128, Sept. 2007 -2012 48
Example: Graphical UI (GUI) Windows explorer
© Janice Regan, CMPT 128, Sept. 2007 -2012 49
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, …) Programming environments (Visual Studio, Eclipse) OTHERS?
© Janice Regan, CMPT 128, Sept. 2007 -2012 50
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 and symbolic manipulation tools
(MATLAB, Mathematica, ...)
Application software is written using computer languages.
© Janice Regan, CMPT 128, Sept. 2007 -2012 51
Machine language Each type of processor (like i7, 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 #
© Janice Regan, CMPT 128, Sept. 2007 -2012 52
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
© Janice Regan, CMPT 128, Sept. 2007 -2012 53
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.
© Janice Regan, CMPT 128, Sept. 2007 -2012 54
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)
© Janice Regan, CMPT 128, Sept. 2007 -2012 55
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++ Many ideas we will discuss in this course are
equally applicable to C++ or to any other compiled high level language (C, Fortran, …)