دانشگاه شهید بهشتی
دانشکده مهندسی برق و کامپیوتر
ترم دوم ۹۰-۸۹

برنامه‌سازی پیشرفته

گروه درسی بر روی گوگل
تارنامه ارسال تمرینات
استاد : دکتر آزاده منصوری

تمرینات

تمرینات سری دوم
تمرینات سری چهارم
تمرینات سری پنجم
تمرینات سری ششم (۷ اردیبهشت ۹۰)
تمرینات سری هفتم (۳۰ اردیبهشت ۹۰)
پروژک نوروزی
پروژه پایانی

منابع و آزمون‌ها

صورت سوالات آزمون ۵ اردیبهشت ( Word | PDF )
صورت +‌ پاسخ سوالات آزمون ۵ اردیبهشت ( Word | PDF )
صورت + پاسخ سوالات آزمون میان‌ترم ( PDF )

سیلابس درس

Topic
>- Object-Oriented Assignments
VX Basic Object Oriented
VX Copy Constructor
*X Syntax: myclass(const myclass&)
*X function argument
*X myclass y=x; //assignment
*X myclass y(x); //constructor
VX Properties
VX Getter/Setter
*X read-only properties
*X Public member
*X Property (language spec)
*X Static members
*X Static methods (for class not for object)
VX Class member initialization
*X member variables
*X static const
VX Function Overloading
*X method overloading
>- Library Management and Linking
VX File Operations
VX Binary Files
*X Open
*X Read
*X Seek
*X Close
*X Filesystem
VX Text Files
*X abstraction
*X usage
*X Open
*X Read
*X Parse
*X Close
VX Command Line Arguments
*X How to use
*X Commong usage
*X Benefits
*X Other forms of IPC
VX Search and Sort Algorithms
*X Linear Search
*X Binary Search
*X Hash Search
VX O(n^2) Sorts
*X Bubble
*X Insertion
*X Selection
*X etc
VX O(n) Sorts
*X Counting Sort
VX O(n lg n) Sorts
*X Merge Sort
*X Quick Sort
*X Heap Sort
VX Operator Overloading
*X Unary Prefix Operators
*X Unary Postfix Operators
*X Infix / RPN for evaluation
*X Binary Arithmetic Operators
*X Binary Relational Operators
*X Binary Assignment Operators
*X Refernce or Value?
*X Access Operators
*X Friend Operators, Why and How
*X Typecast Operators
*X IOStream Operators
V Basic Data Structures
* Stack
* Queue
* DynamicArray
* Linked List
* Tree
* Graph
* Hash
VX Asynchronous Programming
VX Why async?
*X Polling method
*X Interrupt method
*X Interrupt Handlers
*X Registering for an Interrupt
VX Implementations of Asynchronous Programming
VX Callbacks
*X Function Pointers
*X Usually with Closures (not C++)
VX Threads
*X Operating System abstraction
*X Separate Stack Segment
*X Concurrent Programming
*X Parallel CPU Cores
*X Time Slice (Non Atomicity)
*X Critical Regions (Thread Unsafety)
VX Asynchronous Mechanisms
*X Events
*X I/O Critical Operations
*X Signals
*X Errors
V- Conceptual Inheritance and Object Relations
VX Inheritance
*X Defines is_a
VX Public
*X usual method, common languages
*X derived inherits from base
*X base is more general
*X derived is more specific
VX Protected
*X not important :)
VX Private
*X Another method of composition/aggregation
*X Only C++
*X Only one instance
*X Not recommended
VX Composition (ownership)
*X Defines has_a (owns_a)
*X Car has an Engine
*X instantiate Engine in Car
*X or use Private inheritance
*X If Car is created, Engine is created as well
*X If Car is gone, Engine is gone for good
*X Much more common than inheritance
*X Depicted in UML as "filled diamond"
VX Aggregation (non ownership)
*X Defines has_a
*X Lake has a Duck
*X Ahmad has a Car (but his brother also has the same car)
*X a Reference/Pointer to the Duck in Lake
*X Can have an array of References (DynamicArray<Car*> myCars)
*X If Ahmad is gone, the Car is still there
*X If Lake is gone, Duck is still there
*X Even more common than Composition
*X Forms most of object-relations in Object Oriented Design
*X Depicted in UML as "unfilled diamond"
VX Containment
*X LinkedArray contains lots of Linked List Cells
*X DynamicArray<float> contains lots of Floats
*X Very common in use, Whenever we need groups
VX Common Forms:
*X Dynamic Array
*X Linked List
*X Associative Array
*X Hash Table
*X Hash Map
*X Binary Tree
*X Heap (Priority List)
VX Multiple Inheritance
*X Only allowed in C++
*X Strictly not recommended, Except for implementing Interfaces
*X Causes Design to be a Graph, instead of a Tree
*X Graphs are hard (bad)
*X Trees are simple (good)
VX Abstract Class
*X A class that has at least "one abstract method"
VX Abstract method is : virtual type method(type arg,...) = 0;
*X has no body
*X should be virtual
*X equals zero
*X Abstract Classes can't get instantiated
*X They are only good for heritage!
*X Form more complex interfaces (with member variables)
*X 30% of classes in a project are usually abstract
V Interface
* Abstract classes without any member variables and function bodies
* Or, a set of abstract functions
* Define protocols to work with a group of classes
* classes "implement" some interfaces, Thus they accept the protocol
* Makes programming easy both in concept and context
* more than 90% usage in projects
V Templates
V Function Templates
* template <class T> T& getMax(T a, T b);
* float x,y; getMax(x,y);
* getMax<int>(x,y);
V Class Templates
* template <class T, class U> class myClass { ... };
* myClass <int,float> a;
V outside method body is
* template <class T> void myClass<T>::myMethod(T input);
V Template Specialization
* template <> class DynamicArray <bool> {...};
V Non-type Templates
* template <class T, int N> class DynamicArray { T * data= new T [N] ; };
* Template Header/Body problem
V Error Handling
* Errors happen when Exceptions happen
* Exceptions are bad, Errors are good
V Making an Error
* force division by zero (C Style)
* throw object; (C++ Style)
V How to handle exceptions?
* Try/Catch blocks
* Try { erroneous code here }
* Catch (type e) { ... }
* Catch (...) { all arguments }
* Signals / Signal Handling
V Standard Exceptions
* exception base class
* catch with reference (don't cut the tail)
* char * what(); //description method
V List of common exceptions
* bad_alloc
* bad_cast
* bad_exception (no match)
* bad_typeid
* ios_base::failure
* Software Development Methodologies
* STL
* Version Control
* GUI Programming