Thread: What's your prefered program layout?

  1. #16
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    Thats it. As I got it.
    Eeeeeeeeeeeeeek! If I saw that code the first thing I would do is reach for the rum and coke, then try to comment it!

    last year I did a major project for my course and I started programming in June. Even though I used variable names and did basic commenting I still got lost in my own code by november
    My site to register for all my other websites!
    'Clifton Bazaar'

  2. #17
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Numerous studies have shown that Allman, (or variations), of Allman format have the highest readability level.

    One series of tests, (the one's I used to convince my company to change formats!), gave a series of programmers a series of functions written in various formats, and averaged the time taken to deliver a correct description of what the function was doing. After many many trials, Allman was a clear winner.

    The Allman format encompasses more than just the positioning of the braces, but in that respect, it is...

    Code:
    if (expression)
    {
        actions;
    }
    else
    {
        actions;
    }
    ... type thing, not a K&R.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #18
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    Numerous studies have shown that Allman, (or variations), of Allman format have the highest readability level.
    Do you have a link to that method? and a link to the study would be appreciated. I have never been taught properly so I think it would be a good read.
    My site to register for all my other websites!
    'Clifton Bazaar'

  4. #19
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I can probably dig them up, but would guess a well worded search at google for example would be revealling. Allman is one of the best known formats, (along with K&R and Whitesmith).

    One reason for doing it the other way is that you can get more lines on the screen/page. Frankly, with todays technology, I don't believe that argument holds up any more. I may have thought differently if I was using C 25 years ago when we worked with 300 baud teletype terminals, if we were lucky.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #20
    Frustrated Programmer :( phantom's Avatar
    Join Date
    Sep 2001
    Posts
    163
    if we were lucky.
    Kids today though, they wouldn't beleive you!

    Just going through google now, I put allman in and it gave me 219 000 matches. Have now refined my search

    Got it now, thanks for the info.
    My site to register for all my other websites!
    'Clifton Bazaar'

  6. #21
    Registered User
    Join Date
    Sep 2001
    Posts
    140
    Brian, wtf is mum?

  7. #22
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Originally posted by stupid_mutt
    Brian, wtf is mum?
    The correct spelling of the shortened version of Mother.

  8. #23
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > The correct spelling of the shortened version of Mother.

    Correct, of course, if you live in Britain. If you live in the US, it's mom.

  9. #24
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    No, it's our language, we invented it. Stick to it or get your own.


    [That mum/mom post was actually a troll. Don't feed me.]

  10. #25
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    ^&^ & ^&^& ^& &^^ ^&^^&&^&, ^&^ ^& &^& ^&^^ &^& &^...

    But I have my own language, but no one will use it

    Anyways, it's not like English wasn't just cannibalized from a bunch of other languages in the first place...

  11. #26
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    > [That mum/mom post was actually a troll. Don't feed me.]

    Damn you! Editing after I post!

  12. #27
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Well, actually when I finished editing, your post was still non existant.

  13. #28
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    Well I use this one:

    Code:
       int main () {
          //whatever
          return 0;
       }
    However, I use a neat IDE that can fold a closing curly brace up to it's opening curly brace, so

    Code:
       while (!stop) {
          //Many lines of code
       }
    becomes

    Code:
    + while (!stop) {}
    And clicking the plus expands it out again, but double clicking the while folds it back in. So whenever I don't feel like scrolling past something that I know works, I just fold it up!

  14. #29
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    What IDE is that, Imperito?

  15. #30
    Evil Member
    Join Date
    Jan 2002
    Posts
    638
    That would be jGrasp.

    eng.auburn.edu/grasp/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Issue with program that's calling a function and has a loop
    By tigerfansince84 in forum C++ Programming
    Replies: 9
    Last Post: 11-12-2008, 01:38 PM
  2. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  3. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  4. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM