|
Posted by Rik on 08/16/06 22:20
nephish wrote:
> Hey there all.
>
> 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 ?
Because you'll have to take care of connecting, updating, reporting errors
etc. That's the job of another class/object.
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|