[program-l] Re: Indentation of code

  • From: Doug Lee <dgl@xxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Thu, 20 May 2010 06:41:38 -0400

I have been programming professionally for 18 years and I've never
seen code written and maintained by sighted people that is not
structurally indented.  I accepted indentation requirements as a
reality in college when my professor actually marked off points for my
indentation distance being only two spaces, which works great for
Braille, instead of four spaces or a tab, which works better visually.
I then learned to appreciate the advantages of indentation, which
include the ability to put my finger on the "i" of an "if" on a
Braille display and then quickly arrow down until another non-blank
character appears under my finger signaling the end of the "if" block.
Then Python came along and made indentation an actual part of the
language.  That took some getting used to, but it's actually rather
cool to know that indent level and program structure are necessarily
in sync.

On Wed, May 19, 2010 at 09:08:23PM -0500, Amanda Lacy wrote:
Am I the only one who thinks indentation makes code harder to read? I
focus on the information itself, and when much of my braille display
is consumed by space I find it a destraction. I have yet to understand
its use.

On 5/19/10, Doug Lee <dgl@xxxxxxxx> wrote:
> For what it's worth, I strongly prefer using tabs and not spaces:  Tab
> width can be varied by the user with no changes to the code, using
> tabs means one character per indent instead of the average three or
> four spaces, tabs can be displayed as printable characters like ^I in
> some editors in case checking indents is a problem for some reason,
> and one can translate tabs to the normal two spaces before Brailling a
> listing if necessary.  As a rule, if I see spaces for indenting in a
> program, I imitate what's there if I'm making small changes, but I
> replace them all with tabs if I'm taking over the file.
>
> On Wed, May 19, 2010 at 02:35:45PM -0600, Tyler Littlefield wrote:
> I had to switch the tabs to spaces in python, so that I could read
> other code. No idea why edsharp defaults to tabs, and whether you'll
> be aloud to use spaces, you have to use \40 I believe to get a space.
> ----- Original Message ----- From: "?yvind Lode"
> <oyvind.lode@xxxxxxxx>
> To: <program-l@xxxxxxxxxxxxx>
> Sent: Wednesday, May 19, 2010 2:19 PM
> Subject: [program-l] Re: Indentation of code
>
>
>>Hi:
>>
>>I currently don't have any preferred style of indentation.
>>EdSharp defaults to tab indentation.
>>But I feel it's a waste of cells on my Braille display he he.
>>But I'll probably find my preferred way of indentation the more code I
>>write.
>>Reading source code written by other programmers is probably also a good
>>idea.
>>
>>-----Original Message-----
>>From: program-l-bounce@xxxxxxxxxxxxx
>>[mailto:program-l-bounce@xxxxxxxxxxxxx]
>>On Behalf Of David Lant
>>Sent: 19. mai 2010 21:13
>>To: program-l@xxxxxxxxxxxxx
>>Subject: [program-l] Re: Indentation of code
>>
>>Hi,
>>
>>Yes, I always indent code.  However, this may make it sound like I
>>actually
>>do anything to achieve this.  Using Visual Studio, coding in either VB or
>>C#, it is possible to have the editor automatically do all the
>>indenting for
>>you, so you don't even need to think about it.  This is especially well
>>implemented for VB, but does appear for C# too.
>>
>>There is no reason at all why a blind developer shouldn't indent code.  It
>>doesn't add any overhead to reading the code back, as any leading
>>spaces can
>>be ignored by a screen reader.  If you really want to know how your
>>code is
>>indented, then I'm sure most if not all of them include a feature to tell
>>you what the indentation of the current line is.
>>
>>If you have a particular layout style that you like, which is
>>different from
>>that used by your editor of choice, you can always go into the Options and
>>change the settings.  The simplest thing of course is  to change how many
>>spaces are indented and whether this is done by adding leading spaces or
>>adding tabs.  But there are other options you can play with as well, up to
>>and including turning off automatic formatting altogether.
>>
>>Sighted people always prefer code to be formatted so they can easily scan
>>the layout and both identify the overall structure and locate particular
>>constructs.  So whether you're expecting to show code to a sighted
>>person or
>>not, I'd always recommend getting into the habit of indenting and
>>formatting
>>neatly.
>>
>>All the best,
>>
>>David
>>
>>David Lant
>>Applications analyst
>>
>>MCPD Enterprise Application Development 3.5
>>MCTS ASP.NET 3.5, ADO.NET 3.5, Windows Communication Foundation 3.5,
>>Windows
>>Applications 3.5
>>
>>-----Original Message-----
>>From: program-l-bounce@xxxxxxxxxxxxx
>>[mailto:program-l-bounce@xxxxxxxxxxxxx]
>>On Behalf Of ?yvind Lode
>>Sent: 19 May 2010 16:55
>>To: programmingblind@xxxxxxxxxxxxx; program-l@xxxxxxxxxxxxx
>>Subject: [program-l] Indentation of code
>>
>>Hi all:
>>
>>I'm just wondering how you folks indent your code?
>>Do you use indentation at all?
>>
>>I know that indentation is not required for C#, but sighted folks
>>prefer it.
>>
>>Currently I don't have any code to share between sighted and blind
>>programmers.
>>I've just started learning to program and I use C#.
>>
>>I'm just curious and would like some pointers.
>>I'm just trying to develop a good habit of how my code should look like.
>>
>>** To leave the list, click on the immediately-following link:-
>>** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
>>** If this link doesn't work then send a message to:
>>** program-l-request@xxxxxxxxxxxxx
>>** and in the Subject line type
>>** unsubscribe
>>** For other list commands such as vacation mode, click on the
>>** immediately-following link:-
>>** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
>>** or send a message, to
>>** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
>>
>>** To leave the list, click on the immediately-following link:-
>>** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
>>** If this link doesn't work then send a message to:
>>** program-l-request@xxxxxxxxxxxxx
>>** and in the Subject line type
>>** unsubscribe
>>** For other list commands such as vacation mode, click on the
>>** immediately-following link:-
>>** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
>>** or send a message, to
>>** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
>>
>>** To leave the list, click on the immediately-following link:-
>>** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
>>** If this link doesn't work then send a message to:
>>** program-l-request@xxxxxxxxxxxxx
>>** and in the Subject line type
>>** unsubscribe
>>** For other list commands such as vacation mode, click on the
>>** immediately-following link:-
>>** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
>>** or send a message, to
>>** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
>
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** program-l-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
>
> --
> Doug Lee                 dgl@xxxxxxxx                http://www.dlee.org
> SSB BART Group           doug.lee@xxxxxxxxxxxxxxxx
> http://www.ssbbartgroup.com
> The very smart may feel they have nothing to learn from anyone;
> The very wise will find something to learn from everyone.  (7/14/01)
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** program-l-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** program-l-request@xxxxxxxxxxxxx with the Subject:- faq
>
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

-- 
Doug Lee                 dgl@xxxxxxxx                http://www.dlee.org
SSB BART Group           doug.lee@xxxxxxxxxxxxxxxx   http://www.ssbbartgroup.com
"It is not the mountain in the distance which makes you want to stop
walking; but the grain of sand in your shoe."  --Anon
** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: