473,836 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object Oriented PHP

I am new to PHP, just one day new. But I am otherwise a seasoned
programmer on many other languages like C, VB 6, C#, VB.NET, Win32
platform and have some tiny bit experience in MFC, C++, Python.

All the tutorials I read so far about PHP contain procedural examples.
I haven't yet come accross a tutorial on the object oriented PHP. Could
someone point me to one?

Jun 17 '06
73 4522
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:cY***** *************** **********@comc ast.com...
Tony Marston wrote:
>"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
<snip>

>Just because my understanding and implementation of OOP is different

>from yours does not make you right and me wrong.

Other than the fact your understanding and implementation is different

from every expert in the field.
What you mean is that people who think like you are the so-called
*experts* while those who choose to think differently are *idiots*. What
an arrogant pratt you are to think that YOUR brand of OO is the only true
brand.


My understanding comes from people like Grady Booch, James Rumbaugh and
Ivar Jacobson - and is in complete agreement with these people. But of
course, they disagree with you, so you'll call them idiots, also.
You *think* you understand OO. But you have no idea what *real* OO is
about. Otherwise you wouldn't be making some of your comments.
OO is about encapsulation, polymorphism and inheritance. Nothing more,
nothing less. What you choose to call *real* OO I call *bastardised* OO
because some people of low intelligence are trying to make it more
difficult than it really is.


Also message passing - which you seem to conveniently forget.

OO is about encapsulation, polymorphism and inheritance. Message passing is
incidental.

And YOU are the one "bastardizi ng" OO. Your sloppy approach to
programming is just what *real* OO is designed to eliminate. And it makes
the coding much more maintainable, expandable and modifiable.

Not the way some people use OO. They deliberately make it more complicated
than it need be, while I keep it as simple as possible.


And that is where you are 100% wrong. Message passing is an integral part of
both object-based and object-oriented languages.

One bit of wisdom, Tony. Tis better to remain silent and have everyone thing
you might be a fool than to open your mouth and remove all doubt.

In the OO world you have removed all doubt.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 26 '06 #41
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:cY***** *************** **********@comc ast.com...
Tony Marston wrote:
>"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
<snip>

>Just because my understanding and implementation of OOP is different

>from yours does not make you right and me wrong.

Other than the fact your understanding and implementation is different

from every expert in the field.
What you mean is that people who think like you are the so-called
*experts* while those who choose to think differently are *idiots*. What
an arrogant pratt you are to think that YOUR brand of OO is the only true
brand.


My understanding comes from people like Grady Booch, James Rumbaugh and
Ivar Jacobson - and is in complete agreement with these people. But of
course, they disagree with you, so you'll call them idiots, also.
You *think* you understand OO. But you have no idea what *real* OO is
about. Otherwise you wouldn't be making some of your comments.
OO is about encapsulation, polymorphism and inheritance. Nothing more,
nothing less. What you choose to call *real* OO I call *bastardised* OO
because some people of low intelligence are trying to make it more
difficult than it really is.


Also message passing - which you seem to conveniently forget.

OO is about encapsulation, polymorphism and inheritance. Message passing is
incidental.

And YOU are the one "bastardizi ng" OO. Your sloppy approach to
programming is just what *real* OO is designed to eliminate. And it makes
the coding much more maintainable, expandable and modifiable.

Not the way some people use OO. They deliberately make it more complicated
than it need be, while I keep it as simple as possible.


And the way you use OO is a bastardization of OO techniques.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 26 '06 #42
Tim Van Wassenhove wrote:
On 2006-06-25, David Haynes <da***********@ sympatico.ca> wrote:
PHP5 has weak polymorphism but not true polymorphism in the sense that
it is used in OOP.


So how would you define polymorphism? And what exactly are the
differences between 'weak' and 'true' polymorphism?

If i look at http://en.wikipedia.org/wiki/Polymor...ter_science%29

"The concept of polymorphism applies to data types in addition to
functions. A function that can evaluate to and be applied to values of
different types is known as a polymorphic function. A data type that
contains elements of different types is known as a polymorphic data
type."
function __construct($on e, $two="two", $three="three") {

I cannot instantiate this object as new Foo($one, $three) since there is
no typing on the arguments and, therefore, no signature for a 'one,
three' contructor. .


Imho that's the same as saying: I'm standing with my back against a wall,
and now i'm wondering why i can't step backwards anymore...

Define your constructor as __constructor($ args) and handle with
func_num_args and func_get_args(s ) any number of parameters...

(I do agree that the language/compiler can, probably should, make this
easier... But that's a different discussion.)

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be >

There are two annoying problems with this, which is why its such a nice
feature to have:

1) It is a pain in the but to have to order out and determine the types
of the passed variables. Whenever I make classes i always end up
having to spend 100+ lines trying to figure out the types of variables
passed to sort out what goes where. Why? One object returns an
indexed array, another an associative array, other return other objects
of various types. The reason for being able to call the function with
any of these types is so that I don't have to pre-process the data and
can operate more efficently on the passed value. What ends up
happening is converting everything to an array, or string, or object,
or what not. A lot of extra work on my part and the program's part
that would otherwise be handled by a compiler.

They have type hints in PHP5, but they are more like type requirements,
as it causes a fatal error and is largely useless unless you
pre-process things to match that definition. I'd much rather be able
to create multiple methods with different signatures that could be
called if the parameters match, but thats not really feasible in a
typeless language.

2) It makes overriding methods harder in derived classes. Why?
Because the overridden method is completely hidden and you must convert
parameters to what it expects to be able to use its functionality.
This happened to me while extending HTML_Table from pear. Its addRow
method accepts 2 types of arrays, and invokes different completely code
paths depending on the array type, which is determined by a private
method thats not (well, shouldn't be) accesible from the derived class.
Ideally, all i would have to do is override addRow, modify the incoming
data to match what the original addRow expects, then pass it up.
Extension with minimum effort. However, because the addRow method uses
several private methods and a bunch of code and logic to determine what
to do, I either have to:
- Duplicate all that logic and code (including the private methods,
default values, etc), then pass it up to addRow to have it done again,
which is a lot of redunant work, or
- Pass it up to addRow then modify the object accordingly, which
performs several of the same operations addRow did originally (as well
as introducing a caveat of overwriting instead of updating certain
attributes, which limits the functionality in a few cases).

If i could just override the method to accept the single object i
wanted to pass it, while the original method existed and could be
called directly, all of that could have been avoided.

Then there is the lack of multiple inheritence in PHP. Considering the
wide breadth of small operations a single object should be able to do,
its completely insane to have to rewrite the exact same interface code
again and again for the smallest of operations (a problem that rears
its head in java gui programing, when you have to implement an
interface then manually delegate all methods to an instance of a class
that has a handle back to the container, more needless complication
that could have been handled by MI). I'm getting off topic though.
Please, continue the flame war.

Jun 26 '06 #43

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:Gc******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce******** *************** *******@comcast .com...
<snip>
OO is about encapsulation, polymorphism and inheritance. Nothing more,
nothing less. What you choose to call *real* OO I call *bastardised* OO
because some people of low intelligence are trying to make it more
difficult than it really is.
Also message passing - which you seem to conveniently forget.

OO is about encapsulation, polymorphism and inheritance. Message passing
is incidental.

And YOU are the one "bastardizi ng" OO. Your sloppy approach to
programming is just what *real* OO is designed to eliminate. And it
makes the coding much more maintainable, expandable and modifiable.

Not the way some people use OO. They deliberately make it more
complicated than it need be, while I keep it as simple as possible.


And the way you use OO is a bastardization of OO techniques.


That's just your opinion. Just because my implementation of OO is different
from yours does not make it wrong, merely different. If you believe that
YOUR way is the ONLY way then you are just being arrogant.

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

Jun 26 '06 #44

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:tM******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce******** *************** *******@comcast .com...
<snip>
OO is about encapsulation, polymorphism and inheritance. Message passing
is incidental.

And YOU are the one "bastardizi ng" OO. Your sloppy approach to
programming is just what *real* OO is designed to eliminate. And it
makes the coding much more maintainable, expandable and modifiable.

Not the way some people use OO. They deliberately make it more
complicated than it need be, while I keep it as simple as possible.


And that is where you are 100% wrong. Message passing is an integral part
of both object-based and object-oriented languages.

One bit of wisdom, Tony. Tis better to remain silent and have everyone
thing you might be a fool than to open your mouth and remove all doubt.

In the OO world you have removed all doubt.


The three principles of OO are encapsulation, polymorphism and inheritance.
Message passing does not appear in that list, so it is a minor detail.

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

Jun 26 '06 #45
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:tM******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce***** *************** **********@comc ast.com...

<snip>
OO is about encapsulation, polymorphism and inheritance. Message passing
is incidental.

And YOU are the one "bastardizi ng" OO. Your sloppy approach to
programmi ng is just what *real* OO is designed to eliminate. And it
makes the coding much more maintainable, expandable and modifiable.
Not the way some people use OO. They deliberately make it more
complicate d than it need be, while I keep it as simple as possible.


And that is where you are 100% wrong. Message passing is an integral part
of both object-based and object-oriented languages.

One bit of wisdom, Tony. Tis better to remain silent and have everyone
thing you might be a fool than to open your mouth and remove all doubt.

In the OO world you have removed all doubt.

The three principles of OO are encapsulation, polymorphism and inheritance.
Message passing does not appear in that list, so it is a minor detail.


And that's where you are totally wrong.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 26 '06 #46
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:Gc******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce***** *************** **********@comc ast.com...

<snip>
OO is about encapsulation, polymorphism and inheritance. Nothing more,
>nothing less. What you choose to call *real* OO I call *bastardised* OO
>because some people of low intelligence are trying to make it more
>difficul t than it really is.
>

Also message passing - which you seem to conveniently forget.
OO is about encapsulation, polymorphism and inheritance. Message passing
is incidental.

And YOU are the one "bastardizi ng" OO. Your sloppy approach to
programmi ng is just what *real* OO is designed to eliminate. And it
makes the coding much more maintainable, expandable and modifiable.
Not the way some people use OO. They deliberately make it more
complicate d than it need be, while I keep it as simple as possible.


And the way you use OO is a bastardization of OO techniques.

That's just your opinion. Just because my implementation of OO is different
from yours does not make it wrong, merely different. If you believe that
YOUR way is the ONLY way then you are just being arrogant.


And the opinion of other experts in the field - such as the ones I mentioned before.

Your implementation violates some of the basic reasons for even having OO! And
no, I don't believe MY way is the only way. But I believe the experts in the
field know a hell of a lot more about it than you do.

I suspect you've had no real-world OO experience. Large, complex projects OO is
designed to make easier. All of your experience is probably simple PHP pages
you do yourself with no collaboration.

Your attitude would never survive in a the large scale projects I've been
involved in (100+ programmers, 2 years+ time). But then it wouldn't survive the
smaller projects I've been involved in, either - (i.e. three programmers for two
months).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 26 '06 #47
Jerry Stuckle wrote:
Actually, things like private declarations are very important.


IMHO private declarations are too rigid and therfore decrease
reusability. I agree that it can be very usefull to know the intentions
of the developer of some code one is evaluating to call or some member
variable one is avaluating to access. But every now and then there are
good reasons to do it anyway, even if it was intended to be private. For
example lazy initialization and default reasoning both are often
implemented using direct access to member variables. Another example is
using a visitor to implement persistency.

Now maybe you would say that i should change these member variables to
protected or public. There are two problems with this:
1. It may not be my own code. Then if i get an upgrade of this code,
these member variables will once again be private, unless i re-apply my
changes. This is uneccessary overhead.
2. By changing the private declaration the intension of the other
developer gets lost. Now i could put a comment in that it was intended
to be private, but in that case: why not put the @private marker in the
comment in the first place?

The fundamental point is: With these private and protected declarations
you get stuck with the uneccessarily limitations introduced by the
author. Object-orientation can lead to more reusability then
conventional parameterized code exactly because the code can be
overridden and extended in ways the original author did not provide for.
private and protected declarations are a step backwards that is only
reasonable if you assume that future developers that will maintain or
reuse your code will ignore your intentions becuase they are fools. If
this is the case, i think you should tell your boss that you are
limiting the reusability of your code because you are aniticipating him
to hire fools and let them work on/with your code ;-)

Greetings,

Henk Verhoeven,
www.phpPeanuts.org.
Jun 26 '06 #48

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:7f******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:tM******** *************** *******@comcast .com...
Tony Marston wrote:

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce**** *************** ***********@com cast.com...


<snip>
OO is about encapsulation, polymorphism and inheritance. Message passing
is incidental.

>And YOU are the one "bastardizi ng" OO. Your sloppy approach to
>programmin g is just what *real* OO is designed to eliminate. And it
>makes the coding much more maintainable, expandable and modifiable.
Not the way some people use OO. They deliberately make it more
complicat ed than it need be, while I keep it as simple as possible.
And that is where you are 100% wrong. Message passing is an integral
part of both object-based and object-oriented languages.

One bit of wisdom, Tony. Tis better to remain silent and have everyone
thing you might be a fool than to open your mouth and remove all doubt.

In the OO world you have removed all doubt.

The three principles of OO are encapsulation, polymorphism and
inheritance. Message passing does not appear in that list, so it is a
minor detail.


And that's where you are totally wrong.


Excuse me? After performing a google search on OOP all I see quoted time
after time are the three basic principles - encapsulation, inheritance and
polymorphism - so how could I possibly be wrong?

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

Jun 26 '06 #49

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:qe******** *************** *******@comcast .com...
Tony Marston wrote:
"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:Gc******** *************** *******@comcast .com...
Tony Marston wrote:

"Jerry Stuckle" <js*******@attg lobal.net> wrote in message
news:ce**** *************** ***********@com cast.com...

