You are here: Re: how do professional PHP developers handle defaults for function parameters? « PHP Programming Language « IT news, forums, messages
Re: how do professional PHP developers handle defaults for function parameters?

Posted by Ivαn Sαnchez Ortega on 07/06/07 21:53

lawrence k wrote:

> because if I do this and someone forgets to pass a file name to the
> function, then the PHP parser issues an error. I've been assuming
> that relying on the PHP parser to write my error messages for me is
> unprofessional. Does anyone else feel that way?

It's not unprofessional. It is over-engineered and unneccesary, tough.

If "someone" forgets to pass you a parameter, it is because:
- They haven't looked at your function definition (they are bad programmers)
- You haven't specified that they have to pass you a parameter (*you* are a
bad programmer)

So:
- Document your code (use doxygen/phpdoc/whatever)
- Tell other programmers you work with how your code works, and what they
can expect from it.


The "professional" way to go is to write specs on paper, then have everyone
read them, then assume everybody will be following them.


And, finally: do not attempt to do some work that a interpreter or a
compiler does better than you. And don't try implementing technical
solutions to non-technical problems.

Hope that helps,
--
----------------------------------
IvΓ‘n SΓ‘nchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.

 

Navigation:

[Reply to this 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация