Reply to |Flag-FAQ| Re: not getting OO

Your name:

Reply:


Posted by R. Rajesh Jeba Anbiah on 08/17/06 10:49

nephish wrote:
> i have been looking to simplify my huge website that i wrote while
> learning php.
> now its a spaghetti mess. So, i wanted to simplify it.
> Now, i see the functionality that defining functions can give me. But
> what is the magic behind classes?
> i mean, the documentation i find. Most use the class Person as the
> example. So how would having a person class help me. It seems that i am
> writing more code than less because i am passing values thru a class
> instead of directly updating a database.
>
> for example: if i have a class Customer
>
> $john = new Customer;
>
> $john->name = 'john';
>
> then the class updates the database with a new customer named john.
>
> why not just send sql an insert to do this ?
>
> just not getting it, but i know the advantages are there, could someone help me.

When you take OOP, you'll come across a situation in which you'd need
to find a connection between objects or how to make an object, etc. Say
for example, in a website that has authentication system, it is little
complex to identify the objects--which part of system has to go to User
objects and which part of the system has to go to the Authentication
objects, etc. In such situation, "patterns" helps. "Patterns" are
nothing but list of defined and identified pattern/way of communicating
between objects. The mentioned pattern here is "Active record pattern"
<http://en.wikipedia.org/wiki/Active_record_pattern> which got popular
because of RoR. This doesn't mean that it's the only way OOP.

[Question flagged for FAQ. Will try to write the entry by weekend and
try to make the rest online]

--
<?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация