45

I am visually impaired. With glasses I see well enough to drive, but at the font size I'm comfortable working at I can only see about 15 lines of 100 characters at a time. This has affected my coding style.

One thing I do is write shorter functions. My code tends to get good reviews because these short functions with good names make the higher level functions very readable, but in high performance situations some folks make comments about how much space I'm taking up on the stack by passing variables down several layers for processing.

A second thing I do is divide classes up between files to make shorter files. This reduces the scrolling distance to get to relevant functions and depending on organization may allow me to put the files up on different monitors to look at them together.

Both of these practices make for more documentable units that most coding styles require I document, which further aggravates the issue by extending the length of my file and the distance between related functions.

I'm currently using Visual Studio, which allows code folding at the function and comment block level (which I use frequently) but does not fold at the bracket level like Notepad++ does. The editor that offers better code folding doesn't have all the intellisense features of VS. I could use regions in VS, but this looks very cluttered if used every 10 lines. Folding is occasionally helpful to get completed code out of view while I'm working on a different feature of the code.

Can anyone recommend better coding practices to help with limited visibility of the code?

Denise Skidmore
  • 481
  • 3
  • 9
  • 6
    I'm guessing you've already thought of this, but is a larger screen an option? – Brian Snow Sep 03 '13 at 14:13
  • 13
    I'd recommend you to have as large display as possible. If you employee refuses/cannot afford one, you could even buy that yourself since it'll make you job much easier. Also search for a VC plugin with the folding capabilities you need, I'm sure there would be one. – superM Sep 03 '13 at 14:13
  • Don't forget that Visual Studio lets you create a folder structure to group code files. This can help with the vertical scrolling. I'ld just recommend consistancy on breaking up the files. – Don Nickel Sep 03 '13 at 14:52
  • 5
    About stack space: What about inlining functions (in c++)? – Marcel Sep 03 '13 at 15:30
  • 3
    I'd also push for your employer to buy a larger screen. They should absolutely see that it's an investment in productivity, and they should be providing it, especially where there's a very legitimate reason (in this case your visual impairment). As for the code reviewers disliking stack space usage: has it led to a *real* performance issue, or is it just micro-optimization griping? Unless you're coding for embedded systems, this shouldn't be a problem. – Daenyth Sep 03 '13 at 15:31
  • 1
    What language are you programming in? – Marcel Sep 03 '13 at 15:31
  • 6
    I find this amusing, because when I learned to program, the typical screen handled only 25 lines of 80 characters (or even only 40 characters!) Older editors (vi/Emacs) tend to do better in these sorts of environments. – Gort the Robot Sep 03 '13 at 15:57
  • One other suggestion might be to make your tabs something less than 4 spaces. I'm not sure how practical this is going to be, but you might try it. – Brian Snow Sep 03 '13 at 16:18
  • 2
    Legally ADA forces the employer to accommodate me, but practically every time I've requested larger monitors from employers I've gotten very high resolution monitors, which makes the pixel size net out to be smaller. At home I use a 32" 1080p TV as my computer monitor, and I still have to use a high DPI setting. I've not found anything better. I've been down the ask for a bigger monitor road, it goes nowhere. – Denise Skidmore Sep 03 '13 at 17:05
  • Smaller tabs helps with line length, but not function/file length. Since my coding style uses lots of subfunctions, I don't tend to tab all that deep. – Denise Skidmore Sep 03 '13 at 17:06
  • As for language, I'm currently doing C# & C++, but I have the same problems in every language I work in, and I've worked in a half dozen. I think the language is not relevant unless you are recommending a different development environment. – Denise Skidmore Sep 03 '13 at 17:08
  • @StevenBurnap I'm rather grateful for remnants of those old days persisting in many coding standards today. Often there is an official rule to keep down to 80 or 100 characters wide, so I have a leg to stand on when complaining about co-worker's code that is much wider. When taking over someone else's code, often re-wrapping is my first priority so the narrow display looks more readable. – Denise Skidmore Sep 03 '13 at 17:19
  • I am using the Consolas font already. – Denise Skidmore Sep 03 '13 at 17:23
  • @DonNickel Yes, I use folders in C# projects extensively. There is a downside in that the default namespace is different in that folder, which means more include statements or more manually assigning namespaces. Sometimes more namespaces is desirable though... – Denise Skidmore Sep 03 '13 at 17:25
  • 1
    I'd expect modern compilers to optimize the function call hierarchy on their own, so I'd disregard that argument. – Simon Richter Sep 03 '13 at 19:30
  • Have you considered separate glasses that correct your vision to work distances? – Sean McSomething Sep 04 '13 at 00:01
  • Separate glasses will just give me headaches. At my prescription strength my brain is doing a lot of work to reassemble the image after lens distortion. It takes a couple weeks to change that programing when I get different lenses. – Denise Skidmore Sep 04 '13 at 00:17
  • Use reasonably small [line length limit](http://programmers.stackexchange.com/q/604/31260 "related discussion here"). Stick with the languages that tend to be less verbose / have less boilerplate code (the farther from COBOL, the better:). Focus on tasks that require more thinking than reading and writing code (as an example, in my experience concurrent programming was often like that). The list could go on and on... – gnat Sep 04 '13 at 05:15
  • Verbosity is partly a coding style issue, I tend to be rather verbose in my function/variable naming. Since I have so many functions, they must be well described. – Denise Skidmore Sep 04 '13 at 13:37

3 Answers3

37

Here are a couple suggestions. If you haven't already choose a font from these recommendations that makes it easier for you to see.

Many monitors support a 90 degree rotation. This is much better for reading and will allow you to get more lines on your screen. You can undock all of the VS tools and put them on the second monitor and just have a big code monitor to maximize visibility.

enter image description here

jamesSampica
  • 529
  • 4
  • 7
  • how does this answer the question asked? – gnat Sep 03 '13 at 14:50
  • 16
    _Can anyone recommend better coding practices to help with limited visibility of the code?_ @gnat Coding practices doesn't necessarily mean _only VS features/folding_ – jamesSampica Sep 03 '13 at 14:56
  • 19
    It does answer the actual problem, if not via the method requested. Sometimes in programming the hardest thing is to get the correct requirements from the customer. In this case I'm the guilty customer that didn't see a method other than my own proposal and tried to dictate design in my requirements. – Denise Skidmore Sep 03 '13 at 17:11
  • Looking at my current monitor, it does not appear to support that feature, but it is something I'll try at my next gig. Maybe I'll try it in a home setup and buy my own equipment. – Denise Skidmore Sep 03 '13 at 17:14
  • Undocking things and putting them on the other monitor is helpful. Sometimes I rather undock the code and then I get quite a bit more real estate with no toolbars or menu bar either. – Denise Skidmore Sep 03 '13 at 17:16
  • 2
    @Denise The rotation is actually typically handled by the stand not the monitor itself. Again something that your employer should be open to upgrading for you. – Mr.Mindor Sep 03 '13 at 19:12
  • @DeniseSkidmore The rotation of the image is also typically handled by the video driver. If your monitor stand doesn't allow for physical rotation of the screen, you could certainly ask for a replacement stand or monitor. I know all Dell monitors I've used at work allow 90 degree rotation in either direction with the basic included stand. – John Lyon Sep 03 '13 at 22:38
  • I highly recommend vertical monitors even for non-visually impaired programmers. Heck for anyone that does more reading than movie watching all that horizontal space is a waste. I can scan over 150 lines of code without scrolling in my vertical 1080p monitor. It's changed how quickly I can comprehend long classes/methods. – Philip Sep 04 '13 at 00:10
  • I will look into the stand rotation more. It is only useful in a dual monitor setup, as I do need some place for the solution tab, error window, etc. – Denise Skidmore Sep 04 '13 at 00:25
  • I've started rather than undocking all the tools, putting the entire VS window on the secondary monitor, and pull the current code window out to the primary monitor. I loose the tabs for quick switching, but I can have a smaller view of the other file I'm working on in the primary VS window. No solution is perfect, but every bit helps. :) – Denise Skidmore Sep 09 '13 at 03:22
5

you might want to try contacting the Blindenzentrum (Center for visually impaired students) at the University of Applied Sciences Giessen/Germany (bliz@thm.de). They have specialized in helping students of all subjects including computer-science during their studies. Maybe they can give you some hints that have been proven in the field.

Markus
  • 159
  • 1
  • 4
  • We had a completely blind CS student a year or two ahead of me. He had a braille display, worked entirely in console mode. Don't know how they handled the graphics project. – Denise Skidmore Sep 04 '13 at 00:28
4

You mention missing Notepad++'s bracket folding. You can add this behavior to Visual Studio with an extension. The C# outline extension is an example. It's free and does the job. There's no need to mess with regions inside a function or control block.

Corbin March
  • 8,104
  • 3
  • 37
  • 39