3110 Test 1 Study Notes

9 Phases of software life cycle:

1. Specification – specify clearly all aspect of problem

2. Design – design a solution

3. Risk Analysis

4. Verification – verify correctness of solution

5. Coding

6. Testing – remove logic errors

7. Refine the solution.

8. Production – Distribution, installation and use.

9. Maintenance – correcting user detected errors.

Three Principles of Object Oriented Programming

  1. Encapsulation: Objects combine data and operations; the concept of combining data and operations into one object
  2. Inheritance: Classes can inherit properties from other classes; relationship among classes whereby a class uses properties of a previously defined class
  3. Polymorphism: Objects can determine appropriate operations at execution time;

ability of a variable name to represent instances of different but related classes from a common base class

6 Key Programming Issues

1. Modularity

2. Modifiability – functions, named constants

3. Ease of use – user friendly

4. Fail-safe programming – error checking

5. Style

6. Debugging

Notes on friends:

  • Functions and classes can be friends
  • Declaring a non-member function as a friend to a class allows that function to access all of the pricate and protected member of the class.
  • Friend functions are not members of the class.
  • Friendship is not inherited.

Notes on Templates:

  • Actual type specified in client.
  • Precede each function definition with “ template <class T> and follow each occurrence of the object type myClass (whatever class name) with <T>
  • You must include the implementation (.cpp) file in the client if the class is templated

Notes on Iterators:

  • An iterator is an object that traverses a collection of like objects (e.g. Integers in a list)

Notes on Inheritance:

  • A derived class inherits private member from the base class
  • Derived class’s member functions can call the base class’s public member functions.
  • Client of derived class can invoke base class’s public functions
  • Public Inheritance implies “is –a” relationship (i.e. a ball “is-a” sphere)
  • Multiple Inheritance occurs when a class has more than one base class. (Iostream is an example of multiple inheritance. It inherits from Istream and from Ostream)
  • Inheritance allows reuse of code.

Early/Static binding -association of a variable with its type at compilation time

Late/Dynamic binding – association of a variable with its type @ execution time

A solution is good if the total cost it incurs over all phases of its life cycle is minimal.

Abstraction separates the purpose of a module from its implementation.

Information hiding ensures no other modules can access data.

OOD – Objects encapsulate data and operations

TDD- addresses a task at successively lower levels of detail (deals with implementation);addresses lower levels of detail, producing independent modules

Rules on Overloading Operators

  1. You can overload any C++ operator except: . .* :: ?: sizeof
  2. You cannot define new operators by overloading symbols that are not already operators in C++
  3. You cannot change the standard precedence of a C++ operator or the number of its operands
  4. At least one operand of an overloaded operator must be an instance of a class
  5. A typical class should overload at least the assignment, the equality, and the relational operators
  6. You cannot change the number of arguments for an overloaded method.

STL

  • Contains template classes for some common ADT’s
  • Contains template functions for common algorithms

Containers: Objects that hold other objects (e.g. list)

Namespaces

  • A mechanism for logically grouping declarations and definitions into a common declarative region.