3 ms·
> Similarly, I never type "for (int i = 0; i < blah; i++)." I type "cmd-J, fori, return." Etc.... As someone who didn't realize this existed in Intellij, I thi
by thorum 13y ago
> Similarly, I never type "for (int i = 0; i < blah; i++)." I type "cmd-J, fori, return." Etc....
As someone who didn't realize this existed in Intellij, I think you may have just changed my life :)
- acanby 13y agoYou can shorten it even further to typing 'fori' then triggering the expansion by pressing tab. Best shortcut that every IntelliJ user should know is "Find Action" (ctrl + shift + a on Win), press and start typing what you want to do. Will even present shortcuts in the list for next time.
- Zimahl 13y agoBack in college when I was interviewing for jobs sometimes interviewers would first ask you to write any executing Java class because some interviewees said they 'knew' Java and couldn't do even that simple task. A couple years later when Eclipse came out I told a coworker this anecdote and he joked that it was 'main' + ctrl-spacebar followed by 'sysout' + ctrl-spacebar. I lol'd.
- bhauer 13y agoEclipse has something similar, which it calls "code templates." Features like these leave me wondering why "excessive typing" is often cited as a criticism of Java. As far as I can estimate on the fly, I type less than half of the characters that make up my Java code. And as the article points out, for readability, verbosity is arguably a good thing. I sure believe it is, perhaps because I am more distracted by poor symbol selection and syntax than most programmers I know. Speaking of, I don't particularly like the C-lineage syntax, Java included. I don't like the braces and parentheses. I prefer a syntax with fewer symbols and more keywords. Crazy, I know.
- TimPC 13y agoExcessive typing isn't the issue. The problem with verbose code is that code gets read way more than it gets written. In Java you're often reading 15 lines of code for something that could be 2-3 in other languages.
- danieldk 13y agoAnd still, I have seen plenty of Java code which is perfectly readable and Haskell, Perl, or Ruby code (2-3 lines) that resembled line noise. And I am a Haskell fan :). The worst offender in Java are IMO anonymous inner classes. But IntelliJ shows them abbreviated. E.g. IIRC Runnables are displayed in Java 8 lambda syntax.
- anoncowherd 13y ago>> I type "cmd-J, fori, return." There's no need for Cmd-J, just write a few characters and press TAB. Try "sout"<TAB>, "psvm"<TAB>, "iter"<TAB>, "itli"<TAB>, and so on.