Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.
PHP and object oriented programming.
Transcript of PHP and object oriented programming.
What is object oriented programming? OOP is a type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. The most basic set of vocabulary for OOP is a class, an object, a property, a method, and a parameter. One of the key concepts for OOP is inheritance.
OOP isn’t as linear as procedural programming. Code is often broken up and distributed across multiple files, each one with a single purpose. OOP is also more abstract than procedural programming because it looks for patterns and reusability. The same code can be loaded and executed many times to accomplish a task without having to retype it.
A class is a set of functions that work together to accomplish a task. It can contain or manipulate data, but it usually does so according to a pattern rather than a specific implementation. An instance of a class is considered an object.
Class An object receives all of the characteristics of a class, including all of its default data and any actions that can be performed by its functions. The object is for use with specific data or to accomplish particular tasks. To make a distinction between classes and objects, it might help to think of a class as the ability to do something and the object as the execution of that ability in a distinct setting. Object A method simply refers to a function that is encased in a class. Method A parameter is a variable that is passed into a function that instructs it how to act or gives it information to process. Parameters are also sometimes called arguments.
Parameter A property is a default set of data stored in a class. A class can have multiple properties and the properties can be changed dynamically through the methods of the class.
Property Inheritance is one of the keys that make OOP tick. Classes can inherit methods and properties from other classes by extending them and each class can be extended by multiple classes. This means that we can start with a base (or parent) class that contains shared characteristics among several classes. That base class can then be extended by other classes (children) that are similar but are meant for slightly different purposes. Any changes in the parent class will automatically cascade to its children.
Inheritance Car() is a class Sedan() is a subclass, inherited from Car() HondaCivic() is an object driveForward() is a method color() is a property Popular OOP languages: C#, Ruby,C++, Python, Java, Perl, VB.NET.
A number of researchers and programmers have criticized OOP as slow comparing to procedural programming. Joe Armstrong, the principal inventor of Erlang, is quoted as saying "The problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle." Descriptive tools for preparing a programming project What tool to use? Unified Modeling Language is a standardized general-purpose modeling language in the software engineering. The Unified Modeling Language is used to specify, visualize, modify, construct and document the artifacts of an object-oriented software intensive system under development.
Unified Modeling System(UML) UML includes a set of graphic notation techniques to create visual models of software-intensive systems. UML diagrams represent two different views of a system model:
Static (or structural) view: Emphasizes the static structure of the system using objects, attributes, operations and relationships. The structural view includes class diagrams and composite structure diagrams.
Dynamic (or behavioral) view: Emphasizes the dynamic behaviour of the system by showing collaborations among objects and changes to the internal states of objects. This view includes sequence diagrams, activity diagrams and state machine diagrams.
Why use UML? A visual modelling language, such as UML, allows software to be visualised in multiple dimension, so that a computer system can be completely understood before construction begins. The overall view of the software can quickly and easily be defined at the start of the project with a high level model allowing for accurate estimation. The code can then be tested against a test model that is derived from the original model of requirements. Class diagram Class diagrams typically describe the different entities of a system as classes and the relation between these. This may for example include
system parts and their relation
interfaces of communicating parts
messages and operations of interfaces Use case model is an excellent tool for elicitation of functional requirements. The activity consists of identifying use cases and actors and describing the details of each use case. *Diagram taken from : http://netbeans.org/kb/61/uml/class-diagram.html Use cases *Image from: http://netbeans.org/kb/61/uml/use-case.html 1.Title
Bataleon new snowboard design line site
2.Use case starts
This diagram starts when a customer reads an ad of Bataleon in the magazine containing a link to the web page.
The primary functions are for the user to see Bataleon's available designs and for Bataleon to show their available designs to the user.
A new customer visits the site to have a closer look at an new snowboard design line mentioned in a magazine ad. The design will be linked on the front page for as long as the magazine ad is valid. The user will follow the link, get more info on the design he chose and if interested visit the local sports store.
5. Use Case Ends
The use case ends when the user has found an interesting design on the page.
Use cases example from bataleon project. What is PHP? PHP(Hypertext Preprocessor) is a server side scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in.PHP also contains a number of extensions that make it easy to interact with databases, extracting data to be displayed on a web page and storing information entered by a web site visitor back into the database.
Usage Like any other scripting language it allows developers to build logic into the creation of dynamic web page content and handle data returned from a web browser. You can use PHP to create dynamic web pages, forums, blogs, webshops. When there is a big amount of data needed PHP is a way to go, since it makes easy to add, store and extract data from databases.
How it works? When a user visits a web site or clicks on a link on a page the browser sends a request to the web server hosting the site asking for a copy of the web page. The web server receives the request, finds the corresponding web page file on the file system and sends it back, over the internet, to the user's browser.
Analysis of PHP or alternative technologies used in former projects. Use of PHP PHP was mostly used in projects for contact form, to be able send mail directly from contact page not using any mail client(Outlook, The Bat, Mail.app ) Also PHP was used in webshop. Drupal CMS and Ubercart are all written in PHP Alternatives to PHP Ruby on Rails (twitter.com is made using RoR)
ASP.NET(from Microsoft) Examples Mail sending form using php.
$contact_name = $_POST['name'];
$contact_email = $_POST['email'];
$contact_subject = $_POST['subject'];
$contact_message = $_POST['message'];
if( $contact_name == true )
$sender = $contact_email;
$receiver = "email@example.com";
$client_ip = $_SERVER['REMOTE_ADDR'];
$email_body = "Name: $contact_name \nEmail: $sender \n\nSubject: $contact_subject \n\nMessage: \n\n$contact_message \n\nIP: $client_ip \n\nFlash";
$extra = "From: $sender\r\n" . "Reply-To: $sender \r\n" . "X-Mailer: PHP/" . phpversion();
if( mail( $receiver, "Contact Form from PRESIITE - $contact_subject", $email_body, $extra ) )