View Poll Results: Does Formatting Code Matter?

Voters
8. You may not vote on this poll
  • Yes, for development.

    3 37.50%
  • Yes, for maintenance.

    5 62.50%
  • No, it doesn't matter.

    0 0%
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710

    Does formatting code matter?

    I am currently doing impact analyis on a data model with a phenomenal number of PL/SQL data tests. There is no documentation, I have to read every datatest to determine if it will affect the addition of a new column to the model. All of the code is unformatted. My eyes have begun to bleed and I have asked the programming team to make my job easier by formatting their code. The Team Lead and Senior Oracle Developer tell me that "formatting code doesn't matter."

    What do you think?

  2. #2
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710
    Sorry about the poll not allowing multiple answers. Thought I had clicked on that option when setting up.

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    I vote for YES, period (full-stop in English ).
    In development and for maintenance purposes.

    Whenever you are looking at code it should be easily readable and easy to understand.
    There's nothing worse than trying to find out where an If statement ends in a 100 line blob of code.

    Just show them this: http://www.ioccc.org/1998/banks.c
    Since the fine folks over at the IOCCC have already compiled some of the most beautiful Ugly Code ever created (seriously – a C-based flight simulator with code shaped like an airplane – that’s impressive)
    George
    Home | Blog

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    [x] Yes, for development.
    [x] Yes, for maintenance.
    [x] No, it doesn't matter.
    [x] All of the above



    why doesn't it matter? because really good code is a piece of cake to write, even unformatted, and certainly doesn't require maintenance
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710
    Rudy doesn't believe in safe sex, but he always uses a condom.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    No brainer. Basic good practice.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  8. #8
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    definitely must format code.

    if you suffer from a lack of documentation, see my sig.

  9. #9
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I wish I could vote yes on both

    But doersn't it mean that doing it for developement means that you have it for maint?

    Maint, btw, what is that?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  10. #10
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710
    Hi Brett,

    Maintenance is any work done to change the production system after initial development--addition of columns, minor changes to process. In my scenario maintenance changes tend to cascade throughout the system.

    Since I started this post I have successfully persuaded my team to use TOAD's code formatter in the future. Minor victory. I don't have TOAD right now, so I don't even know how good it is yet. Also, the team won't be formatting legacy code. I just have to format the legacy code file by file with a text editor and then read it to determine if there is any impact.

    Has anybody used TOAD's code formatter?

    Rudy, that bicycle article give "humpin" a whole new meaning.

    Will look jezemine and georgev.

  11. #11
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710
    I am coining a new term: Code Slob

    I think I am going to create design and sell it as a product at CafePress.

    Gotta come up with a term for the nemesis of a code slob.

  12. #12
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Consistently formatted code costs less to produce, and it costs less to maintain, because it is easier to debug and troubleshoot.

    On the other hand, to the compiler/interpreter, formatting DOES make no difference.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  13. #13
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,799
    I am afraid I have to agree with the majority on this one. First thing I do when someone dumps a query in my lap is to reformat it using the "Crowley indentation" method. Maybeyourcoworkersliketotryreadingsloppycode,butId on't.

  14. #14
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    I don't think it matters either way, however I find code that isn't formatted a pain to read, a pain to comprehend, and a pain to debug.

    I don't like picking up code which isn't formatted, but thats the least of my concerns. Id rather have competantly written, tested & deployed code that looks rougher than a bears backside (providing I don't have to dive in and fix faults), than wonderfully well formatted and laid out code which doesn't do what is required.

    I think there is a danger of confusion, it doesn't matter but its good practice at all levels, during design, testing and maintenance. I find it especially useful in languages such as PHP, C# and the like which use brackets to start and end code blocks, but I would never insist on it. Fundamentally the the clearer the code is the easier it is to understand (or should that read the less difficult it should be...)

    I prefer to break apart the SQL in VB into separate elements eg the selects in one block, the joins in another, the parameters another. as far as the compiler is concerned its irrelevant.. The compilers bin such formatting, so its irrelevant to the codes function.

    Heck if someone wants to pay me 25...40per hour to reformat their code I don't care, if they want to pay me to read their mangled code I don't care.. providing the cheque clears, thats fine by me.

    if you are selling code to a third party there are tools that will deliberately obfuscate the code...
    I'd rather be riding on the Tiger 800 or the Norton

  15. #15
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    710
    I've finally received my license for TOAD and I must say, it's code formatter is excellent. Such a tool should be built into every editor.

    I want to thank everyone for their input. I've used what's been said to write an email to the team to urge them to go through the legacy code and use TOAD to format it for those who don't have TOAD licenses.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •