Date : 02/03/2014 Web Technology Solutions Class: OOP PHP, Design Patterns and CRUD.

Slides:



Advertisements
Similar presentations
By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
Advertisements

Object-Oriented Programming Basics Prof. Ankur Teredesai, Computer Science Department, RIT.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Fall 2006AE6382 Design Computing1 Object Oriented Programming in Matlab Intro to Object- Oriented Programming (OOP) An example that creates a ASSET class.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Object-Oriented PHP (1)
1 Programming for Engineers in Python Autumn Lecture 5: Object Oriented Programming.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Hands-On Microsoft Windows Server 2003 Administration Chapter 5 Administering File Resources.
ASP.NET Programming with C# and SQL Server First Edition
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Chapter 8 Objects and Classes. 2 Motivations After learning the preceding chapters, you are capable of solving many programming problems using selections,
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
Starting Chapter 4 Starting. 1 Course Outline* Covered in first half until Dr. Li takes over. JAVA and OO: Review what is Object Oriented Programming.
Programming Languages and Paradigms Object-Oriented Programming.
Object-Oriented Programming with C++ Yingcai Xiao.
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Functions & Objects IDIA 618 Spring 2012 Bridget M. Blodgett.
Module 7: Object-Oriented Programming in Visual Basic .NET
More on Classes Pepper With help from rs.html.
BIM313 – Advanced Programming Techniques Object-Oriented Programming 1.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
OO (Object Oriented) Programming Chapter 21 IB103 Week 12.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Object Oriented Programming in PHP. Topics Quick OOP Review Classes Magic Methods Static Methods Inheritance Exceptions Interfaces Operators Type Hinting.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Date : 3/3/2010 Web Technology Solutions Class: Application Syndication: Parse and Publish RSS & XML Data.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Object-Oriented PHP (Chapter 6).
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
OOP IN PHP `Object Oriented Programming in any language is the use of objects to represent functional parts of an application and real life entities. For.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Object Oriented Programming in PHP. List of Items of Interest What is a Class What is an Object What is a Singleton Multiple Objects, How to store. Advantages.
These materials where developed by Martin Schray. Please feel free to use and modify them for non-commercial purposes. If you find them useful or would.
Google App Engine Data Store ae-10-datastore
Chapter 4 Introduction to Classes, Objects, Methods and strings
Date : 2/12/2010 Web Technology Solutions Class: Adding Security and Authentication Features to Your Application.
 Registry itself is easy and straightforward in implementation  The objects of registry are actually complicated to store and manage  Objects of Registry.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
08 Encapsulation and Abstraction. 2 Contents Defining Abstraction Levels of Abstraction Class as Abstraction Defining a Java Class Instantiating a Class.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
CHAPTER 14 Classes, Objects, and Games XNA Game Studio 4.0.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
Written by: Dr. JJ Shepherd
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Learning OOP in PHP. What is OOP? OOP stands for Object Oriented Programming. OOP is a programming paradigm wherein you create “objects” to work with.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes.
Comp1004: Building Better Objects II Encapsulation and Constructors.
JAVA By Waqas.
Web Technology Solutions
CS3340 – OOP and C++ L. Grewe.
Week 4 Object-Oriented Programming (1): Inheritance
INTRODUCTION TO OOP Objective:
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Chapter 10 Thinking in Objects
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
MSIS 670 Object-Oriented Software Engineering
Lecture 22 Inheritance Richard Gesick.
Object-Oriented Programming
Object-Oriented Programming
ITEC 3220A Using and Designing Database Systems
CIS16 Application Development and Programming using Visual Basic.net
Object-Oriented Programming
Object-Oriented Programming
Object Oriented Analysis and Design
Mr. Justin “JET” Turner CSCI 3000 – Fall 2016 Section DA MW 4:05-5:20
Presentation transcript:

Date : 02/03/2014 Web Technology Solutions Class: OOP PHP, Design Patterns and CRUD

Tonight ✤ CRUD Redux ✤ Hands On Functions\Arrays ✤ Objects in PHP ✤ OOP Design Patterns ✤ Lab

Lab Preview ✤ Continue to build a simple CRUD app with the presidents table.

CRUD Review Create, Read, Update and Delete. How To, Tips, Tricks

Array and Function Challenges 4 quick challenges to test your programming skills.

Array Challenge #1 $arr = array("name", "age", "race", "job");Search through this array and find the item “race” and return the key of that item.

Array Challenge #2 Find only what is different in these two arrays and return those unique elements. $array1 = array(1 => "WA", "CA", "UT", "MT");$array2 = array(2 => "CA", "MT", "UT");

Function Challenge #1 Create a custom function that takes two array’s and combines those arrays into one array and return a single array. $array1 = array(1 => "WA", "CA", "UT", "MT");$array2 = array(2 => "VA", "NV", "OR");

Function Challenge #2 With the following string, break up each word and put the contents of each word into an array. Then echo out the contents of that array. $string = “Tomato Sausage Cheese Peppers Mushrooms”;

OOP in PHP ✤ Object Oriented Programming ✤ Objects and Classes ✤ PHP4 vs PHP5 ✤ Design Patterns ✤ Example

OOP in PHP ✤ Objects are discrete bundles of functions relating a concept (database connections, image creation, managing users) ✤ Objects work together to create applications. ✤ Service multiple projects with a single set of code. ✤ Code is portable, encapsulated, reusable and easier to debug.

OOP Example

OOP Car ✤ Functions of a car ✤ Accelerate, Stop, Steering ✤ How? (implementation) ✤ Gas Pedal, Engine ✤ Breaks ✤ Steering and Wheels ✤ Care how it works? No.

Object Oriented Programming ✤ What is an object: ✤ A “copy” or “instance” of a class. ✤ Objects have properties (color, speed, horsepower, seats) ✤ Objects have methods (accelerate, stop, steering).

Object Oriented Programming ✤ <?php ✤ /* ✤ * File Name: car ✤ * Date: November 18, 2010 ✤ * Author: Lincoln Mongillo ✤ * Description: Manages Car ✤ */ ✤ class Car ✤ { ✤ } ✤ ?>

Object Oriented Programming ✤ <?php ✤ $myRaceCar = new Car(); ✤ $myRaceCar -> accelerate(55); ✤ ?>

Object Oriented Programming ✤ Car = a basic blueprint that represents any car. ✤ color ✤ wheels ✤ seats ✤ horsepower ✤ With Car we can “create” other types of speciality cars: dump trucks, sports cars. How? Classes can “inherit” properties and methods from other classes.

Object Oriented Programming Car race car truck wheels: 4 color: white seats: 4 horsepower: 8 wheels: 4 color: white seats: 2 horsepower: 200 wheels: 4 color: white seats: 4 horsepower: 200 wheels: 4 color: white seats: 4 horsepower: 200 wheels: 4 color: red seats: 8 horsepower: 100

Object Oriented Inheritance ✤ <?php ✤ /* ✤ * File Name: RaceCar ✤ * Date: November 18, 2008 ✤ * Author: Lincoln Mongillo ✤ * Description: Manages RaceCars ✤ */ ✤ class RaceCar extends Car ✤ { ✤ } ✤ ?>

Object Oriented Polymorphism A Truck vs. Race Car come from car. Extending a class allows for “Polymorphism” which allows you to perform different tasks based on the context you’re using it in. Example: stop() between truck vs. racecar is somewhat the same but different because of the nature of the truck (size) and racecar (speed). It might implement the method differently to get the result.

Object Oriented Encapsulation ✤ Don’t need to know how it works (members functions or props) ✤ You just need to know what you can do (available methods - interface)

Object Oriented Encapsulation ✤ How do you know what you can use? ✤ Levels of visibility ✤ public: means that a class member is visible and usable / modifiable by everyone - default in PHP ✤ private: means that a class member is only usable / modifiable by the class itself ✤ protected: means that a class member is only usable / modifiable by the class itself and eventual sub-classes

Class Constructor - PHP4 ✤ <?php ✤ class Car ✤ { ✤ public function Car() { ✤ echo "We just created and object!"; ✤ } ✤ ?>

Class Constructor - PHP5 ✤ <?php ✤ class Car ✤ { ✤ function __construct() { ✤ echo "We just created and object!"; ✤ } ✤ ?>

Class Constructor - Properties ✤ <?php ✤ class Car ✤ { ✤ private $color; ✤ private $wheels; ✤ private $seats; ✤ function __construct() { ✤ $this->color = “OxFFFFF”; ✤ $this->wheels = 4; ✤ } ✤ ?>

Class Constructor - Properties ✤ function __construct() { ✤ $this->color = “OxFFFFF”; ✤ $this->wheels = 4; ✤ ✤ // $this is a reference to the object that is calling it. ✤ $truck = new Car(); // $this = truck.

Object Oriented Programming Image Example Database Example

Lab & Next Week ✤ Please send me your Survey in word doc format. ✤ Your personal DB will be updated next week and we will start working on the app.

Lab & Next Week ✤ Homework ✤ Complete Presidents CRUD system

Lab & Next Week ✤ Next week we will ✤ Create Registration system ✤ Create Login w\ Encrypt Password. ✤ Security and Authorization ✤ Reading: Chapter 8 See you Tuesday!