>> I am a little curious as to the reasons for avoiding the use of classes in
>> FreeTrade.  While classes in PHP 3 are not as robust in c++ or Java they
>> still allow for quite a bit.  I have been considering building classes for
>> things like the shopping cart and users and moving their related functions
>> in as methods.  Just thinking it might be a good idea if I ask why not
>> first.
>
>There are a few reasons.  First, consider that while classes are not used,
>the design is object oriented.  Each module is like an object in that it
>collects functions and data.  Second, it seemed like a lot of overhead
>at the time.  Third, because objects in PHP do not offer private methods
>and properties, they aren't as useful.  If you have  to have the
>discipline not to reach into objects when you shouldn't, then you might
>as well just use functions and avoid typing $this-> all the time.
>
>Anyway, that's my thinking, but I'm willing to argue about it.  Check out
>how I modularized things in FreeTrade 2, though.  I've greatly increased
>the cohesion and reduced the coupling.

  I'll start with I haven't checked out v2 yet.  Here's the first things that come 
immediately to mind:

namespaces - sure, call somefunc().  Oops, that's already a function.
           - $title - is that the page title, or the book for sale?

  I can't buy the typing $this-> all the time.  You type it once, then forget about 
it.  I have classes that I haven't changed the code for in over 2 years.

encapsulation - Am I on my development machine with v4.1.3 or 3.0.8 hosted?
              - And why should I have to change my code because of it?
              - Was that a :80 that WebTV added to the hostname?

inheritance - Don't see any reason to have to explain :)
            - Ok fine.  It's XML to a file, not browser.  Write it again.

  I certainly haven't tested the overhead of using PHP classes to any significant 
degree.  I can tell you that using OOP principles works in any language, it's just how 
much that language makes it easier or not.

  Sure private would be nice, but it can complicate coding.  I certainly don't see 
that as a reason not to use it.

My .22 cents,
  John
--
/* SteeleSoft Consulting  John Steele - Systems Analyst/Programmer
 *  We also walk dogs...  [EMAIL PROTECTED] - PHP/MySQL/Linux/Hosting
 *                        http://www.gamecomputer.com/ssc/
 */


------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Site:            http://www.working-dogs.com/freetrade/
Problems?:       [EMAIL PROTECTED]

Reply via email to