Re: [PHP] RE: Return or not to return, that is the question
- From: robert@xxxxxxxxxxxxx (Robert Cummings)
- Date: Wed, 30 May 2007 14:41:41 -0400
On Wed, 2007-05-30 at 17:24 +0100, Richard Davey wrote:
Hi Jared,
Wednesday, May 30, 2007, 4:10:45 PM, you wrote:
[snip]
I think putting "return;" at the end of every function is probably a healthy
practice, but is it best practice? If it's poorly written and/or poorly
factored code, it doesn't make any difference if they have returns on
everything, it's still junky code.
If you do put a return; at the end of all of your functions, I'm
curious as to why? If a function doesn't actually return a value
(which is highly possible) then it isn't /required/, but that doesn't
stop me from doing it. I *do* put 'return;' at the end of all
functions (my question to the list was - does anyone else?)
If there's no reason for it to return something, why bother? It's like
telling the reader of your code that they're a complete and utter moron
because obviously you need to point out explicitly that the code returns
at that point because they obviously couldn't infer it from having
reached the end of the function :)
Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
.
- References:
- RE: Return or not to return, that is the question
- From: "Jared Farrish"
- Re: [PHP] RE: Return or not to return, that is the question
- From: Richard Davey
- RE: Return or not to return, that is the question
- Prev by Date: Re: [PHP] Streaming download to IE doesn't work
- Next by Date: Re: [PHP] Client does not support authentication protocol...
- Previous by thread: Re: [PHP] RE: Return or not to return, that is the question
- Next by thread: Re: RE: Return or not to return, that is the question
- Index(es):