1 / 19

COMP2012H Object-Oriented Programming and Data Structures

COMP2012H Object-Oriented Programming and Data Structures. Fall 2017. Lectures. Instructor: Long QUAN Lectures: Tuesday & Thursday 11h30am – 1h20pm , room 2404 Web site: ( https://course.cse.ust.hk/comp2012 h) http://www.cse.ust.hk/~quan/comp2012h/index.html Lecture notes

rcourville
Télécharger la présentation

COMP2012H Object-Oriented Programming and Data Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMP2012HObject-Oriented Programming and Data Structures Fall 2017

  2. Lectures • Instructor: Long QUAN • Lectures: • Tuesday & Thursday 11h30am – 1h20pm , room 2404 • Web site: • (https://course.cse.ust.hk/comp2012h) • http://www.cse.ust.hk/~quan/comp2012h/index.html • Lecture notes • Assignments, test cases and solutions • Download course material before class • Labs

  3. Textbook • Main book: • ADTs, Data Structures, and Problem Solving with C++, Prentice Hall, Larry Nyhoff • My reference book: • The C++ Porgramming language, Addison Wesley, Stroustrup --- creator of C++

  4. Grading Scheme • Grading is based on • 3 Programming Assignments (8+9+8%=25%) • 11 Lab exercises (10%), 1% each, and the best 10 • Midterm Examination (25%) • Final Examination (40%) • The final has to be consistent with the overall score • If you perform well in the final, you may not fail the course • If you perform poorly in the final, you may not get an A

  5. Plagiarism Policy • 1st Time: both get 0 • 2nd Time: both get 0 + one full downgrade • 3rd Time: FAIL • Midterm or Final: an automatic FAIL You are encouraged to collaborate in study groups. But, you cannot copy or slightly change other students’ solutions or codes. The detection of plagiarism is computerized!

  6. Course Overview • A fundamental computer science course - Essential for programming - Essential for advanced courses • A challenging course, which needs - Mathematical and logic thinking - Programming

  7. Course Prerequisite • COMP104 • Need to know C and C++ • PC programming environment • Good programming skills • Translate pseudo-codes into codes • Speedy review in the 1st week • Basic mathematical skills • Solving recursive equations, manipulation of symbols, etc. • Computer architecture • Pointers, storage, memory access, etc.

  8. Course Outline • C++ review (1 week) • Recursions and algo analysis (1 week) • Sorting (1 week) • Lists (1 week) • OOP1: concept and classes (2 weeks) • Data structures: stacks, and queues (1 weeks) Midterm • Generic programming and STL (1 weeks) • OOP2: inheritance, polymorphism and virtual functions (2 weeks) • Data structure 2: binary trees (2 weeks) • Hashing (1 week)

  9. Overall Goal of the Course • From programmer to architect • Learn to solve problems • Algorithms and Programming go hand in hand • Learn to analyze your solutions

  10. Lecture Format • Lectures: • Slides are available before class • Print in ‘graylevel’ as ‘handouts’!!! • Constantly updated, only minorly!!! • It is important to attend the lectures (because not all material and concepts are covered in slides) • If you miss any lectures, learn from your friends • Labs • Compulsary! • Weekly programming practice • Programming assignments • More rigorous problems to consolidate your knowledge • Manipulation of polynomials • Linked list data structure • Class-based implementation • STL and advanced functions • Bonus? Anything beyond the three assignments

  11. Assignments • Programming assignments • Due by time specified • Run on PC • Submit it using CASS • Re-grade policy will be announced • Late policy : allows only one day late for at most one assignment, 2 days late is not accepted

  12. Midterm and Final Examinations • (Check the schedule with all students!) • Midterm: TBA • Final: TBA • Closed-book, closed-notes • No make-ups will be given • Unless under very unusual circumstances, with letters of proof • Instructor informed beforehand

  13. Programming and languages • Visual Basic • not much structured • C, Fortran, Pascal, • Lisp, scheme, … • Python • interpreted, high-level, efficiency • structural, object-oriented • functional in Lisp tradition, dynamic typing and binding, garbage collection • (JavaScript) • Interpreted, high-level, dynamic, weakly typed, object-based, multi-paradigm • Java • C++ • …

  14. Where are we, and where to go? 2012 1004 Procedural programming, Or structured programming, Or imperative programming (104), modularity (152) OOP (104, 151) (171) Data structure: Linear: list, stack, queue Nonlinear: tree, graph Simple types of variables (variables=objects) 3 program structures (assignment, conditional, iteration) Static objects Dynamic objects Functions on objects (member) variables Array, struct pointer class objects operation (member) functions Algorithms C++, Java C, Pascal Data, variable, object Operation, function, procedure, subprogram, module, method Algorithms+Data Structures = Programs Niklaus Wirth

  15. Programming paradigms • Procedural programming • Functional programming • Object-oriented programming

  16. Procedural programming • An (ordered) sequence of ‘procedures’ or ‘functions’ or meta-instructions • Three instructions • Assignment • Conditional • iteration

  17. procedural programming: main(), is the first function, and is composed of a sequence of ‘procedures’ (or ‘functions’ in C++). Functions communicate by passing parameters. int main() { A a; B b; C c; a.f1(); b.f2(); c.f3(); … } Class A { Int x; Int f1(); } Class B { Int y; Int f2() } Class C { Int z; Int f3(); } int main() { int x,y,z; int a,b,c; a=f1(x); b=f2(y); c=f3(z); … } int f1() { } int f2() { } int f3() { } Object oriented programming: a sequence of ‘objects’! Objects communicate by sending messages.

  18. Math and CS • From ‘calculus’, get ‘programming fundamentals’ • Sequence, dynamic procedure • Euclid  a process or an algorithm  iteration • Approximation of a real  iteratively • ‘bracket’ the solution of a polynomial  iteration • Recurrent sequence u_{n+1} = f(u_n)  ‘recursion’ • Recurrent sequentce is ‘more expressive’, but no ‘close-form’ solution • ‘convergence’ for math  ‘termination’ of a recursive procedure or a loop • Fixed-point theorem  important for ‘recursion’ to finish • Invariance  proof of correctness of a ‘loop’ • From ‘algebra’, get ‘object-oriented programming’ • ‘algebra’ comes later than ‘calculus’ • About ‘categorization’ • Look for ‘general rules’ for the same objects • Group, ring, and fields: set of elements and operators • element sets  class • operators  operators

  19. Key concepts in procedural programming • Parameters passing • Scope of variables • Recursions • Algorithm analysis • Sorting algorithms

More Related