background preloader

Objekt-Oriented Programming

Facebook Twitter

Objektorientierte Programmierung mit PHP5. 1. Ein Wort in eigener Sache Warum macht sich eigentlich jemand die Mühe und verfasst noch mal eine Einführung zum Thema "Objektorientierte Programmierung mit PHP 5"? Davon gibt es doch Massen im Internet. Nun, ursprünglich hatte ich das gar nicht vor. "Das Ablegen einer Referenz auf ein anderes Objekt in einer Instanzvariablen eines Objektes nennt man Aggregation.

" "Klassenmember oder -methoden als statisch zu deklarieren macht diese zugänglich, ohne dass man die Klasse instantiieren muss. Alles klar? So habe ich mir denn mal die Mühe gemacht, dieses Informatiker-"Deutsch" für euch zu übersetzen und in eine für Anfänger einigermaßen verständliche Form zu bringen. 2. Um diese Frage zu beantworten, muss ich erst mal auf die unterschiedlichen Programmierstile eingehen, die in PHP möglich sind. Unstrukturierte Ablaufsteuerung Dies ist der klassische Anfängerstil. Strukturierte und funktionsbasierte Steuerung Objektorientierte Programmierung (OOP) 3. 4. Nein! 5. Weiter zum nächsten Abschnitt.

Learning OOP in PHP ASAP! Using PHP Objects to access your Database Tables (Part 1) By Tony Marston 31st May 2003 Intended AudiencePrerequisitesAn introduction to OO functionality within PHP- Creating a Class with Properties and Methods- The 'constructor' method- Extending a Class- Creating an Object- Accessing an Object's Properties and Methods- Objects and SessionsMy 'database_table' class- Background- Class Variables- Class Constructor- 'getData' Method- 'insertRecord' Method- 'updateRecord' Method- 'deleteRecord' MethodUsing this Class- Controller scriptsStandard functions- db_connect- Error HandlerSummary Intended Audience This tutorial is intended for developers who have already written code to get data in and out of a MySQL database, but who wish to discover if there are any benefits of adopting an Object Oriented approach.

This tutorial will show you how to create an abstract class which can deal with any database table, and then how to create subclasses containing the implementation details for each individual table within your application. Prerequisites return; } PHP Help Tutorial: OO PHP Part 1: OOP in Full Effect. Introduction On the old site, I started a series of tutorials named "PHP Application Design". I planned for at least three parts, and while I did publish the first two and wrote at least half of part three, I found myself out of time to make it to the finish.

Still dedicated to writing reusable and extensible PHP code and spreading the knowledge, this is a restart of the series, renamed as simply "OO PHP". So: Welcome to part one of the "OO PHP" series. This article is an overview of what PHP has to offer with respect to OOP, with examples on how to use these concepts. If you have wanted to grasp OOP, but haven't come around to learning it, this article is for you.

A couple of things have changed in this tutorial. Index 1. 1. 1.1 A tiny bit of theory So what is an object anyway? An object is an instance of a class with the following essential properties: Each object has its own identity.Each object can have certain behaviour.Each object is in a state. Each object has its own identity. Wait.