giovedì 3 aprile 2014

Tips and Tricks for improving your work time

There are a lot of tricks and shortcuts that can help you be faster while programming. Most of the time we became tired of doing simple tasks by switching between keyboard and mouse. There are a lot of shortcuts that windows uses, most of them I've learned by friends when I was little, they where common during the time of windows 95/98, but now I don't see so many people using them.
I think it's important to relay on shortcuts and by time starting using them can really improve your work time!

Windows Keyboard Shortcuts 
Win+d Minimize all windows on all Monitors. Press again to restore previous state
Win+m Minimize all windows on current Monitor
Win+Shift+m Restore previously minimized windows on current Monitor
Win+Home Set all windows to Minimized on current Monitor except active
Win+Space Preview Desktop / make windows transparent (May not work with all Settings)
Cycles through open programs in taskbar. Hold alt and continuously press tab to move forward between applications. Release keys to switch to application selected. Add shift to reverse direction.
Alt+Ctrl+tab, then use arrow keys to select application Cycles through open programs in taskbar without needing to hold alt continuously. Pressalt+ctrl+tab once, then continue with arrow keys and press enter on application.
Win+e Start Windows Explorer (in My Computer)
Win+r Open the Run window
Win+f Open Windows Search. f3 on empty desktop works, too.

A lot more windows keyboard shortcuts can be found here
Eclipse Keyboard Shortcuts 
Since I usually use eclipse as my default editor, I would like to list here more useful shortcuts that I usually like to use while programming.
Ctrl+Space Call the auto-complete tool, It's awesome. Just write the first letter of an object/method/anything and then press it.
Crtl+F11 Run the last launched class
Ctrl+1 Quick Fix
Ctrl+Shift+F Format the source code
Ctrl+Shift+O Imports missing classes
Shift+F2 Shows javadoc for selected class/ type or method
Ctrl+3 Quick access to any eclipse command
For a more complete list take a look here.

Eclipse Programming Tips 
Still I've a lot to learn about organizing my projects, but I assure you, following these simple tips can save you some time in the future.
  • Always make a local /lib directory in the project to store imports, this way you won't lose reference in the future.
  • Invest in creating static main() methods for the classes you want to test frequently. (Just configure different Runs in Run Configuration).
  • When searching for libraries online just takes too much, take a look to mavent 2 eclipse.
  • Always comment your code, because you will forget everything you have done sooner or later. In eclipse write /* on top of a class definition and then press ctrl+space to autocomplete the class description and specification. This text will appear in eclipse windows when importing/using the class.
  • Add stackoverflow to your browser preferences

For last, a lot of people seems to not know the utility of the End and Home key while writing, with these keys you can easily move at the end and begin of the current line.

That's what I daily use, if you can give me some other tips feel free to write a comment.