[prog] Starting from scratch with PHP
Finne Boonen
finne at cassia.be
Thu Sep 28 19:38:09 UTC 2006
On 9/28/06, Rachel McConnell <rachel at xtreme.com> wrote:
> (sorry for dupe, Katrina, forgot to Reply All 1st time)
>
> On Thu, 28 Sep 2006 15:45:57 +0200, "binaryjane" <binaryjane at gmail.com>
> said:
> > I have gained some ability in making sense of some relatively ugly
> > PHP, and now I would really like to know how to start at the other
> > end: Where can I figure out how to write clean and shiny PHP from
> > scratch? Where can I read about 'best practices' and figure out what I
> > should be calling variables and functions? The site I am currently
> > debugging calls their variables stuff like f_mf, and they don't
> > comment their code, and it is a bit difficult to track things down
> > because there is so much redundancy. I'd like to do a better job of
> > it!
>
> I'm not going to have any specific recommendations for further research
> but I'll give you some general feedback, which is that you are
> absolutely on the right track. Descriptive variable naming is
> incredibly helpful and not as easy as it sounds. Redundancy (with very
> few exceptions) should be ruthlessly eliminated. I suggest you read up
> on object oriented programming (OO) techniques and theory, which is not
> language specific.
>
> PHP was not designed originally for OO but has had OO kind of tacked on
> more recently, and (for this reason or not) it's harder to use OO in PHP
> than in many other languages. However, OO techniques will almost
> certainly result in code that is less redundant, easier to maintain, and
> better organized. One rule of thumb I use with PHP is to avoid any
> functions (I forget the specific PHP term) that contain implementation
> detail, such as mysql_anything. I don't like PHP myself; it's too easy
> and tempting to write quick, bad code, and rather harder to write
> organized, maintainable code. However PHP has the significant advantage
> of being available nearly everywhere, and there are lots of resources
> available to coders.
>
> >
> > Lastly, do any of you have any suggestions as to any elegant PHP code
> > that I can read, or where I should go to find the really good stuff?
>
> I would guess that MediaWiki contains good PHP code although I have not
> looked at it myself. MediaWiki as you may know is what Wikipedia uses
> and I believe it was originally written specifically for Wikipedia.
> Therefore I would expect it to have a large development community and
> reasonable help for new developers which would be useful for you even if
> you do not intend to join the dev effort.
sorry to dissapoint you but the development community for mediawiki
is relatively small :( (we're always looking for more ppl, esp ppl
that ask&think first before implementing stuff :))
Mediawiki contains some good code, but also some horrible code, the
older the code is, the more chance it's horrible :) part of it is that
it is very easy to write bad code in php, another part is that large
parts where badly thought out/implemented in the early stages, and not
enough developpers to redo everything :)
when developping your own stuff, take a look at templating engines
(such as Smarty (smarty.php.net I think) and pear, php base classes
(pear.php.net)
Finne/henna
>
> Sorry to not have more specific suggestions for you! If I run across,
> or remember, any sites or books that I think might be helpful to you I
> will post them here, but currently I'm working in Java with a
> pre-existing codebase that is somewhat low in tests, so my attention is
> in different areas.
>
> Rachel
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://linuxchix.org/mailman/listinfo/programming
>
--
"Maybe you knew early on that your track went from point A to B, but
unlike you I wasn't given a map at birth!" Alyssa, "Chasing Amy"
--
"Maybe you knew early on that your track went from point A to B, but
unlike you I wasn't given a map at birth!" Alyssa, "Chasing Amy"
More information about the Programming
mailing list