Date post: | 26-Dec-2015 |
Category: |
Documents |
Upload: | walter-rice |
View: | 223 times |
Download: | 0 times |
Introduction
COMP104: Fundamentals and Methodology
COMP104 Lecture 1 / Slide 2
Objectives
• How to solve a problem (by computer) fundamental problem solving techniques
• How to design an algorithm algorithm design
• How to write a program in C++ implementation
COMP104 Lecture 1 / Slide 3
Course description Introduction C++ basics for Structured (or procedural) Programming
Sequential (assignments) Branching (if statement) Looping (while-do statement) Arrays and algorithms Functions (local/global, value/ref), recursion
Files Pointers and dynamic objects Linked lists
Introduction to OOP (Object Oriented Programming) Classes, objects Abstract data types
mid-term
static
dynamic
COMP104 Lecture 1 / Slide 4
What can you do after this course?
• Program the computer in applications such as the following:• Program a simple calculator• Program simple computer games• Program a simple text editor• Program a small inventory system for a small
company• …
• You will be ready to take on part-time programming jobs during Xmas break!
COMP104 Lecture 1 / Slide 5
Course organization
Lectures (3 h) (office 3506, [email protected]) Tutorials (1 h)
Not compulsary Labs (2 h)
Compulsary! See lab policy. Assignments (homework, 3 projects)
Textbook: Programming in C++: Lessons and Applications, by Timothy B. D’Orazio
No any prerequisite for comp104!
But it’s a prerequisite for most of CS courses!
COMP104 Lecture 1 / Slide 6
A typical weekly schedule
Tu Thur Lectures Sat. Next lab posted on web Mon-Fri Lab session
(students encouraged to demo program by end of lab)
Sat. midnight Deadline for lab by CASS
• Course webpage: course.cse.ust.hk/comp104/Password_Only• Print out ‘ppt’ with ‘handouts’ option!!!
• Newsgroup, Facebook?
• Eclipse tutorial
• SVG tutorial
COMP104 Lecture 1 / Slide 7
Grading
Labs (10%) Assignments (25%) Midterm exam (25%), 6th week,
9th October, Sat. 1-3pm Final exam (40%), Dec.
Mark weighting
COMP104 Lecture 1 / Slide 8
Introduction to Computer Systems
• Hardware
• Software
COMP104 Lecture 1 / Slide 9
Hardware
Memory
CPU
InputDevices
OutputDevices
COMP104 Lecture 1 / Slide 10
• CPU - central processing unit• Makes decisions, performs computations, and delegates input/output requests
• Memory: Stores information• Main memory: RAM, e.g. 256 MB RAM• Secondary memory: hard disk, e.g. 20GB
• Input devices• Gets information from the user to the computer
• Output devices• Sends information from computer to the user
COMP104 Lecture 1 / Slide 11
What is a program?
A computer program performs a specific task, and may interact with the user and the computer hardware.• Human work model:
• Computer work model:
A program is a set of instructions
COMP104 Lecture 1 / Slide 12
What is a (programming) language?
• A program needs to be written in a language
• There are many programming languages• Low-level, understandable by a computer• High-level, needs a translator!
• C++ is a high level programming language
A sequence of instructions
A program
(in computer language)An algorthm
(in human language)
COMP104 Lecture 1 / Slide 13
Machine binary language Low-level assembly High-level
An example:
COMP104 Lecture 1 / Slide 14
• Machine binary language: unintelligible
• Low-level assembly language • Mnemonic names for machine operations• Explicit manipulation of memory addresses• Machine-dependent
• High-level language• Readable• Machine-independent
Levels of programming language
COMP104 Lecture 1 / Slide 15
How to translate?
Examples of compilers:• Microsoft Visual C++, Eclipse, g++
A program written in high-level programming language (for example, C++ program)
A low-level (machine language) program that is understandable by a computer (for example, a PC)
COMPILER (for example, Visual C++)
COMP104 Lecture 1 / Slide 16
• Application software• Programs designed to perform specific tasks and
are easy to use
• System software• Programs that support the execution and
development of other programs
Two major types• Operating systems• Translation systems (compilers & linkers)
What is a software?
The set of all programs or a set of programs
COMP104 Lecture 1 / Slide 17
• Operating System (OS)• Windows (DOS, NT, XP, …), Unix (Linux, Solaris, …)
• Common application software: Microsoft Word, WordPerfect PowerPoint Netscape, IE PhotoShop, Photo-Paint Quick Time
COMP104 Lecture 1 / Slide 18
We teach C++, Why?
• C++ is one of the most popular languages • C++ (originally C)• Basic, Pascal, Java, Perl, Cobol, Scheme, Lisp, Smalltalk, Ada, …
• C++ is portable (runs on PC, Machintosh, Unix, Mainframes …)
• C++ is widely used in industries (almost by everyone)
• C++ is not easy to learn
• The most common versions of C++:• Microsoft Visual C++• Eclipse• g++ (for Unix machines)
C
C++
COMP104 Lecture 1 / Slide 19
Programming or Software Development
Editing (to write the program) Compiling (creates .obj file) Linking with compiled files (creates .exe file)
• Object files• Library modules
Loading and executing Testing the program
Compile
Link
Library routines
Other object files
Think
Edit
Load
Execute
Source Program
debug
COMP104 Lecture 1 / Slide 20
Integrated Development Environments (IDE)
Editor Compiler Linker Loader Debugger Viewer
Combine all of the capabilities that a programmer would want while developing software (VC++, Eclipse)
builder
COMP104 Lecture 1 / Slide 21
Summary