Is Dvorak typing appropriate for programming? [closed] - typing

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm always looking for ways to be more productive, and I've been reading a lot about typing using a Dvorak keyboard.
It looks like this would be much more productive for writing normal prose, but what about for programming?
I'm skeptical that it would be effective, since the use of semicolons, colons, brackets, and ampersands are much more common in programming than they are in every day typing.
Has anyone had any experience with this?

A couple years back when I was starting to feel some pain in my wrists, I decided to learn how to type on a Dvorak layout. (Side note: I found it extremely simple to learn the layout using a qwerty keyboard while looking at an image of a Dvorak keyboard at the bottom of my screen)
The only programming difference primarily was that the square brackets and curly braces swapped positions with the minus and plus buttons above them. Depending on what language you're using and how heavily you're using those keys, that can be annoying; but then again, maybe your IDE will automatically insert those where appropriate. Or, you could use a program like AutoHotkey to map another key combination to those symbols.
Here's the thing with typing in Dvorak: (IMHO) you need to go all Dvorak or all qwerty, particularly if you heavily rely on keyboard shortcuts throughout all of your computing sessions.
My situation is that I use Vim very frequently both at work and at home. At my last job, computers were shared between multiple idiots people, and I could not reasonably expect other users to know how to switch out of Dvorak. I had to "re-learn" the muscle memory for Vim commands.
It's extremely easy for me to switch back and forth on the fly between qwerty and Dvorak for simple text, but (and maybe it's just me) all my known keyboard shortcuts are muscle memory. So a :w in Vim on qwerty ends up as a S,, and a I# to comment a line ends up as C#, instead of replacing the whole line with just a pound symbol. And you can just forget about hjkl to navigate in Vim - instead of pressing keys on the home row, now you have to press the equivalent of jcvp. Oh, you want to copy-cut-paste with one hand? xcv has now moved to bi. instead, so have fun reaching all over the keyboard. New tab in Firefox? You were just typing in Dvorak, so you hit ctrl-t, but the keyboard is actually in qwerty mode, so you just ctrl-k to jump to the web search bar.
One of the other low points of Dvorak is the awkward 30-60 second explanation if a coworker needs to use your computer for a moment.
So I'm very sad to say that after about 4 years of typing primarily in Dvorak, I have to type in qwerty now because it is simply unnecessarily difficult to switch back and forth between modes and retain my muscle memory of my keyboard shortcuts.
On the other hand, there is some Vim work-around support for Dvorak, so maybe today would be a good day for me to get back on the Dvorak wagon. And I suppose if somebody were feeling particularly ambitious, he could set up an AHK script to remap normal/shifted keys from qwerty to Dvorak, but just pass through the qwerty keys when ctrl/alt were held. Seems like it would be a lot of work for very little payoff, though.
To recap:
Dvorak is great for RSI
Switching between qwerty and Dvorak is easy for typing, horrible for keyboard shortcuts and other muscle memory
Dvorak can be a large hassle to use at work, depending on your work environment
I sincerely hope this gives you some more direction on the decision of whether to go Dvorak.

