[program-l] Re: Indentation of code

  • From: "David Lant" <david.lant1@xxxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Thu, 20 May 2010 21:46:38 +0100

Wouldn't the space taken up by a tab also depend on what font was being used
etc?  That's no different to spaces themselves of course, but I imagine that
one tab could look like 4 spaces in one font and 6 in another couldn't it?

EdSharp is a useful tool and could easily be used for coding any .Net
language I'm sure.  As with all such things, increased user numbers will
probably increase the feature requests, so adding formatting support of
various kinds could yet see it being a preferred alternative to the VS code
editor.  With a little bit of work, EdSharp could even be built in such a
way as to integrate into a full visual Studio IDE and be used instead of the
built-in editor.  It just wouldn't be possible in the Express editions of
course, because they don't allow add-ins.

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 Jamal Mazrui
Sent: 20 May 2010 21:40
To: program-l@xxxxxxxxxxxxx
Subject: [program-l] Re: Indentation of code

In EdSharp, a tab character is not automatically expanded to span more 
characters.  Visually, I am not sure how much space it occupies -- that 
is controlled by the RichTextBox control of the .NET Framework.

I was speaking for myself, and definately understand why indentation may 
be important for your job goals.  I am curious though -- what makes you 
use EdSharp rather than an Express Edition of VS?

Jamal

On Thu, 20 May 2010, 
[iso-8859-1] Øyvind Lode wrote:

> Date: Thu, 20 May 2010 22:29:38 +0200
> From: "[iso-8859-1] Øyvind Lode" <oyvind.lode@xxxxxxxx>
> Reply-To: program-l@xxxxxxxxxxxxx
> To: program-l@xxxxxxxxxxxxx
> Subject: [program-l] Re: Indentation of code
> 
> 24 years? I've been programming for 4 weeks Smile!
> But I hope to join a team of developers at work sometime in the future.
> If that happens I would need to share code and collaborate with sighted
> programmers (I'm the only blind one).
> So I need to get used to indentation.
>
> Tabs seems to be the most common, but I've seen 2, 3 ,4 spaces as well.
> Edsharp defaults to tab = 6 spaces.
> Is this the same as Visual Studio uses by default?
> If so I guess it's a good idea for me to keep the tab which equals to 6
> spaces since all developers at work use Visual Studio.
>
> -----Original Message-----
> From: program-l-bounce@xxxxxxxxxxxxx
[mailto:program-l-bounce@xxxxxxxxxxxxx]
> On Behalf Of David Lant
> Sent: 20. mai 2010 21:49
> To: program-l@xxxxxxxxxxxxx
> Subject: [program-l] Re: Indentation of code
>
> The thing is, I can't think of any reason why a blind developer should not
> indent though.  You say it causes problems with moving to the start of a
> line, but that's a feature of the editor, not code indentation.  e.g. in
> Visual Studio, if I hit the home key on a line of code, the first time it
> will take me to the first non-blank character on that line.  the second
> press will take me to the first column.  It's so quick and easy to do it
> really isn't an overhead at all.  And it does this without any JAWS
scripts
> involved.
>
> As I've mentioned elsewhere, where the editor automatically formats code
as
> you type it, indentation and formatting doesn't even become a
consideration
> because it happens without your involvement.  Even copying and pasting
code
> automatically rearranges the layout to suit the code structures involved.
> Maybe I'm just spoiled by using Visual Basic.  but having come from a
COBOL,
> PL/1 and Natural background, manually indenting code just becomes a habit.
> Even on the mainframe I used to work on, the Natural editor used to
provide
> structured formatting features.  So it's nothing new.  I've been
programming
> for 24 years now, and I've never yet had a problem with it.
>
> I can understand how indentation might be distracting for a braille user,
> but depending on the width of the braille display, it wouldn't seem to be
a
> major problem.  After all, many source code editors allow code to extend
> beyond the average width of a braille display so I imagine you'd be
> scrolling left and right to read long lines too, for example.  Indentation
> wouldn't seem any worse than that to me.  Having the ability to quickly
scan
> down code to locate particular structures or blocks would seem
advantageous.
> I have vaguely considered getting a braille display for the added
> orientation information it might give.  I guess I've got on without one
for
> so long now though, it's not likely to happen.
>
> If you're just writing code for yourself, then one could say that all the
> normal good practice guidelines for coding could be ignored.  formatting,
> meaningful variable names, commented code etc would all seem unnecessary.
> However, I challenge any developer to prove unequivocally that any code
they
> write will never be seen by anyone else.  Even in situations when I
thought
> that was the case when writing a quick one-off utility or other, I've
always
> ended up finding another use for it that someone else ends up seeing.  So
in
> the end it's just quicker and easier to code in a structured and
formatted,
> well documented and human readable way.
>
> Having said all this, I do have to admit that the worst structured and
laid
> out code I ever came across was written by a fully sighted person.  It was
> so arcane and unmaintainable that it seemed like a deliberate ploy by that
> individual to make themselves indispensible.  If they were the only person
> who could make head or tail of the code, then surely they'd always have a
> job?  Well, auto-formatting and code analysis utilities soon put paid to
> that. :-)
>
> 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 Jamal Mazrui
> Sent: 20 May 2010 12:47
> To: program-l@xxxxxxxxxxxxx
> Cc: Amanda Lacy; Doug Lee
> Subject: [program-l] Re: Indentation of code
>
> Personally, as a speech-only user, I find indentation to be of no
> benefit.  In fact, I find it to be an efficiency drain in coding.  I
> cannot simply press Home to go to the start of code on a line.  When
> cutting and pasting code, it has to be adjusted to make indentation
> align.  I know there are hotkey work-arounds for this, but they involve
> more effort than when indentation is not a concern.  Rather than using
> indentation to help me follow code structure, I find it more productive
> to use a short in-line comment at the end of a block to remind me what
> structure it is completing.
>
> With that said, I understand that indentation is needed for usability of
> code by sighted readers, as well as good braille  readers (I read
> braille but am too slow to benefit from a braille display if speech is
> available).  I realize that if I coded in a team, I would always have to
> indent my code.  I also know that if I want a sighted person to work
> with nontrivial code, I need to use an auto-formatter before sharing it.
>
> Just because indentation is optimal for sighted programmers does not
> mean it is so for blind programmers.  They do not use some of our
> nonvisual techniques, and we do not need to use all their visual
> techniques. In a language that does not require indentation, an
> auto-formatter will indent more correctly than manually doing so.
>
> Jamal
>
> On 5/19/2010 10:08 PM, 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
>>
> ** 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

Other related posts: