Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #15508
| From | bramante <bramante@yopmail.com> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: OOPHP online tutorials |
| Date | 2015-06-24 23:37 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <mmf801$s89$1@speranza.aioe.org> (permalink) |
| References | <mmf2bs$2hf$1@dont-email.me> |
Il 24/06/2015 22:03, Richard Heathfield ha scritto: > Frequently I find myself writing *almost* the same PHP code for a number > of tasks, but with tiny differences. For example: > > User: create, retrieve, amend, delete > Group: create, retrieve, amend, delete > UserPermission: create, retrieve, amend, delete > GroupPermission: create, retrieve, amend, delete > DiaryEntry: create, retrieve, amend, delete > EmbeddedImage: create, retrieve, amend, delete > > and so on. At present, I'm more or less doing copy-paste-edit, which I > can't help but notice is a terrible way to do things, and it strikes me > that an object-oriented approach would be more efficient. > > I don't particularly want to get locked into any one framework, because > I can't guarantee that that framework will be installable on whatever > server will be managing the site, but "vanilla" OO PHP seems to me to be > the way to go. > > Are there any excellent but gentle introductions to OO PHP out there on > the Web? > create a class and extend it and override the method that you have necessary. you can create a class name USER with methods that are common for all your other object and after extend it "group extend user" and ovveride or create method that are particural for this object. for example the class USER can have a "create" method that call the private general method for insert the data into db, you can extend the base class to GROUP where you can ovveride only the "create" method and not write any code for the insert data into db. for do this you should abstract the concept of your object. Bye
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-24 21:03 +0100
Re: OOPHP online tutorials bramante <bramante@yopmail.com> - 2015-06-24 23:37 +0200
Re: OOPHP online tutorials Jerry Stuckle <jstucklex@attglobal.net> - 2015-06-24 23:21 -0400
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 09:12 +0100
Re: OOPHP online tutorials Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-25 11:15 +0200
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 12:01 +0100
Re: OOPHP online tutorials Jerry Stuckle <jstucklex@attglobal.net> - 2015-06-25 08:09 -0400
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 13:33 +0100
Re: OOPHP online tutorials Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-25 11:08 +0200
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 11:12 +0100
Re: OOPHP online tutorials Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-25 14:02 +0200
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 13:20 +0100
Re: OOPHP online tutorials "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-25 14:51 +0200
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 13:56 +0100
Re: OOPHP online tutorials Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-25 15:39 +0200
Re: OOPHP online tutorials Richard Heathfield <rjh@cpax.org.uk> - 2015-06-25 14:54 +0100
csiph-web