The Mouse is a Programmer’s Enemy
One of the first programming management books I was encouraged to read was Peopleware – Productive Projects and Teams. It was a great read and I try to re-read it every once in a while.
One of the topics covered is actually a term that comes from psychology – flow. Flow carries the idea of being completely mentally immersed in a task.
There are a lot of things that can break us out of flow or prevent us from ever entering that sate that are out of our control. But I want to focus on something that is completely within our control and that could be interrupting our flow hundreds of times per day.
The Mouse
Reaching for the mouse (trackpad, touchpad, etc.) is a very natural instinct for many of us. But removing one of our hands from the keyboard actually can disrupt our thinking and hamper productivity – albeit not to the extent of many of the other distractions we contend with. Modern IDEs are so feature rich, that if you are deeply involved in a development task, know your requirements and have a well-thought out design that meets those requirements, you can perform much of the development without having your fingers leave your keyboard and maintain your blissful state of flow.
Keyboard Shortcuts
Most of us would agree that using the mouse to perform frequent operations like copy/cut/paste/save/undo/redo is unnecessary. But we can go much further in our effort to keep our minds focused and increase our productivity.
I won’t bother outlining what the shortcuts are since every IDE has its own set of built-in keyboard shortcuts, most allow for customization of these and some languages may have some shortcut concepts that don’t apply elsewhere. What I will do is outline some of the shortcuts that you should know for your IDE and, in brief, how they will benefit you.
I work in Java most often day-to-day, so some of these may apply more strictly to Java developers.
Refactor – rename / move
Don’hesitate to rename variables, files or move them if it’s in your best interest to do so.
Generate
Generate entire code files, variables, implementation shells.
Open resource
Get to that code or resource file by name.
Open selection
Open the item your cursor is on.
Find references
Find all code uses of the item your cursor is on.
Show hierarchy
Display class hierarchy of selected item.
Indent / Outdent
Keep that code looking beautiful.
Comment / Toggle Comment
Quickly and easily handle code blocks to comments.
Cleanup / Format
More code beautification. Can even be used to resolve code problems.
Add Import
Java import of a specific class.
Run/Debug
Quickly relaunch last launched or the code that’s open in your editor.
Set/Toggle Breakpoint – Step Into / Step Out / Step Over / Run to Line / Resume
Debugger shortcuts.
Quick Fix / Quick Assist / Suggest
Super powerful! Code problem? Your IDE might know how to fix it! Also, save on pointless typing with assist/suggest features.
Duplicate lines
Need to perform another similar operation to an existing block of code? Line duplication without copy/paste!
Templates
Repetitive typing tasks simplified.
In Conclusion
These are just some of my favourites. There are dozens, even hundreds more available. Interested in more information?
Have a favourite that I haven’t listed? Leave a comment and let us know!
Reference: | The Mouse is a Programmer’s Enemy from our JCG partner Craig Flichel at the Carfey Software Blog blog. |
This is so true!
I really hope my colleagues catch this too… :)
Hi,
nice post.
May be you can reference to NetBeans KeyBoard shortcuts page (http://wiki.netbeans.org/Keyboard_Shortcuts).
Pretty much all of these keyboard shortcuts apply to C# and VB .NET programming in Visual Studio as well. You’re right about reaching for the mouse breaking the flow–it’s a change in brain activity from the fingers to the arm and from textual to visual dynamic positioning. It uses a whole other side of the brain. One annoyance is when certain keyboard shortcuts change, in Visual Studio between versions or even depending on what type of file you’re editing. Formatting is an example. Nevertheless, there are many ways to avoid the mouse and even avoid extra typing. For example, being… Read more »