Objectives
  • Explain basic object-oriented programming concepts
  • Use objects in PHP scripts
  • Declare data members in classes
  • Work with class member functions
Assignments and Due Dates


Assignments and Due Dates: View
CS2623 Coding Standards - requirements for all class assignments

Required Readings

PHP Programming with MySQL //Second Edition by Don Gosselin, et al
Chapter 10 - Developing Object-Oriented PHP
Text Resources
     Errata Sheet
     Best Practices

 

Recommended Tutorials

Lynda.com
PHP with MySQL Beyond the Basics by Kevin Skoglund


3. Introduction to Object-Oriented Programming (OOP)
4. OOP in Practice
6. Foundations of an OOP Project (For Inquiring Minds!)
   Excellent information that is beyond the scope of the text. However, please take advantage of viewing the tutorials of #6 while you have access to Lynda.com

The text introduces the object-oriented techniques available to mysqli (PHP 5+).  In the previous chapters the procedural techniques of the mysqli package had been used.  However, this set of videos covers how to make a truly object oriented project.

YouTube
        Object Oriented Programing (OOP) in PHP for Beginners

      Good Demonstration of the basics as well as Encapsulation and Inheritance. 
and/or
      Object Oriented PHP
             good description of OOP in the beginning but goes into more detail
             than this class required.

Required Sample Code
The sample code is in a file which must be downloaded and extracted to location accessible by the server. Be sure to do this before testing the code.
Supplemental Materials
Some of these items are from last week but included here as a reference
  • Object-Oriented (Professor Modification of Text's PowerPoint) View (.ppt) | Print (.pdf)
  • Chapter 10: PowerPoint from Text                                       View (.ppt) | Print (.pdf)
  • PHP Security Guide http://phpsec.org/projects/guide/ (for your personal reference)
Software

PHPMyAdmin and MySQL which was included with your WAMP|MAMP download will be used for work with databases.

Chapter Questions and Test Reviews

Chapter 10: Review Questions (.rtf file)
Test 4: Review Sheet

Required Assignments
  • SSP11: Object Oriented (Complete, upload to Apollo1, then submit URL in the LMS)
  • Weekly Quiz: Chapter 10 (Located in the LMS)
Professor's Class Notes and Comments

IMPORTANT:

The sample code in OOP_PHP.zip must be downloaded and extracted to location accessible by the server (htdocs or www). This consists of the Gosselin Gourmet Coffee which is used as the text's example. The completed code has been included for your convenience. Be sure to take the time to review and use it.

When working with databases make sure both the Apache server and MySQL are online.

When connecting to databases locally use the following defaults. WAMP does not include a password but MAMP uses root as the both the user and password. The sample files use WAMP so modifications will need to be made if working on a MAC.

WAMP: $DBConnect = mysqli_connect("localhost", "root", "");
MAMP: $DBConnect = mysqli_connect("localhost", "root", "root");

In the text on p. 562 are instructions for creating a database entitled online_stores. OnlineStores.sql which is included in the zip file can just be imported into a local copy of PhpMyAdmin. It will create the database and corresponding tables.


In the past some students who are not familiar with Object Oriented (and even some who are familiar) are confused by the text's presentation most likely because it uses a somewhat complex example. With that being the case, my recommendation would be to view the Lynda.com or the YouuTube video/s before readinh the text. I would recommend the following
Lynda.com  
       PHP with MySQL Beyond the Basics by Kevin Skoglund    
          3. Introduction to Object-Oriented Programming (OOP)
          4. OOP in Practice
YouTube
      Object Oriented Programing (OOP) in PHP for Beginners
              and/or
      Object Oriented PHP
             good description of OOP in the beginning but goes into more detail
             than this class required.

By doing this first, hopefully the text will make more sense. Also, even though this week's sample code contains the completed chapter project, it is still recommended that students type in the code -- a sort of learning by doing situation.