x404.co.uk http://www.x404.co.uk/forum/ |
|
How do you indent yours? http://www.x404.co.uk/forum/viewtopic.php?f=4&t=6439 |
Page 1 of 3 |
Author: | Fogmeister [ Sun Feb 21, 2010 5:34 pm ] | |||||||||||||||||||||||||||
Post subject: | How do you indent yours? | |||||||||||||||||||||||||||
A question for any programmers out there. Every programmer, no matter what the language, uses blocks of some sort. Be they if blocks, for loops, switch, else, try, catch, do, while, repeat, etc... My question is simply, how do you indent yours? Personally my indentation method follows the pattern...
i.e.
I find it a lot easier that way to recognise where blocks start and finish. I ask because I have recently started using XCode and the blocking in the templates follows no standard whatsoever. There is the odd time when it is blocked the same as my above example but the a lot of the time it is done thus...
and when the conditions number into the tens it gets to the point where you can't even see the opening bracket. So, how do you indent yours? |
Author: | Fogmeister [ Sun Feb 21, 2010 5:47 pm ] |
Post subject: | Re: How do you indent yours? |
LOL, just found out that they all have names ![]() http://en.wikipedia.org/wiki/Indent_style Mine is the Allman style ![]() |
Author: | big_D [ Sun Feb 21, 2010 6:17 pm ] | |||||||||
Post subject: | Re: How do you indent yours? | |||||||||
It is also language dependent. Some languages remcommend different styles. I prefer the first method, althoug a lot of language recommend the second. A mixture is also often used
|
Author: | EddArmitage [ Sun Feb 21, 2010 6:34 pm ] |
Post subject: | Re: How do you indent yours? |
I prefer the second, but I can't give a justifiable reason why. When there's many parameters I run onto multiple lines, with one aligned parameter per line. |
Author: | Fogmeister [ Sun Feb 21, 2010 6:49 pm ] | ||||||||||||||||||
Post subject: | Re: How do you indent yours? | ||||||||||||||||||
That's true, I do that at work but at work we use a non "curly bracket" language. I would run a query like this...
Similarly if a function has several params I'll align them on each line with the opening parenthesis of the parameter list. |
Author: | EddArmitage [ Sun Feb 21, 2010 6:51 pm ] | |||||||||
Post subject: | Re: How do you indent yours? | |||||||||
Now I always indent blocks, so your example would look more like:
assuming that's legal in the language. And I align parameters with the first parameter. |
Author: | Fogmeister [ Sun Feb 21, 2010 6:54 pm ] | ||||||||||||||||||
Post subject: | Re: How do you indent yours? | ||||||||||||||||||
That would make sense also and would be legal. I suppose it's what you get used to reading. My first curly bracket language was Java and my lecturer always indented my first way so I find it hard to read code done other ways now. |
Author: | phantombudgie [ Sun Feb 21, 2010 7:19 pm ] |
Post subject: | Re: How do you indent yours? |
I use Python and FORTRAN ![]() ![]() ![]() My final answer to the question "How do you indent yours?" "python style" ![]() |
Author: | soddit112 [ Sun Feb 21, 2010 9:00 pm ] |
Post subject: | Re: How do you indent yours? |
im learning C# at the minute, and the book im reading recommends the first method. Makes sense to me, as its clearer where the block starts ![]() |
Author: | Fogmeister [ Sun Feb 21, 2010 9:07 pm ] |
Post subject: | Re: How do you indent yours? |
Here's a wiki of the language I use. http://en.wikipedia.org/wiki/OpenEdge Its called OpenEdge or Progress (depending on which version you are using ![]() |
Author: | finlay666 [ Mon Feb 22, 2010 3:18 pm ] | |||||||||
Post subject: | Re: How do you indent yours? | |||||||||
In visual studio C#, write code, then Ctrl+k, Ctrl+d Does all of it for you ![]() |
Author: | HeatherKay [ Mon Feb 22, 2010 3:19 pm ] |
Post subject: | Re: How do you indent yours? |
OT: Another thread that would fit nicely into a programming forum, don't you think? |
Author: | AlunD [ Mon Feb 22, 2010 3:21 pm ] | |||||||||
Post subject: | Re: How do you indent yours? | |||||||||
But we don't have one ![]() |
Author: | EddArmitage [ Mon Feb 22, 2010 3:23 pm ] | |||||||||
Post subject: | Re: How do you indent yours? | |||||||||
Why aye! |
Author: | forquare1 [ Mon Feb 22, 2010 3:29 pm ] | |||||||||||||||||||||||||||
Post subject: | Re: How do you indent yours? | |||||||||||||||||||||||||||
I use this method:
If the bracket drops down a ling I feel the file get's longer and somehow feels more complicated, without adding any readability. Seems to be coined the "One TrueBrace Style".
We should have one! |
Page 1 of 3 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |