Re: [PHP] OOP and Future of PHP

2001-04-26 Thread Ulf Wendel



Rasmus Lerdorf schrieb:
  If anyone has any idea, or tricks to hide information in a variables or
  method in a class, or in other words, make a variable or method a private,
  I would really like to know. Thanks for any comments.
 
 PHP also doesn't have introspection, so there isn't a good way for people
 to see what is in your API so a bit of obscurity should hide things for
 you.

Hmm, the old, dirty hack print_r($obj). And the new functions:

http://www.php.net/manual/en/function.get-class.php
http://www.php.net/manual/en/function.get-class-vars.php
http://www.php.net/manual/en/function.get-object-vars.php
http://www.php.net/manual/en/function.get-class-methods.php
...

I'd call these not only debugging function but functions that can be
used for introspection.

Anyway, people should not use parts of the API your documentation does
not mention as public. Whoever does so, should reread the book on OOP.
Yes, it could be better, but think of the zillions of PHP scripts that
will break and all the beginners - PHP is quite often a beginners
language - will ask you, Reuben, for support ;).

Ulf

-- 
Neu: PEAR Cache Erweiterung OutputCompression
http://www.ulf-wendel.de/php/show_source.php?file=out_cache_com
http://www.phpdoc.de

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-26 Thread Ulf Wendel



Yasuo Ohgaki schrieb:
 I don't use GDB, but it seems it supports traceback.
 How about Zend Debugger? Does it support? Anyone?

http://dd.cron.ru/dbg/ ?

Ulf

-- 
Neu: PEAR Cache Erweiterung OutputCompression
http://www.ulf-wendel.de/php/show_source.php?file=out_cache_com
http://www.phpdoc.de

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-26 Thread Yasuo Ohgaki

 
 
 Yasuo Ohgaki schrieb:
  I don't use GDB, but it seems it supports traceback.
  How about Zend Debugger? Does it support? Anyone?
 
 http://dd.cron.ru/dbg/ ?
 
 Ulf

Thanks for correcting my typo, Ulf.
GDB = DBG :)

Yasuo Ohgaki

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-26 Thread Steven Haryanto

At 4/26/2001 12:10 PM, Yasuo Ohgaki wrote:
  What I *really* like to see in PHP is:
 
  - NAMESPACE
  - TRACEBACK INFO
  - exception (try-except block)
  - $obj-method()-anotherMethod()
  - real destructor would be nice, but not extremely important for
 the time being, due to the nature of PHP usage in Web pages

I agree, but

$obj-method()-anotherMethod()
works for me. What does not work to be specific?

Hm, I'm using 4.0.4pl1. Perhaps this has been added somewhere in
the 4.0.5RC series? Sorry, haven't got the chance of trying that
(apart from using the PEAR from 4.0.5RC2).

===
class C1 {
 function f() { return $this; }
 function g() { echo Hi!; }
}

$C=new C;
$C-f()-g();
===

does not work me here.

I don't use GDB, but it seems it supports traceback.
How about Zend Debugger? Does it support? Anyone?

Yes, I've heard that it supports traceback. I guess this means I
have to use a source-level debugger for now. Lacking a stack trace
leads to a rather cumbersome error reporting, since I have to
supply __LINE__, __FILE__, and the name of the function in every
call to the error function.

Regards,
Steve


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-26 Thread Yasuo Ohgaki

 At 02:10 PM 4/26/2001 +0900, Yasuo Ohgaki wrote:
 Steven Haryanto [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
   At 4/25/2001 09:02 PM, Reuben D Budiardja wrote:
 
 *SNIP*
 
   What I *really* like to see in PHP is:
  
   - NAMESPACE
   - TRACEBACK INFO
   - exception (try-except block)
   - $obj-method()-anotherMethod()
   - real destructor would be nice, but not extremely important for
  the time being, due to the nature of PHP usage in Web pages
 
 I agree, but
 
 $obj-method()-anotherMethod()
 
 works for me. What does not work to be specific?
 
 I don't know how it works for you because it's not supported :)
 

I got it what you and he means.
I thought $obj-anotherObj-method(), but it was 

 $obj-method()-anotherMethod()

He means calling anotherMethod() from a method(), it does not work :)
Is there any good supporting this? (and why need this?)

--
Yasuo Ohgaki



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-26 Thread Yasuo Ohgaki

Sorry about sloppy reading.
I misunderstood what he means  :(
It does not work.

--
Yasuo Ohgaki

- Original Message - 
From: Steven Haryanto [EMAIL PROTECTED]
To: Yasuo Ohgaki [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, April 26, 2001 4:22 PM
Subject: Re: [PHP] OOP and Future of PHP


 At 4/26/2001 12:10 PM, Yasuo Ohgaki wrote:
   What I *really* like to see in PHP is:
  
   - NAMESPACE
   - TRACEBACK INFO
   - exception (try-except block)
   - $obj-method()-anotherMethod()
   - real destructor would be nice, but not extremely important for
  the time being, due to the nature of PHP usage in Web pages
 
 I agree, but
 
 $obj-method()-anotherMethod()
 works for me. What does not work to be specific?
 
 Hm, I'm using 4.0.4pl1. Perhaps this has been added somewhere in
 the 4.0.5RC series? Sorry, haven't got the chance of trying that
 (apart from using the PEAR from 4.0.5RC2).
 
 ===
 class C1 {
  function f() { return $this; }
  function g() { echo Hi!; }
 }
 
 $C=new C;
 $C-f()-g();
 ===
 
 does not work me here.
 
 I don't use GDB, but it seems it supports traceback.
 How about Zend Debugger? Does it support? Anyone?
 
 Yes, I've heard that it supports traceback. I guess this means I
 have to use a source-level debugger for now. Lacking a stack trace
 leads to a rather cumbersome error reporting, since I have to
 supply __LINE__, __FILE__, and the name of the function in every
 call to the error function.
 
 Regards,
 Steve
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] OOP and Future of PHP

2001-04-25 Thread Reuben D Budiardja


The only thing that I feel lack of in PHP is the real Object Oriented 
stuff, such as information hiding in the object in classes i.e. private and 
public variables, methods/functions.

This in a sene make it really difficult for developer to build an API for 
other developers that is secure. I myself have this problem. Is there any 
reasons why PHP was designed like this from the beginning? Is this issue 
going to be addresses somehow in the future? Anyone has any idea?

If anyone has any idea, or tricks to hide information in a variables or 
method in a class, or in other words, make a variable or method a private, 
I would really like to know. Thanks for any comments.


Reuben D. Budiardja
Web Database Application Programmer / Analyst
Devcorps, ITS
Goshen College, IN 46526


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-25 Thread Steven Haryanto

At 4/25/2001 09:02 PM, Reuben D Budiardja wrote:

The only thing that I feel lack of in PHP is the real Object 
Oriented stuff, such as information hiding in the object in 
classes i.e. private and public variables, methods/functions.

This in a sene make it really difficult for developer to build 
an API for other developers that is secure. I myself have this 
problem. Is there any reasons why PHP was designed like this 
from the beginning? Is this issue going to be addresses somehow 
in the future? Anyone has any idea?

If anyone has any idea, or tricks to hide information in a 
variables or method in a class, or in other words, make a 
variable or method a private, I would really like to know. 
Thanks for any comments.

Python also does not do information hiding, but people rarely call
Python's OO features as not real. :-)  It's a matter of choice,
though, I don't see any real hindrance of PHP implementing this
in the future version.

As Rasmus said, PHP does not have introspection (once again, unlike
Python which is very introspective), this is less of a problem,
especially with function calls API.

What I *really* like to see in PHP is:

- NAMESPACE
- TRACEBACK INFO
- exception (try-except block)
- $obj-method()-anotherMethod()
- real destructor would be nice, but not extremely important for
   the time being, due to the nature of PHP usage in Web pages

Please tell me it's on the top'ish of the TODO list :-)

Steve 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP and Future of PHP

2001-04-25 Thread Yasuo Ohgaki

Steven Haryanto [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 At 4/25/2001 09:02 PM, Reuben D Budiardja wrote:

*SNIP*

 What I *really* like to see in PHP is:

 - NAMESPACE
 - TRACEBACK INFO
 - exception (try-except block)
 - $obj-method()-anotherMethod()
 - real destructor would be nice, but not extremely important for
the time being, due to the nature of PHP usage in Web pages

I agree, but

$obj-method()-anotherMethod()

works for me. What does not work to be specific?

I don't use GDB, but it seems it supports traceback.
How about Zend Debugger? Does it support? Anyone?

Regards,
--
Yasuo Ohgaki


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] OOP question regarding class extension

