|
Posted by The Natural Philosopher on 09/04/07 14:22
ELINTPimp wrote:
> On Sep 4, 9:26 am, The Natural Philosopher <a...@b.c> wrote:
>> Gary L. Burnore wrote:
>>> On Tue, 04 Sep 2007 03:11:38 -0700, Marijn
>>> <marijn.huizendv...@gmail.com> wrote:
>>>> On 4 sep, 10:02, Toby A Inkster <usenet200...@tobyinkster.co.uk>
>>>> wrote:
>>>>> By the way, you shouldn't name your functions with a double-underscore.
>>>>> Functions that start with a double-underscore are reserved for future use
>>>>> as "magic" functions (e.g. __construct, __call, __get, __autoload, etc).
>>>> I know it is for reserverd magic functions BUT this way i serarate
>>>> public (no underscore) from (protected one underscore) from (private
>>>> (two underscores)
>>>> I really prefer a difference in my code for private and protected
>>>> methods.
>>>> Plus everybody with a bit of experience knows that ther is __call,
>>>> __autoload, __desctruct ...etc.
>>> So you think it's ok to mix YOUR functions with reserved functions
>>> just so your functions look different?
>>> how about pu_ pv_ and pr_ (or no for public, pv for private and pr
>>> for protected).
>>> Of course, it's your coding skills that'd be called into question if
>>> someone who knew better looked at it so that's up to you.
>> anyone who looks into old Unix source code will find huge areas of code
>> written by someone who hated writing english, and appeared to have
>> confused even themselves.
>>
>> My favorite comment is an I have used it myself
>>
>> /* If you can't understand the next bit, leave it alone. Trust me it
>> just WORKS, No I am not sure why, either */
>
> I'm sure we all wrote code like this at one point...until we had to
> rework our own code later on. You do need to be clever at times to be
> a programmer, but a good programmer is always more appreciated than a
> clever programmer.
>
Indeed.
That's a last resort.
In the days before optimising compilers and with edlin over a 300 bps
link as your only input, and probably handwritten on paper code just
typed in..there was some excuse for things like..
((t=a->p[b].c)->index)==(a->p[0].sel))?t->data:FALSE;
with no explanations..
These days you see code like that coming out of 'application generators'
not humans.
Using twenty lines of commented code that breaks the above down into
steps, with loads of intermediate variables probably results in the same
output code anyway.
Gone are the days when it took 100K of well commented ASCII assembler to
generate 2k of PROM :-)
IIRC we had a rule that comments to code was about 1:1 in terms of block
hearders, and you always wrote that FIRST. And what followed was
commented pretty much every line or two as well.
PHP is in some respects retrograde: Its too much like BASIC in that you
can 'hack it till it works' too easily.
[Back to original message]
|