Re: Collective memory (was: Good code patterns in Python)

Discussion in 'Python' started by Michael Sparks, Jul 6, 2003.

  1. On Fri, 4 Jul 2003, Charles Shannon Hendrix wrote:
    > if <something>
    > <work>
    > <more work>
    > <add numbers>


    If this is solely tabs, this is unambiguous with no special rules needing
    invocation. If this is spaces, again, this is unambiguous with no special
    rules needing invocation.

    If this is tabs and spaces mixed, then this looks ambiguous, and you need
    to look at special rules. That said, if you have one user who uses // for
    comments in C++ and another who exclusively uses /* */ what happens when
    the first user attempts to comment out the block of code by the second
    user?

    Also C has more corner cases due to allowing its block structure
    delimiters being slightly inconsistant than anything else.

    After all without checking how many C programmers could say what this
    means:

    if (<test>)
    if (<another test>)
    <do something>
    else
    <do otherthing>

    Is that:
    if <test>
    if <test>
    <do something>
    else
    <do something>

    Or is it:
    if <test>
    if <test>
    <do something>
    else
    <do something>

    The "problem" really boils down to choosing to use language features
    inconsistantly. This applies to C, C++, Python, Perl (eg allowing
    whitespace in regexes or not), and even functional languages. You might
    choose to always use braces for blocks even where not necessary, always to
    use tabs rather than spaces (or vice versa) and so on.

    In python I personally tend to find that only having one major decision to
    make - spaces vs tabs actually makes interaction with others code a lot
    simpler.

    > One really funny problem was when I guy reformatted his Python code,
    > around 15K lines of it, and basically unindented *ALL* of the code to
    > column 1. It was the only recoverable copy of the code too.
    >
    > He had to read the entire program line by line to recreate the logic.


    I changed all the permissions in /etc once by accident as well. (to 777
    IIRC) This quite spectacularly busted my system, and that took a long
    while to sort out. At the time that was probably a similar number of lines
    affected by a pretty stupid simple action.

    What's the moral? Backup regularly and often and especially before doing
    something that touches a significant amount of stuff. (Where significant
    means >2 hours to fix) It certainly isn't "permissions are bad", nor
    "whitespace is bad".

    Inconsistent functionality abuse combined with stupidity is pretty hard
    for any system to cope with...

    Regards,


    Michael.
    Michael Sparks, Jul 6, 2003
    #1
    1. Advertising

  2. Michael Sparks

    Peter Hansen Guest

    Michael Sparks wrote:
    >
    > > One really funny problem was when I guy reformatted his Python code,
    > > around 15K lines of it, and basically unindented *ALL* of the code to
    > > column 1. It was the only recoverable copy of the code too.
    > >
    > > He had to read the entire program line by line to recreate the logic.

    >
    > I changed all the permissions in /etc once by accident as well. (to 777
    > IIRC) This quite spectacularly busted my system, and that took a long
    > while to sort out. At the time that was probably a similar number of lines
    > affected by a pretty stupid simple action.
    >
    > What's the moral? Backup regularly and often and especially before doing
    > something that touches a significant amount of stuff.


    Actually, the moral is "use a revision control system". Anyone not doing
    so should not be programming professionally.(*)

    -Peter

    *) I speak as someone who programmed professionally without using a good
    revision control system, for a while, and made some serious mistakes
    as a result. Backups are *not* sufficient, but merely a slight step
    up from doing nothing at all.
    Peter Hansen, Jul 7, 2003
    #2
    1. Advertising

  3. Michael Sparks

    Max M Guest

    Peter Hansen wrote:

    > Actually, the moral is "use a revision control system". Anyone not doing
    > so should not be programming professionally.(*)


    > *) I speak as someone who programmed professionally without using a good
    > revision control system, for a while, and made some serious mistakes
    > as a result. Backups are *not* sufficient, but merely a slight step
    > up from doing nothing at all.



    Arh ... that will never happen to me ... If you start using CVS systems,
    whats next? Anti Virus software? Raid systems? backups? It will never
    end. It's all just expenses.


    regards Max M
    Max M, Jul 7, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. crichmon
    Replies:
    4
    Views:
    477
    Mabden
    Jul 7, 2004
  2. Will Stuyvesant

    Good code patterns in Python

    Will Stuyvesant, Jul 1, 2003, in forum: Python
    Replies:
    10
    Views:
    634
    Ben Finney
    Jul 3, 2003
  3. Bob Gailer

    Re: Good code patterns in Python

    Bob Gailer, Jul 1, 2003, in forum: Python
    Replies:
    33
    Views:
    798
    Eric Sosman
    Jul 29, 2003
  4. Devon Null
    Replies:
    24
    Views:
    582
    Daniel T.
    Jun 14, 2007
  5. Devon Null
    Replies:
    15
    Views:
    481
    Devon Null
    Jun 8, 2007
Loading...

Share This Page