Lecture #3 - Encapsulation

Web Resources:

CppReference.com, CPlusPlus.com, C++ TechLinks
Going Native 2013 - many experts
Herb Sutter's Blog, Herb Sutter on C++11, Herb Sutter keynote - Going Native 2012
Scott Meyer's Blog, S.M. on thread suspension, S.M.: C++11 Sampler
Stroustrup's Home Page, Code Project, Boost Library

Content:

This lecture is devoted to the notion of Encapsulation and basic Object Oriented Design relationships.

  1. Readings for Lecture #3

    Text: skim chapters 2-6, read chapter 7
    Project #1
    C++ Classes, Templates
  2. Glossary of Terms

    • Encapsulation:
      Restricting all access to a class's state to member functions of the class.
      This ensures that the class state is always valid, since only the class's methods initialize and change it.
  3. The Syllabus describes topics to be covered, reading material for you to digest before coming to class, and due dates for the assigned projects.
  4. Project #1

    Project #1 statement
    Dissecting the Project #1 statement - What is hard? What is easy? Suggestions.

    Project code - Goals, Tasks, Structure, design trade-offs, C++ specific details.

    Recommended strategy:
    Define packages for at least the following:
    test executive, database, database items, and display.

    Resources for Project #1:
    Project1HelpS17, C++ Survival Guide, Projects Menu at top of this page
    Project Properties, doc
    Project Submissions, Compile.bat and Run.bat

  5. Quick look at STL Demo Code
  6. Code you download, run, read, and understand. If you don't then ask questions.

    You need to look at and write a lot of code if you want to do well in this class!

    CodeDescription
    TestClass Illustrates basic parts of C++ class and how they get activated in other C++ code.
    STLContainers Basic examples of STL Containers and Iterators, important for Project #1 and most of the code you will write.
    Relationships Shows how you implement each of the class relationships. The code represents these classes.
    STR A String class - Code we will look at in detail this week. It shows you how to write each of the important parts of a C++ class.
  7. Encapsulation:

  8. Class Relationships, Class Layout Diagram, Class Relationships - code example
    Read this code and understand thoroughly - visit Stroustrup (class text) as needed
  9. class relationships - more details
  10. class layout
  11. Equivalent Syntaxes
  12. first look at STL notes
    The Standard Template Library (STL) provides a set of useful containers, iterators, and algorithms. You can use the containers without knowing too much about how templates work. We will get to that soon.
  13. Software Design
  14. Abstract Data Types Presentation
  15. These are the most important items from today's lecture:

    Encapsulation Principle, Encapsulation Presentation

    Class Relationships, Class Layout Diagram, Class Relationships - code example
    Read this code and understand thoroughly - visit Stroustrup (class text) as needed

CST strip