2001-03-19 Thread John Guynn

Can one class extend multiple classes?  I'm still playing with OOP
functionality and maybe my logic is reversed but I think I need one class to
extend many others.

John Guynn

This email brought to you by RFCs 821 and 1225.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] OOP in web development

2001-02-14 Thread Nold, Mark


- 
Disclaimer: The information contained in this email is intended only for the
use of the person(s) to whom it is addressed and may be confidential or
contain legally privileged information. If you are not the intended
recipient you are hereby notified that any perusal, use, distribution,
copying or disclosure is strictly prohibited. If you have received this
email in error please immediately advise us by return email at
[EMAIL PROTECTED] and delete the email document without making a
copy. 

-

I have to agree that OOP is much better in abstracting than user defined
functions... why?

To return some data and display in a HTML table it i do:
$db = new DB;
$db-query("SELECT foo from bar");

$t = new Table;
echo $t-create($db-data);


Pretty easy. Now i could have all these have be functions

$data = query($connection_details,"SELECT foo from bar");
echo create_table($data);

But

What if i wanted a special connection specified as myDB that was consistant
through out my site? Or what if my table creation function has over 30
different options setable (colours, fonts, spacing by cells, columns, rows
and table)? This becomes difficult with pure functions as you end up with


echo
create_table($data,"nowrap","black",null,"white",null,null,null,"Tahoma",12,
null,null,null,array(array("bold")));

instead of

$t = new Table;
$t-options = "nowrap";
$t-heading["bgcolor"] = "black";
$t-heading["fontcolor"] = "white";
$t-global["font"] = "tahoma";
$t-global["fontsize"] = 12;
$t-column["total"]["format"] = "bold";

echo $t-create($db-data);

// Create another table with similiar properties, but different data
echo $t-create($mydb-data);



What if wanted to make my table definition reusable (you would have to make
sure all these class's are included like your functions)


class myTable extends Table {
  var $options = "nowrap";
  var $heading["bgcolor"] = "black";
  var $heading["fontcolor"] = "white";
  var $global["font"] = "tahoma";
  var $global["fontsize"] = 12;
  var $column["total"]["format"] = "bold";
}


Then from then on you could just call 


$t = new myTable;
echo $t-create($db-data);

Now if change my definition of what a myTable should look like i change it
once, not in everyfile as you might with functions. (You could however
define a new function called create_myTable that does something similiar).

The last benefit is that with phpdoc and similiar tools class's can be
autodocumented which is very nice.

Readability, maintainability and reusability are much higher with OOP. 



Mark Nold
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Senior Consultant

Change is inevitable, except from vending machines. 



-Original Message-
From: Jeff Warrington [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 4:42 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] OOP in web development


In article [EMAIL PROTECTED], "Joe
Sheble (Wizaerd)" [EMAIL PROTECTED] wrote:

depending on the nature of what you are doing, one of the things
that i like about using classes is the ability to group functionality
under a larger structure, the class.  Instead of having a series of
disconnected functions, i can instead write them as class methods.

another feature that is a basic feature of oop stuff is the idea of
inheritence. So you can have a base class (CAR) that defines
behaviour common to all instanaces of that class (var wheels, var door,
method car start, method car turn signal on, etc...) Then you can
subclass the CAR class to define specific behaviour for a particular
car model (SPORTSCAR - var turbo, method car turbo on, etc..).

again, depending on what you are doing, this can be very beneficial.
I suggest you start small and also take a look at other people's code.
You will find alot of classes out there that make alot of sense and 
can give you ideas of new ways of doing things

Jeff


 I've been using PHP for over a year now and have been successfully
 running  three different websites developed with PHP, but I've never
 done anything  with classes or objects.  Even when returning data from a
 mySQL database, I  use mysql_fetch_array() instead of
 mysql_fetch_object().
 
 What am I missing by not using objects and classes, other than 
 reusability?  What are the real benefits to using OOPs in PHP?
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP in web development

2001-02-14 Thread Phil Driscoll

I don't want to start an OOP flame thread here, so I'll shut up after this
posting - it's just that nobody is speaking up for not using OOP :)

The point needs to be made that code reuse, readability and maintainability
do not come from whether or not you choose to use OOP techniques. They come
from a combination of careful thought, planning, skill and experience.

In almost all cases, whatever you write will be executed by a microprocessor
that knows nothing of OOP, but just plods through a sequence of
instructions, occasionally shooting off to execute a subroutine or two. What
this shows is that whatever fine OOP constructs you devise they can be
represented in the plain old procedural world.

I'm pretty sure that most of the OOP tricks PHP does are done by pretending
that things are objects but really they are arrays, and as you might expect,
the procedural way to implement the same functionality is to use arrays!

Mark's example comparing:

create_table($data,"nowrap","black",null,"white",null,null,null,"Tahoma",12,
null,null,null,array(array("bold")));

with:

$t = new Table;
$t-options = "nowrap";
$t-heading["bgcolor"] = "black";
$t-heading["fontcolor"] = "white";
$t-global["font"] = "tahoma";
$t-global["fontsize"] = 12;
$t-column["total"]["format"] = "bold";

could more fairly have used something like:

$t=create_table();
$t['options'] = "nowrap";
$t['heading']['bgcolor']= "black";

etc.

As you can see, there is hardly any difference at all.

My point is really that you can use whatever technique you want, but you can
get your code reuse, readability and maintainability from either. As you
might have guessed, I favour procedural as I feel that more of the code is
visible and in my control.

YMMV
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] OOP in web development

2001-02-14 Thread Mark Maggelet

On Wed, 14 Feb 2001 19:21:20 +1030, Nold, Mark
([EMAIL PROTECTED]) wrote:
-

---
-
Disclaimer: The information contained in this email is intended only
for the
use of the person(s) to whom it is addressed and may be confidential
or
contain legally privileged information. If you are not the intended
recipient you are hereby notified that any perusal, use,
distribution,
copying or disclosure is strictly prohibited. If you have received
this
email in error please immediately advise us by return email at
[EMAIL PROTECTED] and delete the email document without
making a
copy.
-

---
-

I have to agree that OOP is much better in abstracting than user
defined
functions... why?

To return some data and display in a HTML table it i do:
$db = new DB;
$db-query("SELECT foo from bar");

$t = new Table;
echo $t-create($db-data);


Pretty easy. Now i could have all these have be functions

$data = query($connection_details,"SELECT foo from bar");
echo create_table($data);

But

What if i wanted a special connection specified as myDB that was
consistant
through out my site? Or what if my table creation function has over
30
different options setable (colours, fonts, spacing by cells,
columns, rows
and table)? This becomes difficult with pure functions as you end up
with


echo
create_table($data,"nowrap","black",null,"white",null,null,null,"Taho

ma",12,
null,null,null,array(array("bold")));

instead of

$t = new Table;
$t-options = "nowrap";
$t-heading["bgcolor"] = "black";
$t-heading["fontcolor"] = "white";
$t-global["font"] = "tahoma";
$t-global["fontsize"] = 12;
$t-column["total"]["format"] = "bold";

echo $t-create($db-data);

you could do something like:

$parameters["options"] = "nowrap";
$parameters["heading"]["bgcolor"] = "black";
$parameters["heading"]["fontcolor"] = "white";
$parameters["global"]["font"] = "tahoma";
$parameters["global"]["fontsize"] = 12;
$parameters["column"]["total"]["format"] = "bold";
echo create_table($data,$parameters);

The difference is a matter of style.

// Create another table with similiar properties, but different data
echo $t-create($mydb-data);



What if wanted to make my table definition reusable (you would have
to make
sure all these class's are included like your functions)


class myTable extends Table {
  var $options = "nowrap";
  var $heading["bgcolor"] = "black";
  var $heading["fontcolor"] = "white";
  var $global["font"] = "tahoma";
  var $global["fontsize"] = 12;
  var $column["total"]["format"] = "bold";
}


Then from then on you could just call


$t = new myTable;
echo $t-create($db-data);

Now if change my definition of what a myTable should look like i
change it
once, not in everyfile as you might with functions. (You could
however
define a new function called create_myTable that does something
similiar).

this is nothing you can't do without OOP.

The last benefit is that with phpdoc and similiar tools class's can
be autodocumented which is very nice.

Maybe so, I never used it. To me, the main reason to use OOP is when
you're dealing with Java or something and native code is dealing with
your objects. For instance laying out widgets on a screen might need
that your widget extend Widget and have a draw() method.

I've never had a situation with php where I thought doing things this
way would make things easier.

- Mark


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] OOP in web development

2001-02-14 Thread Nold, Mark


- 
Disclaimer: The information contained in this email is intended only for the
use of the person(s) to whom it is addressed and may be confidential or
contain legally privileged information. If you are not the intended
recipient you are hereby notified that any perusal, use, distribution,
copying or disclosure is strictly prohibited. If you have received this
email in error please immediately advise us by return email at
[EMAIL PROTECTED] and delete the email document without making a
copy. 

-


Pretty neat, I never once thought of making one big parameter array

I agree its all a matter of taste. It could be a personal inditement but
i've always found my OO code easier to extend and maintain than my
proceedural stuff. 

I can only recommend you give a go in PHP and see if it makes a difference
for you.

mn


Mark Nold
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Senior Consultant

Change is inevitable, except from vending machines. 



-Original Message-
From: Mark Maggelet [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 2:16 AM
To: Nold, Mark; [EMAIL PROTECTED]
Subject: RE: [PHP] OOP in web development


On Wed, 14 Feb 2001 19:21:20 +1030, Nold, Mark 
([EMAIL PROTECTED]) wrote:
-

---
- 
Disclaimer: The information contained in this email is intended only
for the
use of the person(s) to whom it is addressed and may be confidential
or
contain legally privileged information. If you are not the intended
recipient you are hereby notified that any perusal, use, 
distribution,
copying or disclosure is strictly prohibited. If you have received 
this
email in error please immediately advise us by return email at
[EMAIL PROTECTED] and delete the email document without 
making a
copy. 
-

---
-

I have to agree that OOP is much better in abstracting than user 
defined
functions... why?

To return some data and display in a HTML table it i do:
$db = new DB;
$db-query("SELECT foo from bar");

$t = new Table;
echo $t-create($db-data);


Pretty easy. Now i could have all these have be functions

$data = query($connection_details,"SELECT foo from bar");
echo create_table($data);

But

What if i wanted a special connection specified as myDB that was 
consistant
through out my site? Or what if my table creation function has over 
30
different options setable (colours, fonts, spacing by cells, 
columns, rows
and table)? This becomes difficult with pure functions as you end up
with


echo
create_table($data,"nowrap","black",null,"white",null,null,null,"Taho

ma",12,
null,null,null,array(array("bold")));

instead of

$t = new Table;
$t-options = "nowrap";
$t-heading["bgcolor"] = "black";
$t-heading["fontcolor"] = "white";
$t-global["font"] = "tahoma";
$t-global["fontsize"] = 12;
$t-column["total"]["format"] = "bold";

echo $t-create($db-data);

you could do something like:

$parameters["options"] = "nowrap";
$parameters["heading"]["bgcolor"] = "black";
$parameters["heading"]["fontcolor"] = "white";
$parameters["global"]["font"] = "tahoma";
$parameters["global"]["fontsize"] = 12;
$parameters["column"]["total"]["format"] = "bold";
echo create_table($data,$parameters);

The difference is a matter of style.

// Create another table with similiar properties, but different data
echo $t-create($mydb-data);



What if wanted to make my table definition reusable (you would have 
to make
sure all these class's are included like your functions)


class myTable extends Table {
  var $options = "nowrap";
  var $heading["bgcolor"] = "black";
  var $heading["fontcolor"] = "white";
  var $global["font"] = "tahoma";
  var $global["fontsize"] = 12;
  var $column["total"]["format"] = "bold";
}


Then from then on you could just call 


$t = new myTable;
echo $t-create($db-data);

Now if change my definition of what a myTable should look like i 
change it
once, not in everyfile as you might with functions. (You could 
however
define a new function called create_myTable that does something 
similiar).

this is nothing you can't do without OOP.

The last benefit is that with phpdoc and similiar tools class's can 
be autodocumented which is very nice.

Maybe so, I never used it. To me, the main reason 

[PHP] OOP in web development

2001-02-13 Thread Joe Sheble (Wizaerd)

I've been using PHP for over a year now and have been successfully running 
three different websites developed with PHP, but I've never done anything 
with classes or objects.  Even when returning data from a mySQL database, I 
use mysql_fetch_array() instead of mysql_fetch_object().

What am I missing by not using objects and classes, other than 
reusability?  What are the real benefits to using OOPs in PHP?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP in web development

2001-02-13 Thread Kath

I find the ability to write something once (say a mysql_connect();
statement) and be able to run it on any page just with $db-connect(); is
pretty cool.

While that may not seem cool, if you some day change a a PHP statement that
exists on many pages, this lets you change it in one place, instead of
having to copy it to dozens of other places.

Also, what happens if you change your database password and now need to
change a bunch of pages to have the new password?

Problem solved in OOP, because the vars are all in the same file.

- Kath, a recent converter to OOP, but enjoying every minute of it!

- Original Message -
From: "Joe Sheble (Wizaerd)" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 13, 2001 11:41 AM
Subject: [PHP] OOP in web development


 I've been using PHP for over a year now and have been successfully running
 three different websites developed with PHP, but I've never done anything
 with classes or objects.  Even when returning data from a mySQL database,
I
 use mysql_fetch_array() instead of mysql_fetch_object().

 What am I missing by not using objects and classes, other than
 reusability?  What are the real benefits to using OOPs in PHP?


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP in web development

2001-02-13 Thread Mark Maggelet

On Tue, 13 Feb 2001 15:11:46 -0500, Kath ([EMAIL PROTECTED]) wrote:
I find the ability to write something once (say a mysql_connect();
statement) and be able to run it on any page just with $db-
connect(); is
pretty cool.

While that may not seem cool, if you some day change a a PHP
statement that
exists on many pages, this lets you change it in one place, instead
of
having to copy it to dozens of other places.

Also, what happens if you change your database password and now need
to
change a bunch of pages to have the new password?

Problem solved in OOP, because the vars are all in the same file.

You don't need OOP to keep your database connections in a separate
file.  You can either use classes or not but it's really just about
style.




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Fwd: Re: [PHP] OOP in web development

2001-02-13 Thread Joe Sheble (Wizaerd)

At 03:11 PM 2/13/01 -0500, you wrote:
  I find the ability to write something once (say a mysql_connect();
  statement) and be able to run it on any page just with $db-connect(); is
  pretty cool.
 
  While that may not seem cool, if you some day change a a PHP statement that
  exists on many pages, this lets you change it in one place, instead of
  having to copy it to dozens of other places.
 
  Also, what happens if you change your database password and now need to
  change a bunch of pages to have the new password?
 
  Problem solved in OOP, because the vars are all in the same file.


problem solved by building modular INC (or include) file...  all the vars 
are in one file, and are included at the top of every other file, just as a 
class file would have to be.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] OOP in web development

2001-02-13 Thread Jeff Warrington

In article [EMAIL PROTECTED], "Joe
Sheble (Wizaerd)" [EMAIL PROTECTED] wrote:

depending on the nature of what you are doing, one of the things
that i like about using classes is the ability to group functionality
under a larger structure, the class.  Instead of having a series of
disconnected functions, i can instead write them as class methods.

another feature that is a basic feature of oop stuff is the idea of
inheritence. So you can have a base class (CAR) that defines
behaviour common to all instanaces of that class (var wheels, var door,
method car start, method car turn signal on, etc...) Then you can
subclass the CAR class to define specific behaviour for a particular
car model (SPORTSCAR - var turbo, method car turbo on, etc..).

again, depending on what you are doing, this can be very beneficial.
I suggest you start small and also take a look at other people's code.
You will find alot of classes out there that make alot of sense and 
can give you ideas of new ways of doing things

Jeff


 I've been using PHP for over a year now and have been successfully
 running  three different websites developed with PHP, but I've never
 done anything  with classes or objects.  Even when returning data from a
 mySQL database, I  use mysql_fetch_array() instead of
 mysql_fetch_object().
 
 What am I missing by not using objects and classes, other than 
 reusability?  What are the real benefits to using OOPs in PHP?
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP oop in C

2001-01-29 Thread matt . wong

Hello,

Does anyone know how to take a PHP class and move it directly into PHP's C 
code, OR (even better) to move it into C code that compiles in a separate 
binary object (e.g. myobj.o), and is then linked to the php executable (or 
httpd executable)?

For example, how can I move this code into C?
?
class myObject {
  function myObject {
$this-data = "hello!";
  }
  function hello () {
echo $this-data;
  }
}
?

Thanks!
   -Matt



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




<    1   2   3   4