200 likes | 327 Views
ecs40 Fall 2012: S oftware Development & Object-Oriented Programming final review. Dr. S. Felix Wu Computer Science Department University of California, Davis http://www.cs.ucdavis.edu/~wu/ wu@cs.ucdavis.edu. Final – 12/14/2012. Chapters 3, 6.11, 8~18, 20, plus this set of slides
E N D
ecs40 Fall 2012:Software Development & Object-Oriented Programmingfinal review Dr. S. Felix Wu Computer Science Department University of California, Davis http://www.cs.ucdavis.edu/~wu/ wu@cs.ucdavis.edu ecs40 fall 2012
Final – 12/14/2012 • Chapters 3, 6.11, 8~18, 20, plus this set of slides • Plus gcc/g++, gdb, gprof, make • BUT, probably slides and HWs (especially hw5 and hw6) are most important for your preparation. • closedbook/note/device/people test ecs40 fall 2012
Keep in mind… • I like to ask the kind of “questions” – • Mostly fundamental • Covered repeatedly in HWs and lectures • Some of students were confused (1 from midterm) • A major part will come out of HW#6 directly! • Probably HW#5 as well! • I don’t like – • for you to remember a lot of stuff • I like students to think/understand, instead of trying to remember everything superficially. ecs40 fall 2012
Grading • 0 – nothing or nothing makes any sense • 1 – (25%) have tried but it’s missing the target mostly or completely, or with major flaws • 2 – (50%) got something right but with some major flaws • 3 – (75%) got the right direction, the answer is close to right, with only some minor flaws • 4 – (100%) mostly right, flawless (or almost flawless) ecs40 fall 2012
ecs40 Fundamentals • OO Paradigm • Encapsulation/Abstraction, Separating Interface from Implementation, Extensibility + Reusability (e.g., Template, Inheritance, Polymorphism, Exception) • Internals, Comparison +/-, Dynamic Memory Allocation • OO Programming “Everything is an Object” • Classes (e.g., stream, string, I/O, file) • Software Development Tools in Unix • gcc/g++, make, gdb, gprof errors/faults • Team/Collaborative programming • Good software development practice/coding style ecs40 fall 2012
Probably (with Prob = 0.999999) • Separating Interface from Implementation, plus Exception, under the context of HW#6 • “when shall we try/throw/catch?” and “will that be conflicting with encapsulation?” How to balance/justify that? • Given a program with Segmentation fault, how will gdb help you to find out the location of the error? (in HW6, e.g.) • What is the memory allocation (e.g., new) difference between a member function and a member virtual function? (in the context of HW5) ecs40 fall 2012
Probably (with Prob = 0.899999) • Comparing two different approaches (two pieces of code, inheritance versus template). • When should we use what? Compiler versus linking, run-time? (in the context of HW#5) • Also, will one be relatively easier for the purpose of collaboration? Is OO paradigm better than tradition non-OO such as C? • File handling – fault tolerance (could be combined with the gdb or exception question) • Memory Leak (program example) • Single Pointer-based Linked-List ecs40 fall 2012
Probably (with Prob = 0.899999) • What is the difference between • (const EAC_Event) * event; • EAC_Event (const *) event; ecs40 fall 2012
Probably (with Prob = 0.5000001) • If I forgot something, I will announce by this coming Sunday on both Facebook and Smartsite. • But, pretty much everything has been mentioned already…. ecs40 fall 2012
An Object • Integrity/Protection • Reusability • Abstraction ecs40 fall 2012
Memory Cell Layout main Scan_address Scanf malloc/free a.out ecs40 fall 2012
Integrity/Protection? • Reusability? • Abstraction? malloc free ecs40 fall 2012
Integrity/Protection • Reusability • Abstraction malloc free Soft shell ecs40 fall 2012
GradeBook setCourseName string getCourseName displayMessage Course name 14 14 malloc/free C++ a.out ecs40 fall 2012
Constructor “private” Base “protected” “public” Constructor Derived “private” ecs40 fall 2012
Phone Phone • iPhone5 Android • Ecs40_Phone ecs40 fall 2012
Random access Implicitly, a moving STREAM POINTER, like the “address” of your LOGICAL disk block number. ecs150 Fall 2011
A common programming practice is to allocate dynamic memory, assign the address of that memory to a pointer, use the pointer to manipulate the memory and deallocate the memory with delete when the memory is no longer needed. • If an exception occurs after successful memory allocation but before the delete statement executes, a memory leak could occur. • The C++ standard provides class template unique_ptr in header file <memory> to deal with this situation. ecs40 fall 2012