Instructor & TA
Instructor
J. H. Wang () Assistant Professor, CSIE, NTUT Office: R1534, Technology Building E-mail: jhwang@csie.ntut.edu.tw Tel: ext. 4238 Office Hour: 9:00-12:00 am, every Tuesday and Wednesday
TA
(TBD)
Course Overview
Course: Object Oriented Programming (FIT-II) Time: 8:10-11:00am, Friday Place: R312, Network Center Textbook: Absolute C++, 5th edition, by Walter Savitch and Kenrick Mock, Addison-Wesley, 2012. ()
The 3rd or 4th edition is also acceptable (with minor changes) C++ Primer, 5th edition, by Stanley B. Lippman, Josee Lajoie, and Barbara E. Moo, Addison-Wesley, 2012. C++ How to Program, 8th edition, by Harvey Deitel and Paul Deitel, Prentice Hall, 2011. The C++ Programming Language, 3rd edition, by Bjarne Stroustrup, Addison-Wesley, 1997.
References:
Prerequisites:
Basic computer skills (FIT-I basic) Working knowledge of high-level programming languages such as C (FIT-I pro)
Target Students
For those who
Might NOT major in CSIE but are interested in programming techniques, and Have accomplished the courses in software engineering track: FIT-I basic & FIT-I pro, and Are willing to prepare for intermediate and advanced software engineering courses
Emphases of Teaching
Basic concepts of the object-oriented programming paradigm Hands-on experience of C++ programming skills Introduction to problem solving techniques, basic data structures and algorithm design
Teaching
Lectures Quiz
About 2 quizzes During the first month
Goal
Introducing object-oriented programming concepts
Fundamental constructs in OOP with C++ Practicing programming skills Basic concepts: encapsulation, polymorphism,
Tentative Schedule
Organization of the textbook
Review of computer programming (3-4 wks)
Overview of Object Oriented Programming Ch. 1-5: programs, functions, parameters, flow of control, arrays, structures
Windows-based
Dev C++ (http://www.bloodshed.net/devcpp.html): not maintained
For further development, please check Orwells Engine (http://orwellengine.blogspot.com/ ) Other choices: wxDev-C++ by Colin Laplace et. al.
Commercial tools
Microsoft Visual C++ Borland C++
Homework Submission
Online submission instructions
Programs and homeworks in electronic files must be submitted to the TA online at:
http://140.124.183.39/oop/
Before submission:
User name: Your student ID Please change your default password at your first login
If the submission website fails, the NTUT Network Campus might be used for homework submission
Programming Paradigms
Low-level vs. high-level programming languages relative
Machine vs. human
Logic programming
Logic: facts, rules E.g. Prolog
Examples (1/5)
Fibonacci numbers
Fn = Fn-1 + Fn-2 , n>=2 F0 = 0, F1 = 1
How to program?
(The following examples are adapted from Wikipedia.)
Examples (2/5)
Functional: (Haskell)
fib 0 = 0 fib 1 = 1 fib n = fib (n-1) + fib (n-2) Or fib first second = first : fib second (first+second) fibonacci = fib 0 1 main = print (fibonacci !! 10)
Examples (3/5)
Procedural: (C)
int fib(int n) { int first = 0, second = 1; for (int i=0, i<n; i++) { int sum = first+second; first = second; second = sum; } return first; }
Examples (4/5)
Assembly: (in x86 using MASM syntax)
mov edx, [esp+8] cmp edx, 0 ja @f mov eax, 0 ret @@: cmp edx, 2 ja @f mov eax, 1 ret @@: push ebx mov ebx, 1 mov ecx, 1 @@: lea eax, [ebx+ecx] cmp edx, 3 jbe @f mov ebx, ecx mov ecx, eax dec edx jmp @b @@: pop ebx ret
Examples (5/5)
Machine code: (a function in 32-bit x86)
8B542408 83FA0077 06B80000 0000C383 FA027706 B8010000 00C353BB 01000000 B9010000 008D0419 83FA0376 078BD98B C84AEBF1 5BC3
Members
Attributes Methods
Abstraction
Composition
E.g.: car
Inheritance
E.g.: Lassie the Dog, a Collie
Polymorphism
Many meanings for one function
C++ has
Many users Wide applications
Some Comparisons
Three parts in C++
Low-level language: largely inherited from C
Data types, flow of control, functions, arrays, pointers,
Advanced language features: to define our own data types (major difference)
Class, inheritance, polymorphism, template, exception,
C++ Primer: early objects, covering basics and library together Absolute C++: intermediate The C++ Programming Language: The Bible, as a reference