Re: Classes - Dumb question
| From: | Nathan Nobbe | Date: | Fri, 12 Oct 2007 06:00:30 +0000 |
| Subject: | Re: Classes - Dumb question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263134@lists.php.net to get a copy of this message | ||
On 10/12/07, Larry Garfield <larry@garfieldtech.com> wrote:
>
> On Thursday 11 October 2007, Jay Blanchard wrote:
> > [snip]
> > okay, this is really (!) embarassing, but I have to ask:
> >
> > Why would I want to use classes in PHP?
> >
> > I have been using PHP for years now and writing the "normal" functions
> all
> > the time. I have never even bothered working with classes, but now I
> would
> > love to know what makes the classes so special...
> >
> > Please go easy on me ;o) Just trying to make another step :o)
> > [/snip]
> >
> > Do not be embarrassed, this is a very good question.
> >
> > First of all what you call "normal" is procedural or functional
> > programming. There is nothing wrong with doing things this way and may
> be
> > especially quick and efficient when doing basic web sites and
> applications.
> > Document well and you will have no problem maintaining your code.
>
> One correction. What is being described is procedural or imperative
> programming. Functional programming is another beast entirely (closures,
> first-class functions, immutable variables, etc.). PHP is not a
> functional
> language by any stretch of the imagination. For functional programming,
> see
> Erlang, Haskel, ML, LISP, and to a lesser extent Javascript.
>
> That's not a knock against PHP, mind you; I'm just pointing out that
> functional programming is something different than what you are
> describing.
> It's a common point of confusion because in a procedural language
> (traditional PHP, C, etc.) you do everything with functions, so "it's
> functional". The difference is that a function is not a base data type,
> which is a key component of a functional language.
an aspect that makes working with javascript rather interesting. i get my
fill of
it there and enjoy php for what it is; and because its more familiar to me
;)
-nathan