Discussion:
PHP question
Baber
2014-08-26 10:53:48 UTC
Permalink
Hi



Apologies if I have sent email to the wrong address. 

I have a very simple question regarding PHP i.e 

Does coding in PHP in procedural way (not object oriented) is still market standard and not obselete?

Many thanks,
 
---------------
Baber
***@yahoo.co.uk
Ashley Sheridan
2014-08-26 10:56:55 UTC
Permalink
Post by Baber
Hi
Apologies if I have sent email to the wrong address.
I have a very simple question regarding PHP i.e
Does coding in PHP in procedural way (not object oriented) is still market standard and not obselete?
Many thanks,
---------------
Baber
I would actually say the standard is object orientated, not procedural.
I've found there are very few cases for procedural these days, and would
always go down the OOP route, as it teaches better programming
practices.
--
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Alain Williams
2014-08-26 11:00:44 UTC
Permalink
Post by Baber
Hi
Apologies if I have sent email to the wrong address. 
I have a very simple question regarding PHP i.e 
Does coding in PHP in procedural way (not object oriented) is still market standard and not obselete?
You do not say why you ask the question, that will affect how we reply.

I suspect that you want to know what you should learn so that you can get a job
-- or something similar.

Yes: many programs are procedural, however you will need to learn how to USE
libraries written using OO methods.

Writing effective OO does take some time to get your head around - if you do
more than just write prodedural code wrapped up in a simple object.
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Domain nikha.org
2014-08-28 01:21:24 UTC
Permalink
Post by Alain Williams
Post by Baber
Hi
Apologies if I have sent email to the wrong address. 
I have a very simple question regarding PHP i.e 
Does coding in PHP in procedural way (not object oriented) is still market standard and not obselete?
You do not say why you ask the question, that will affect how we reply.
I suspect that you want to know what you should learn so that you can get a job
-- or something similar.
Yes: many programs are procedural, however you will need to learn how to USE
libraries written using OO methods.
Writing effective OO does take some time to get your head around - if you do
more than just write prodedural code wrapped up in a simple object.
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>
:-) Hi Allan!

I'm an old scool procedural guy. OO, I think, is good for programmers, not for computers.
Personaly I established a nice library of includes, containig carefully written functions (and sometimes just variables), usable in wide range of tasks. I include them, if they are needed, and they do the same job as classes do. (Classes are collections of functions and varaibles.) But with NO overhead I have seen so often in classes looking brillant at first glance.

Of course I use the built in PHP-classes and objects. But to be honest, even those are often overloaded. It happens, that I need just some value, and I'm forced to instantiate a class providing an endless list of functions I actually do not need.

Compare the old date() an mktime() functions and the actual date class!

But after all, web hosters install strong hardware, do as you like it :-)

Niklaus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Andy McKenzie
2014-08-28 12:07:48 UTC
Permalink
Post by Baber
Hi
Apologies if I have sent email to the wrong address.
I have a very simple question regarding PHP i.e
Does coding in PHP in procedural way (not object oriented) is still market
standard and not obselete?
Many thanks,
---------------
Baber
I think the answer is that you need to know and use both. There are times
when object oriented makes a lot of sense: when writing an inventory tool
that needs to track the attributes of a lot of physical objects, treating
them as data objects works really cleanly, and makes the program much
easier to read. In my view, that's arguably the biggest advantage of
object oriented code: it's frequently much more readable.

On the other hand, I've seen a script meant to move a couple of files to a
new location where the author decided to do everything object oriented, and
spent forty or fifty lines defining classes for the files and folders they
needed. That was, in all honesty, kind of dumb, since I rewrote it as
about a fifteen line procedural script. It ran faster and with less
resources required, and probably took a tenth of the time to write.
(Nevermind that PHP isn't really a fantastic choice for command line work
anyway, and writing a one-liner to call a perl script probably would have
been a lot better...)

Basically, both approaches have uses, and if you only learn one, or decide
that one is always universally better, you'll be making your life harder
than it needs to be at least some of the time.

Andy McKenzie
As'ad Djamalilleil
2014-08-29 12:19:25 UTC
Permalink
---------- Forwarded message ----------
From: As'ad Djamalilleil <***@gmail.com>
Date: Fri, Aug 29, 2014 at 8:18 PM
Subject: Re: [PHP] Fw: PHP question
To: Andy McKenzie <***@gmail.com>


imho, it depends on how big the program you would develop and for what
purpose (bussiness or scientific), but most market don't care how you do
it, procedural or OOP way, as long as it effectives.
Post by Baber
Post by Baber
Hi
Apologies if I have sent email to the wrong address.
I have a very simple question regarding PHP i.e
Does coding in PHP in procedural way (not object oriented) is still
market
Post by Baber
standard and not obselete?
Many thanks,
---------------
Baber
I think the answer is that you need to know and use both. There are times
when object oriented makes a lot of sense: when writing an inventory tool
that needs to track the attributes of a lot of physical objects, treating
them as data objects works really cleanly, and makes the program much
easier to read. In my view, that's arguably the biggest advantage of
object oriented code: it's frequently much more readable.
On the other hand, I've seen a script meant to move a couple of files to a
new location where the author decided to do everything object oriented, and
spent forty or fifty lines defining classes for the files and folders they
needed. That was, in all honesty, kind of dumb, since I rewrote it as
about a fifteen line procedural script. It ran faster and with less
resources required, and probably took a tenth of the time to write.
(Nevermind that PHP isn't really a fantastic choice for command line work
anyway, and writing a one-liner to call a perl script probably would have
been a lot better...)
Basically, both approaches have uses, and if you only learn one, or decide
that one is always universally better, you'll be making your life harder
than it needs to be at least some of the time.
Andy McKenzie
Loading...