<snip>
>>OO is about encapsulation, polymorphism and inheritance. Nothing more,
>>nothing less. What you choose to call *real* OO I call *bastardised*
>>OO because some people of low intelligence are trying to make it more
>>difficu lt than it really is.
>>
>
>Also message passing - which you seem to conveniently forget.
OO is about encapsulation, polymorphism and inheritance. Message passing
is incidental.

>And YOU are the one "bastardizi ng" OO. Your sloppy approach to
>programmin g is just what *real* OO is designed to eliminate. And it
>makes the coding much more maintainable, expandable and modifiable.
Not the way some people use OO. They deliberately make it more
complicat ed than it need be, while I keep it as simple as possible.
And the way you use OO is a bastardization of OO techniques.

That's just your opinion. Just because my implementation of OO is
different from yours does not make it wrong, merely different. If you
believe that YOUR way is the ONLY way then you are just being arrogant.


And the opinion of other experts in the field - such as the ones I
mentioned before.


Even experts disagree on what is or is not the *right* way in OO, so all I
am doing is agreeing with those experts who disagree with your your
favourite experts.
Your implementation violates some of the basic reasons for even having OO!
And no, I don't believe MY way is the only way. But I believe the experts
in the field know a hell of a lot more about it than you do.
I disagree. I am using the three basic principles of OO, as documented, to
achieve a higher level of reuse than I could by using non-OO techniques.
I suspect you've had no real-world OO experience. Large, complex projects
OO is designed to make easier. All of your experience is probably simple
PHP pages you do yourself with no collaboration.
At least I have not been taught by people who don't know what they're
talking about.
Your attitude would never survive in a the large scale projects I've been
involved in (100+ programmers, 2 years+ time). But then it wouldn't
survive the smaller projects I've been involved in, either - (i.e. three
programmers for two months).


The size of project is irrelevant. The OOP principles are the same
regardless of the size of project. The only project I have ever been
associated with which failed disastrously was one where the system
architects got carried away with their fancy ideas of how OOP should be
implemented and produced something that was so inefficient and unproductive
that the client cancelled the entire project as soon as the first live
programs were produced. It was THEIR attitude that was wrong, not mine.

--
Tony Marston

http://www.tonymarston.net
http://www.radicore.org

Jun 26 '06 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1665
by: Benjamin C. Pierce | last post by:
The Twelth International Workshop on Foundations of Object-Oriented Languges (FOOL 12) Saturday 15 January 2005 Long Beach, California, USA Following POPL 05 The search for sound principles for object-oriented languages has given rise to much work on the theory of programming languages during the past two decades, leading to a better understanding of the key
5
2930
by: Martin | last post by:
When was inheritance intruduced into object oriented programming? More generally, does anyone know or have any sources on when the different features were introduced into object oriented programming?
34
7122
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. Yensao
65
4304
by: Roger Smythe | last post by:
A means for the progressive decomposition a problem space into increasingly simpler component parts such that these component parts represent higher levels of conceptual abstraction, and are completely independent of each other except for their well-defined interfaces. This was an attempt to explain the gist of OOP to programmers accustomed to the structured programming paradigm. I tried to explain OOP in terms of ideals that can be...
14
2942
by: Rookie | last post by:
Is C an object oriented programming language?
100
5321
by: E. Robert Tisdale | last post by:
What is an object? Where did this term come from? Does it have any relation to the objects in "object oriented programming"?
8
1805
by: cppig1995 | last post by:
C++ is not only object-oriented language. I think the description of this group have to be changed. :-) Have fun! ---- cppig1995 (cppig1995@gmail.com) Daejeon Metropolitan City, Republic of Korea 11 years old in Western age.
47
5973
by: Thierry Chappuis | last post by:
Hi, I'm interested in techniques used to program in an object-oriented way using the C ANSI language. I'm studying the GObject library and Laurent Deniau's OOPC framework published on his web site at http://ldeniau.web.cern.ch/ldeniau/html/oopc/oopc.html. The approach is very instructive. I know that I could do much of this stuff with e.g. C++, but the intellectual challenge of implementing these concepts with pure ANSI C is relevant to...
46
3042
by: ajba74 | last post by:
Hi fellows, I am reading some books to learn the C programming language, and sometimes I have the feeling that when somebody becomes a C expert, he must learn a more modern and object-oriented language. When I read things like "... C++ is an evolution of C ..." or "... C is a subset of C++ ..." I tend to believe that I will have to learn C+ + sooner or later. It sounds like C++ is the future and C is the past (and will be no longer...
3
1551
by: notnorwegian | last post by:
i have some confusion over this. sure a class is basically a classification, like for example an animal or flower. and an object/instance of that class is then for example a cat. an object is an instance of a class. that i know, i also know how to program with classes etc. i am just confused about the term object-oriented.
0
9811
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9657
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10532
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7774
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6975
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4443
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.