Believe it or not the amount of special characters (such as [], {}, etc) in source code is negligible compared to normal english text.
I wrote a small program that counted the occurrences of every character in the source code of a fairly big project I'm working on (50k lines), these are the results. The language is C++.
E = 104050
T = 86887
I = 62788
A = 61746
R = 60438
S = 58897
N = 56595
O = 51640
L = 45490
C = 39251
D = 33776
U = 30971
" = 27858
M = 25925
, = 25296
P = 23742
( = 21407
) = 21391
F = 21232
G = 20860
/ = 19745
H = 19717
; = 19226
_ = 16207
B = 13576
= = 12427
Y = 10498
0 = 10125
. = 9842
K = 9241
: = 8907
W = 8509
V = 7922
{ = 7648
} = 7639
= 6626
% = 6507
Q = 5896
1 = 5752
- = 5382
X = 5261
' = 3877
\ = 3421
2 = 3395
+ = 3172
& = 2702
[ = 2597
] = 2586
3 = 2174
Z = 2141
4 = 1657
J = 1599
! = 1595
5 = 1560
# = 1501
6 = 1367
| = 1029
8 = 967
9 = 953
7 = 939
? = 610
` = 367
~ = 59
$ = 47
# = 7
^ = 6

There are Dvorak layouts specifically for programming: http://www.kaufmann.no/roland/dvorak/

Didn't see this mentioned, so I thought I'd add this: I'm using the Dvorak layout on a QWERTY keyboard, with QWERTY command key layout. Means every time I press the command button (I'm on a Mac), the QWERTY layout applies. So I'm typing completely "blindfolded" with the Dvorak layout, but I didn't have to re-learn the keyboard shortcuts. Has worked great so far for the last 4 years and I wouldn't change back to QWERTY.
The only downside of this is when using VIM, but nowadays I mostly use vim only for simple things, e.g. modifying config files over SSH.

You may want to consider the colemak layout. from the faq:
Programming languages make heavy use
of punctuation symbols. Colemak keeps
almost all of the punctuation keys in
their QWERTY positions to ease the
transition from QWERTY. It depends on
what programming languages you use,
variable naming conventions (CamelCase
vs. underscores) and what editor you
use. In the end it's a matter of
personal preference. You'd might want
to remap the AltGr sequences to
punctuation symbols you use often.

The purpose of the Dvorak keyboard is to prevent strain on the hands by keeping the most typed letters on the home row, at least for English. I highly doubt this would help with programming in any significant way due to the speed at which code is written. I always think about what I write as I write it, and variable names are never completely conforming to standard English. In fact, I would not be surprised if the letter frequencies in a typical file of source code varies dramatically from established English letter frequencies.
If you suffer from something like Carpal Tunnel, Dvorak may help alleviate that. I'd have to say that the Dvorak keyboard probably helps with regular writing and typing far more than with programming.

QWERTY and Dvorak keyboard layouts were designed for typing text not code.
You can try layouts for typing code like this one: Programmer Dvorak Keyboard Layout

I've been using Dvorak for more than 1.5 years. The reason of using Dvorak layout is not the speed, but the comfort itself. You think more than you type code. I code mostly using emacs, however, I'm not using default keybinding. Since emacs is relatively highly customisable, I use Ergoemacs keybindings. It really helps me to code in emacs, while retaining my Dvorak comfort without jumping here and there when I want to do an emacs operation which mostly done using key combination.

Being used to dvorak can be a bit of a problem if you're working in a team or something like that where you type on other peoples computers.

I use a Dvorak-es layout -optimized for the frequency of letters in the Spanish language- both for programming and typing, and the special keys (){}[]<>/* etc. are the same in this and Qwerty.
If you're doing the switch to Dvorak, perhaps it would pay to design your own "Programmer's Dvorak" layout with the standard QWERTY positions for these keys. At least on Windows you could use the MS Keyboard Layout creator to do this.

Well any keyboard can be appropriate for programming. It just would matter if you find it comfortable for typing because it breaks your way of typing with QWERTY.
On a side note, this keyboard would be awful for left-handed people such as myself.

Similar to the previous answer - any keyboard layout can be appropriate if that is what you feel comfortable with and can work efficiently with. Dvorak could always be a possiblity if you're interested in it - why don't you give it a try? I'm sure you can find an old keyboard to switch a few keys around on.
Worst case scenario: you revert back to qwerty. :)
Link

Related

Text language based decision making

I am currently developing with MPLAB X (IDE) on PIC32 platforms using C programming language.
I have a MAJOR project coming up which includes displaying graphics and text on a TFT screen.
We develop our systems for multiple languages ,including languages written "right to left" & "left to right".
So some symbols also change their position, and texts change their alignments on the screen.
So far Iv'e seen my former developer implement the code in a way that every screen displayed, or every object presented on the screen is tested for the language selected and then takes actions accordingly.
e.g:
/**Some actions shared by all the languages**/
.
.
/* language specific actions: */
if(language == lang1){
.
.
/* Performs some actions */
/* e.g: */
displayText(txt, LEFT_ALIGNED);
.
.
} else if(language == lang2){
.
.
/**SAME** actions with only minor changes depending on the language selected. */
/* e.g: */
displayText(txt, RIGHT_ALIGNED);
.
.
} else if.... (and so on)
As you can see, it seems quite an overhead, and the code this way has a lot of superfluous code duplication, especially when this structure is repeated inside almost every function/source file.
I am trying to think of an approach for developing more of a "polymorphic" structure that would not require so many "if else" statements.
I tried to search the internet for some examples implementing text based decision making, but was unable to find what I need, mostly due to the fact that I find it hard to describe my question.
I hope this is not somewhat a vague question,
but is there any structural consensus for implementing this kind of situations?
Many Thanks,
Tsoof A.
I would go for an array of language/action structures, then search the array for the language in question, and execute the associated action:
typedef struct {
char *lang;
void (*action)();
} action_t;
action_t actions[] = {{"en", func1}, {"de", func2}, ...};
...
for(int i = 0; i < sizeof(actions)/sizeof(actions[0]); i++)
if(!strcmp(actions[i].lang, language)) {
actions[i].action();
break;
}

How to indicate an word exception for stemming in Hunspell

I am using Hunspell to stem words for a SOLR instance. For the most part, it seems to be working well.
I'm using the OpenOffice dic/aff files.
However, there are some notable word exceptions, and I'd like to be able to remove these as candidates for stemming.
A great example is "skier", which stems to "sky" because of the following:
in the .dic file
sky/MDRSGZ
relevant rule in the .aff file
SFX R y ier [^aeiou]y
Is there any way to indicate that skier and only skier should be left alone?
Yeah this is a very common thing, just remove the "R"
sky/MDSGZ
But you may then want to add back in on another line "skier" and any other versions of it.
skier/MS
I have had to make numerous changes to this file, and now really wish there was a better option.
For example
Butter -> Butt
Corner -> Corn
Easter -> East
And then another one that is really confusing,
Wind == Wound
On my site before we fixed it if you searched for wind like in "wind power" you ended up with a bunch of bruises and bloody wounds.
Because "wound" like in "I wound the clock" stemmed to wind.
We also decided to remove all RE prefixes. because things like
remarkable -> mark
remove -> move
reset -> set
restore -> store
So if you know of a better dictionary that is better for this please let me know. (I think the main problem is this dictionary is more intended for spell check then for stemming)
I would be willing to start and/or contribute to a git project for a real stemming dictionary to replace this spelling dictionary for everyone out there using this.
have you tried freeling? It is open sourced.
A demo page is here:
http://nlp.lsi.upc.edu/freeling/demo/demo.php
When I pick english, pos tagging I get the following result:
you wound the clock?
you wind the clock?
PRP VBD DT NN ?
also skier, wind power all get the noun stems. It is a great stemmer and analyzer.
not sure about licensing. the download page:
http://devel.cpl.upc.edu/freeling/downloads?order=time&desc=1

How to search three or more arrays row by row for an optimum value in matlab

I have a few variables and here they are, three variables "R1, R2 and R3" each have a size of [40 x 1].
I have a fourth variable U of the same dimension. For every U(i) I need to search for an optimum value within R1(i), R2(i) and R3(i) which would return a single value solution. I intend to plot the optimum value against U9i).I have been trying to wrap my head around the knnsearch function but no luck.
Any one out there who could please help??
Thanks
Well when I can't wrap my head around something, I don't come here first.
A lot of people forget this one because we are online, but read a book on the topic. Have your code open so when you see something in the book, test it out.
Draw out any type of diagram. I call these "Napkin Diagrams", because I write it on anything, even a napkin.
I play with code until my keyboard has no letters left on it, then I keep plugging away until the keys fall off
Explore the language API's
Check for public repositories that you can play with
Google, is okay for a quick reference, but google will not teach you anything other than how to google
I talk my code over with myself all the time, people think I'm nuts, but so do I . . It actually works sometimes.
Then if I still can't get it, I come here with a list of things that I have tried, sample code that has not worked, etc.
I used to hate when people told me this, but that was the best thing anyone could have done for me so I tend to do the same now" Thinking about coding is a big part, but u have to get done wht u can. Then we all know what level u are at. Plus it being the end of semester a lot of these types of questions are homework...
Thinking is good, now turn those thoughts into a conceptual design . It's okay to be wrong in this stage, its all just conceptual
If I understood correctly, this might be what you need:
RR = [R1(:) R2(:) R3(:)];
d = bsxfun(#minus,RR, U(:));
[m mi] = min(abs(d),[],2);
answer = RR(:,mi);
first - put the three vectors into a single matrix:
RR = [R1(:) R2(:) R3(:)];
next, take the difference with U: bsxfun is ideal for this kind of thing
d = bsxfun(#minus,RR, U(:));
Now find the minimum absolute difference for each row:
[m mi] = min(abs(d),[],2);
The corresponding indices should allow you to find the "best fit"
answer = RR(:,mi);
I had to do some mind reading to get to this 'answer', so feel free to correct my misunderstanding of your problem!
update if you just need the highest of the three values, then
val = max([R1(:) R2(:) R3(:)]');
plot(U, val);
should be all you need...

Why does my touch develop script keep crashing?

The question isn't exactly concerned with touch develop rather just basic programming "structure" or syntax.
what I am trying to do is create a simple compass working on the phones heading capability. The heading capability just spits out degree readings to several (like 12) decimal places.
Anyway, even just letting the phone spit out the heading, eventually the phone will crash, why is that? Running out of memory?
The reason I came here is because of this:
I want to update the page with a photo of an associated rotation based on degree readout. I can't figure out how to do something like if 0 < x < 1 post this picture. Since the heading readout varies like 321.18364947363 and 321.10243635471
So currently I am testing this: several if / if else statements saying if heading output is 1 post picture with 1 degree rotation, 2 post picture with 2 degree rotation. This definitely and guaranteed crashes the phone. Why? Memory?
If you are a touch developer, would it be easier and more sane to simply take a round object, center it in relation to a square image and use it as a sprite or object which then you can dictate what angular velocity and position the object has without doing / using 360 individual images.
GAH! Damn character limits / thread format
this is what follows what I last wrote below for anyone that cares :
The concept seems simple enough but I am basically a programming noob, I was all over the place trying to learn Python, Java and C/C#/C++. ( I wrote this on my Windows Phone 8 but I was unable to copy the text ( GAY ) ) I am happy to have come across Touch Develop because it is better for me as a visual learner. (Thanks for the life story )right ? haha
The idea would have been to use this dumb pink against black giant compass with three headings / points of interests namely A fixed relative north, the heading and a position given by the person to be found's lat and long coordinates relative to the finder's phone's current location (lat and long ). This app in my mind would be used for party scenarios. I would have benefited from this app had the circumstances been right, I was lost at a party and I had to take a cab home for $110.00 because I didn't drive to that party.

'8 Ball' Program

I've tried looking on google but i guess I can just not get the right search phrases to find what I want. If you are familiar with the afterNET IRC server, there is a command '.8' which is an 8 ball. It answers more than just yes/no questions tho. It gives you a variety of answers based on certain words you use in your question, like when, where, color, etc
I'd like to make something like this but have no idea where to start. I've recently studied DFA (Deterministic Finite Automata), is that where I should start? I understand I don't want to be scripting out every possible combination of words people use, but it would be nice to have a system that feels sorta realistic (like the 8ball program on the IRC server), and is expandable for more 'words' whenever I want.
Thanks for any help/links!
You may be giving most 8ball implementations more credit than they deserve. I think the point is that the questions are for yes/no answers, so the provided answers only have to cover a fairly predictable set of possibilities.
Most 8ball scripts that I am aware of (example) will just use an array and a random number to grab an answer.
Magic 8ball bots are very popular on irc as they are very easy to implement - simply respond to text with a given marker (in this case ".8") and respond with a random answer.
I have never heard of a magic 8ball using a deterministic approach, Cleverbot style. Actually, trying that, I'm not even sure how deterministic that is as most of the responses are also totally random and unrelated to what I was saying.
// our answers array
String[] answers = [ "yes", "no", "for sure", "unlikely", "most certainly", "definitely not" ];
public String ask8Ball() {
// rand returns a float between 0>=res>1, the (int) cast rounds down
int index = (int)(java.lang.Math.random() * 7);
return answers[index];
}

Resources