in reply to hangover from perl...

I have a good story for you. At least a funny one. I'm very multilingual in terms of programming languages. I know perl, c, some c++, java, etc...

While at a php gig, I would use perl style comments. This isn't bad. php inherited perl's/shell's commenting style as well as c's. Anyway, I had a line I wnated to comment, and used the pound/number sign: #. Things worked fine.

They pushed a release out with my new code, and everything started breaking left and right. Ugly sight. Eventually, the "CTO" of the company went out into production and looked at my code. "What is this?!" Pointing at my humble pound symbol. "It's a comment." A whole bruhaha was started about how comments are not allowed in production code and what not. First I had heard of the rule. THey traced it back to a process that would strip out comments and extra spaces, 'cause php would be "that much faster without extra characters"..

Consequentally, out of 20 or so developers, none of them ever heard of using # symbols for comments in php. :\

Replies are listed 'Best First'.
hangover from basic...
by the_hunter (Initiate) on Apr 27, 2004 at 15:55 UTC
    I have been a basic/foxpro programmer for several years and i do this in perl once in a while
    if ($var eq "hello") then ... ... ... }
    instead of
    if ($var eq "hello") { ... ... ... }
Re: Re: hangover from perl...
by theorbtwo (Prior) on Apr 27, 2004 at 15:56 UTC

    You know, that seems more like a story about reasons not to work for that compony then a story about pitfalls of speaking too many languages.

    The CTO going into production? Not allowing comments in production? Production code being mangled, instead of being as close as possible to what was being tested? Using PHP?

Re: Re: hangover from perl...
by ambrus (Abbot) on Apr 27, 2004 at 19:18 UTC

    Avoid comments for speed? That's riddiculous. I've never yet heard of that. The usual claims are that comments are bad because you should write code such that it is clear without comments.

      php, like perl, in it's more bare form, skip the caching stuff or mod_perl, needs to compile scripts as they are called, no?

      With php at this company, the theory was (update not mine :P), less chars, the better for the parser. Don't ask me why and how valid the argument is for such a minute thing.

        The argument's validity is nearly nil. Most "interpreted" languages these days run through a compile phase that will get rid of comments before the actual runtime occurs. If Jesus was a programmer, he would have called this behavior straining out the gnat and swallowing the camel.

        ----
        : () { :|:& };:

        Note: All code is untested, unless otherwise stated

Re: Re: hangover from perl...
by hardburn (Abbot) on Apr 27, 2004 at 17:41 UTC

    Did you mention to them that using predefined constants is faster than using variables?

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

Re: Re: hangover from perl...
by jdporter (Paladin) on Apr 28, 2004 at 01:52 UTC
    perl, c, some c++, java
    Sorry, I don't think of that as "very multilingual".

    Reminds of the lame-o blog I saw a while ago. The dork said (something like) "I could be said to have a very broad taste in music. I like everything from rap, to hip-hop, to R&B..."