Re: How to write code: how wrong am I?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 22, 2011 at 15:00, Andy McKenzie <amckenzie4@xxxxxxxxx> wrote:
> I'll be the first to tell you that I'm not a great programmer, so my
> take may not be worth a lot. ÂHowever, this is pretty close to how I
> write. ÂNot exactly, but close. ÂI also always label open and closing
> brackets on everything, unless the brackets are less than three lines
> apart. ÂFor instance, I might find myself writing:
>
> if($foo == 'bar')
> { # Begin foo=bar test
> Â # If foo=bar, do a lot of things.
>
> } # End foo=bar test
>
> Then I go back and fill in the conditional stuff.

I also do something similar, I debated writing about that as well:

class someClass{

    function someFunction() {
        if (true) {
            // Some Code
        }
    } // end someFunction

} // end someClass

I don't strictly subscribe to a three-line limit, but whatever feels
reasonable at the time. Often that depends on the complexity of
surrounding code.

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux