Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object Oriented Programming (FIT-II) J. H. Wang Mar. 5, 2015.

Similar presentations


Presentation on theme: "Object Oriented Programming (FIT-II) J. H. Wang Mar. 5, 2015."— Presentation transcript:

1 Object Oriented Programming (FIT-II) J. H. Wang Mar. 5, 2015

2 Instructor & TA Instructor –J. H. Wang ( 王正豪 ) –Associate Professor, CSIE, NTUT –Office: R1534, Technology Building –E-mail: jhwang@csie.ntut.edu.twjhwang@csie.ntut.edu.tw –Tel: ext. 4238 –Office Hour: 9:00-12:00 am, every Tuesday and Thursday TA –Mr. Ku (at R1424, Technology Building)

3 Course Overview Course: Object Oriented Programming (FIT-II) Time: 1:10-4:00pm, Friday Place: R226, 6 th Teaching Building Textbook: Absolute C++, 5th edition, by Walter Savitch and Kenrick Mock, Addison-Wesley, 2012. ( 開發 ) –The 3 rd or 4 th edition is also acceptable (with some changes) References: –How to Solve it: OOP, by Prof. Y. C. Cheng (in Chinese)How to Solve it: OOP –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, 2012. –The C++ Programming Language, 3 rd edition, by Bjarne Stroustrup, Addison-Wesley, 1997. Prerequisites: –Basic computer skills (FIT-I basic) –Working knowledge of high-level programming languages such as C (FIT-I pro)

4 Target Audience 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

5 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

6 Teaching Lectures Quiz –About 2 quizzes –During the first month Homework and program assignments –About 5 assignments –Homework should be turned in within two weeks Mid-term and final exam

7 (Tentative) Grading Policy Homework and program assignments: ~40% Quiz: ~10-15% Midterm: ~20-25% Final exam: ~25%

8 Goal Introducing object-oriented programming concepts –Fundamental constructs in OOP with C++ –Programming skills practices –Basic concepts: encapsulation, polymorphism, … Preparing for advanced courses –Application software design & object-oriented problem solving –Software engineering & project management

9 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 –OOP (focus) (10-12 wks) Ch. 6-8: classes, constructors, friends, references Ch. 9, 10, 12: More constructs: strings, pointers and dynamic arrays, streams and file I/O Ch.14: Inheritance Ch.15: Polymorphism –Generic programming (optional) (2 wks) Ch. 16: templates Ch. 17: Standard Template Library

10 Tentative Schedule (Cont’) Schedule –Basically, 1 or 2 weeks per chapter The tentative schedule is subject to changes based on the learning status –Course Web Page: http://www.ntut.edu.tw/~jhwang/OOP/ http://www.ntut.edu.tw/~jhwang/OOP/ Please check the latest announcements, homeworks, exams, …

11 Program Development Environment Free C++ Development Environments –GCC on Linux/UNIX servers (ntut.edu.tw) Not friendly for beginners –Windows-based Dev C++ (http://www.bloodshed.net/devcpp.html): not maintainedhttp://www.bloodshed.net/devcpp.html –For further development, please check Orwell’s Engine (http://orwellengine.blogspot.com/ )http://orwellengine.blogspot.com/ –Other choices: wxDev-C++ by Colin Laplace et. al. Cygwin (http://www.cygwin.com/): UNIX-like emulation on Windowshttp://www.cygwin.com/ MinGW (http://www.mingw.org/)http://www.mingw.org/ Commercial tools –Microsoft Visual C++ –Borland C++ –…

12 Homework Submission Online submission instructions –Programs and homeworks in electronic files must be submitted to the TA online: Submission site: http://mslin.ee.ntut.edu.tw/http://mslin.ee.ntut.edu.tw/ Account: At your first login, please use your student IS as the account and password. Remember to change the password as soon as possible for better security. Filename: Please compress your source codes into one file, and name it according to your ID and each homework. For example, [id]_HW1.zip or [id]_quiz2.rar. If the submission website fails, the NTUT Network Campus might be used for homework submission

13 Programming Paradigms Low-level vs. high-level programming languages – relative concepts –Machine vs. human Styles of computer programming –Procedural programming –Object-oriented programming –Functional programming –Logic programming –…

14 Low-level vs. High-level Programming Languages Low-level: –Machine code –Assembly High-level: (abstraction from the computer details) –Basic, C, Java, Pascal, C++, Perl, Python, …

15 Styles of Computer Programming Procedural programming –Imperative: procedures, routines, subroutines, methods, or functions Object-oriented programming Functional programming –Mathematical functions –E.g. Lisp, Erlang, Haskell, … Logic programming –Logic: facts, rules –E.g. Prolog …

16 Examples (1/5) Problem: To calculate Fibonacci numbers –F n = F n-1 + F n-2, n>=2 F 0 = 0, F 1 = 1 How to program? –(The following examples are adapted from Wikipedia.)

17 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)

18 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; }

19 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

20 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

21 OOP: Basic Concepts Encapsulation –Object Instance of class –Members Attributes Methods Abstraction –Composition E.g.: car –Inheritance E.g.: insects vs. ants, bees, … Polymorphism –Many meanings for one function

22 OOP: Why C++? OO programming language: Why C++? –C++: general purpose programming language with a bias towards systems programming that [from Bjarne Stroustrup’s homepage] Is a better C Supports data abstraction, object-oriented programming, and generic programming –C++ has Many users Wide applications –Others: Smalltalk, Java, …

23 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, … –Standard library: some useful data structures and algorithms Containers, iterators, …

24 Different Learning Approaches When to introduce “objects”: differences among some textbooks –C++ How to Program: “early objects” approach “late objects” approach also available –C++ Primer: “early objects”, covering basics and library together –Absolute C++: intermediate –The C++ Programming Language: “The Bible”, as a reference

25 What to learn –Object-oriented concepts via OO language constructs Bottom-up: class, inheritance, polymorphism, … –constructors, operators, destructors -> type –E.g.: Lego –Problem-solving methodology Top-down: problem, understanding, designing, implementation, testing –Case-based: problem -> solution (algorithm) –E.g.: divide-and-conquer, U-D-C-L (in How-to-Solve-it: OOP), …

26 How to Prepare Yourself? Practice, practice, practice… –Exercises on textbooks and reference books –Online resources: programming exercises, forums, … –Programming examination: CPE (Collegiate Programming Examination), …CPE –Programming contests ACM ICPC (International Collegiate Programming Contest) IOI (International Olympiad in Informatics) Domestic: e-tutor, …e-tutor …

27 Thanks for Your Attention!


Download ppt "Object Oriented Programming (FIT-II) J. H. Wang Mar. 5, 2015."

Similar presentations


Ads by Google