Code writing contains some mechanical activities which are best automated by your editor. Here are some features any decent code editor should provide, to make your code writing more pleasurable. If you didn't know that these features existed, you should revisit your editor's manual now!
Block commenting and uncommenting of code
You've written some code, and you want to try out some other approach. You don't think this is worth a version control system, so you comment out code, and write new code. You probably do this frequently.
So it makes sense for your editor to support automatic code commenting and uncommenting features. You select a piece of code, press a few keystrokes, and the code selection is commented out. Beats inserting comment characters, especially when certain languages don't have a single-character comment delimiter.
Indenting and Re-indenting
Indenting improves code readability. I do not find reading badly indented code a pleasure. Perhaps the editor they used to write the code didn't support code indentation. Indentation affect newly written code, or old already written code. A good editor supports both.
When new code is being entered, the editor keeps track of the current indenting level, and then automatically indents the next line of code for you. Most editors do this.
Then re-indenting old code, some editors provide manual block indent and un-indent block features. You select a block, and then you can indent the block in or out, but manually. This is better than nothing.
The really good editors will allow you to select a region of code, and re-indent that region as per surrounding code.
Syntax Highlighting
After indenting, the next best feature that improves readability is syntax highlighting. Unlike most other features, this is something that you don't invoke, but something that always works in the background.
"Locate Symbol" Feature
Most editors have a Find feature, but a "locate" feature isbetter. You position the cursor underneath a symbol (function name,constant, etc.) and invoke locate. You'll find yourself at the definition of that symbol, regardless of whether it's in the current file or somewhere else.
Autocomplete Features
Autocompletion of variable names, function names, and other symbols. Very very productivity enhancing when done right. Unfortunately it's not easy to do this for some languages, and hence not many editors support it.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment