|
Softpanorama |
May the source be with you, but remember the KISS principle ;-)
Softpanorama Search
|
The best editors are often those written by programmers who use them themselves and know exactly what they want out of an editor. Slickedit website contains several manuals in PDF:
There are several Flash animated walkthroughs with commentary. Watching them is a great way to learn the editor.
A major feature is the integration with the compilers. In a way this editor is biased toward C++ and Java, althouth it supports Python more or less well. If you use Visual C++ then SlickEdit can act as a simple IDE and let you see all the error lines at once after a compiler. Every line with an error has a little red X highlighting it. Move the cursor over the X and you get a list of the errors there. That's quite a time saver.
SlickEdit supports tags. You do not need to use the "Symbols" tab to search for
a tag. If there is a tag symbol at the cursor (for example, a function name), place
your cursor on the tag name and invoke the push_tag (or f) command (CTRL+PERIOD
or "Search", "Go To Definition...").
You can also use the Go To Definition dialog box to go to a specific tag. This dialog
box will list all tags which match the prefix you have typed so far. Deselect "Prefix
Match" to match tags using a regular expression or a substring search. If you prefer
to use the command line, use the f command and use the completion keys (SPACEBAR
and '?') to assist you when entering a tag name. For example, if you are tagging
the C run-time library, type "f str?" on the Visual SlickEdit command line for a
list of tag names starting with "str" (such as strcpy, strcmp, etc.).
The push_tag command sets a bookmark in the file you are currently editing so that
you can easily return to your edit position. To go back to the previous edit position,
press CTRL+COMMA.
Use the find_proc (or fp) command ("Macro", "Find Slick-C Proc...") to navigate
to a Slick-C tag symbol. If you are editing a Visual SlickEdit macro, you can invoke
the push_tag command (CTRL+PERIOD) to find the symbol at the cursor. The push_tag
command actually calls the find_proc command with the symbol name at the cursor
to perform the task. Though most compilers come with a built in IDE, third party
tools can make your life easier by providing extra needed functionality. They let
you work faster with better editing, powerful macro languages, and better compiler
integration.
A major part of SlickEdit is the Slick C Macros. Much of the built in functionality
in SlickEdit such as the Beautify command, is actually done using Slick C Macros,
complete with forms. Macros can be recorded or written and saved out as
bytecode and the degree of customization, including form design is just amazing.
It is a built in C
compiler complete with preprocessor!
This is a very powerful editor, in fact it's more powerful than some IDEs. I think novice developers could be a bit overwhelmed by the many features and the complexity of the Slick C Macro system despite the excellent and detailed help system. That apart, it is fast, powerful and almost limitless in terms of features you can add to it through the macros.
Also included is DiffZilla, a powerful diff utility that renders Windiff obsolete. It includes merge, an invaluable feature when you need to resolve differences between source code files.
Only you can calculate a true return on investment for your work patterns. However, it’s easy to show that you don’t have to save much time to quickly make up for a $300 purchase. Assume an annual salary of $60,000, which is a conservative value for the average salary paid to programmers in the USA. Assuming a normal work year of 236 days and a normal work day of 8 hours, you have to save 1.6 minutes per day [i] to pay for SlickEdit in the first year of purchase. Here are some of the ways SlickEdit can help you save 1.6 minutes per day:
- It takes 30 seconds for Eclipse™ or Microsoft® Visual Studio® to open on my machine. The same project in SlickEdit opens in a second or two. So SlickEdit can save you that much time if you open your environment at least 3 times per day.
- Our tagging engine allows you to instantly jump from a symbol to its definition with a single keystroke (Ctrl+Dot). In most editors, you have to either know the file and where it is stored or search for it. Then you have to scroll down or search for the function name. This process can easily take 30 seconds to a minute. So a couple of quick navigations per day will pay for SlickEdit. By the way, we also have a Symbol View that will preview the definition of the current symbol without having to open the file!
- We have many features that cut down on the number of characters you have to type, like Syntax Expansion, which automatically completes block statements like if and for. Surround With quickly wraps the selected lines in a block statement. In a normal coding session, these will easily save you a couple minutes.
- Code Templates automate the process of creating new classes or patterns. Powerful substitutions are run when a template is instantiated, easily saving you a minute or two on a simple class and several minutes on multi-file templates.
- DIFFzilla®, our dynamic differencing tool allows you to compare files and edit them in the diff view, providing many of the same editing capabilities in our editor window. This saves wasted time re-running a diff after making changes.
Posted by Dennis B under
Code Editors
[7] Comments
* Color coding
* Syntax expansion
* Code navigation features
* List-members and function parameter information
* Comment and function documentation extraction
* Syntax-driven auto-indentation
* Macro recording and playback
* Code snippets and other shortcuts
* Integrated project build support
* Multiple file and window support
Color Coding
Color coding is a language specific feature which allows the editor
to display comments, keywords, strings, numbers, and other lexical elements
using specific foreground and background colors as well as potentially using
bold or italic fonts.
Argument
“I don’t need my editor to look like Walt Disney lost his lunch.” — How do you
find your car in a parking lot? Do you look at every car until you find your
1998 Camry with velvet blue interior, or do you look for a red sedan with a
“My border collie is smarter than your honor student” bumper sticker. Color
stands out; it helps you find things. You have a color monitor, why waste the
potential?
Benefits
Color coding helps you distinguish comments from code. If that were all
it did, that would be a great win, but it can do so much more. Color coding
also helps you see immediately when you have mistyped a keyword, or if you have
accidentally used a keyword as an identifier, or failed to terminate a string.
This saves you many compile and edit cycles and lets you focus on what’s important.
Investment
There is very little investment to this feature; if anything, you may find
yourself un-training your eyes because you do not have to read as much syntax
to see comments vs. strings vs. code.
Syntax Expansion
This feature completes statements for you so you only have to type the leading
keyword such as “if” or “while” and the editor will insert the rest of the code
for that statement in accordance with your brace style and indentation preferences.
Argument
“I’ve been coding for years; I type these statements without even thinking.”
— This is true for many seasoned programmers, but the real question is why?
Benefits
For novice programmers, syntax expansion can save them time trying to remember
how a particular statement is written. This is especially true for statement
heavy languages such as COBOL. For all programmers, syntax expansion helps enforce
coding consistency; it will always use your brace style and your indention preferences.
Investment
In fact, the investment to start using syntax expansion is just a matter
of un-training your fingers to type the whole statement. Very quickly, you will
get used to just typing “while” and then being ready to put in the loop condition.
Syntax driven auto-indentation
Auto-indentation will position your cursor at the expected indentation
level when you split or open a new line so that you can start typing code immediately.
A good implementation of auto-indentation will respect your tab preferences
and either insert real tabs, spaces, or position the cursor on a virtual column
without inserting unnecessary space. A very good implementation will handle
more than just simple block scopes: it will also handle continuation indents,
parameter lists, initialization lists, and splitting comments.
Argument
“I am very particular about indentation; I don’t trust the editor to do
it for me.” — This is the sort of feature that must be configured to match your
preferences. Once you configure it correctly, the editor will do the right thing
more than 90% of the time. If it doesn’t, you are probably using the wrong editor,
or in the worst case, can turn the feature off.
Benefits
Auto-indentation will save you time for every line of code you write. Furthermore,
it will improve the consistency of your code.
Investment
This feature requires no time to learn, but you may have to un-train your fingers
to not lean on the space key every time after you hit enter.
Code navigation
A good implementation of code navigation turns your code into a hypertext.
For any symbol in your code, you can jump to it’s declaration or definition
in one keystroke. You can jump back to where you were in another keystroke.
Argument
“I don’t need this; I’ve memorized where everything is.” — That’s very
impressive; let me know how that works out when you inherit a half-million lines
of code you have never seen before.
Benefits
A really good code navigation system makes file boundaries irrelevant, which
make it possible for you to focus on the code, not what files the code is stored
in. A good implementation does not just use the symbol’s name, but finds the
symbol’s declaration or definition using the same language specific scoping
rules that your compiler uses. A better implementation can also find all references
to a symbol. An awesome implementation recognizes that when you navigate to
a symbol and then pop back, it can close the file in order not to pollute your
working set of open files.
Investment
In terms of keyboard shortcuts, you need to learn three things: (a) the key
to jump to the symbol under the cursor, (b) the key to see all references to
the symbol under the cursor, and (c) the key to jump back. If you have not been
using code navigation, you are probably finding symbols by manually opening
files and poking around, or using grep or another multi-file search to find
symbols. In terms of work habits, you may have to train yourself that there
is an easier way to do things and use it.
List members and function parameter information
List members (referred to as Intellisense™ by Microsoft) will display
a list of class members in the class when you type a member access operator
such as “.” or “->” in C++. You can then pick one of the items from the list
and the editor will insert it, or you can continue typing the name of the symbol
and the list will be filtered down to include only symbols that match what you
have typed.
Function parameter information is typically activated when you type the open parenthesis for a function call and will display the prototype for the function being called and highlight the current argument.
Argument
“Those things will just get in my way.” — A well designed implementation
of list members and function parameter information will not get in your way.
List members is typically displayed below the current line, left aligned to
the cursor position. Function parameter information is typically displayed below
the current line, aligned with the function name. The windows typically have
minimal borders and are shrunk down to the minimal size to display the required
information. A good implementation works hard to stay out of your way when coding.
Benefits
If you do not have list members, you will need to be very good at remembering
the names of the members of the classes and structures that you use. Suppose
you need to convert a STL string to a character pointer. You may remember that
it is done using the “c_str()” method. You may have an STL reference manual
on your desk and can spend five minutes looking it up. If you have list members,
you type “.” and then scan through the list and see that “c_str()” returns “const
char*” and remember that is the conversion function.
Likewise, function parameter information brings vital information to you when you need it. Suppose you need to call the standard C library function strncpy(), but you can not remember the order of the arguments. You could look it up in your C book, check MSDN or the man page. That’s fine if you have five minutes to burn. If you have parameter information, the prototype is displayed for you: “char* strncpy(char *, const char *, size_t)”, and you can see immediately that the first argument is the destination (by virtue of being char*), and the second argument is the source string, and the third argument is the max number of chars to copy.
Investment
Typically, these features are invoked automatically when you type open
parenthesis or member access operators. You will also want to learn two keyboard
shortcuts: one to bring up list members manually and one to bring up function
help manually. This will be extremely valuable to you when you are editing established
code.
Comment and documentation extraction
Comment and documentation extraction pulls documentation comments from
your source code and displays them in conjunction with list members and function
parameter information. Really good implementations of this feature will format
JavaDoc and XMLdoc comments for you, and highlight function parameter documentation
when displaying function parameter information.
Argument
“What will I do with all these Java reference manuals?” — Build a giant pyramid
in your cubical and declare yourself a Java deity.
Benefits
If your editor does not have this feature then when you need to see the
documentation for a function, you either need to look it up in a reference manual,
or jump to that function, read it, remember it, and then jump back to where
you were working. Having this feature is like having a really good research
assistant who brings exactly what you need directly to you exactly when you
need it.
Another nice side-effect of having this feature is that it genuinely encourages you and your whole team to write better documentation comments in your code because you will be seeing them and using them on a regular basis.
Investment
This feature is typically completely automated.
Macro recording and playback
This facility allows you to record a sequence of keystrokes and/or
editor commands and then play them back later.
Argument
“You’re hurting my head!” — No, your head will be fine, and your fingers will
also appreciate the break once you master this feature.
Benefits
Sometimes you need to make a bunch of very similar changes to code. Macro
recording allows you to do it once and repeat the macro instead of tediously
doing the same thing over and over again. More powerful editors allow you not
only to record macros, but to name them and save them for later. Some even more
powerful editors allows you to record not just one, but a suite of macros that
you can repeat with a single keystroke.
Investment
There are, at a minimum, two keyboard shortcuts you need to learn: one to toggle
macro recording on and off, and one to repeat the last recorded macro.
Code snippets and other shortcuts
This feature allows you to define chunks of text that can be expanded
using a keyboard shortcut.
Argument
“I just copy and paste when I need to create idiomatic code.” — The problem
with this technique is that, first, it is slow and tedious. Second, it requires
you to remember where you can find an example to copy. Third, when you copy
and paste chunks of code, you might be copying and pasting chunks of code with
errors in it.
Benefits
This feature helps you build a library of snippets of idiomatic code that you
can expand at the touch of a key. To add further power, most editors support
parameterized code snippets so you can plug in different variable names, constant
values, etc.
In addition, some editors also let you define global shortcuts and use them nearly anywhere in the editor, including the open file dialog. Why type “/usr/include/sys/” or fiddle around with the mouse to navigate to that directory if you could just have an alias named “sys”, expand it, and continue from there?
Investment
You need to learn how to create and customize a snippet in your editor, and
you need to learn one keyboard shortcut for expanding snippets.
Integrated project build support
This feature allows you to invoke a compile or a project build from
your editor, and correlate the compilation errors with source code.
Argument
“We have a custom build system and we can not change it.” — In most cases, you
do not have to change your build environment; you just have to be able to tell
your editor to use your existing build command to build the project.
Benefits
The first benefit is that you will not have to leave your editor to start a
build. You can associate the project build with a keyboard shortcut, such as
Control-M (for make). You no longer have to remember the build commands for
different, disparate projects. Last, and definitely not least, you can navigate
directly to the compilation errors with a single keystroke instead of manually
locating the offending file, opening it, jumping to the line number, and then
repeating that process for every error.
Investment
You will need to learn the project system of your new editor; how to create
a project, how to specify your build command. You will also need to learn the
keyboard shortcut for navigating to the next build error.
Multiple file and window support
This is really two facilities. One is the ability to open more than
one file at a time in your editor and rapidly switch between them. The other
is to be able to open multiple windows so that you can look at different files
or different parts of the same file at the same time.
In particular, I address this issue for the programmers out there who are still using text mode vi on Unix or notepad on Windows. Noting those exceptions, almost all other modern editors have these capabilities to varying extents. Some support multiple files and windows, but force you to use the mouse to switch buffers or switch windows. Some editors have a tabbed view for quickly seeing what files you have open and modified. Some editors have support for buffer management, so if you navigate to a file and then pop back (see Code navigation, above) the file is automatically closed, keeping your working set of files small and tidy.
Argument
“Too much clutter” — Some people like to keep things simple, so viewing just
one file at a time is great for them, they don’t need side-by-side windows all
the time. But, for those times when you absolutely need it, this is a feature
that is well worth having available.
Benefits
Modern projects are large and encompass many source files, sometimes tens of
thousands. You can seldom get a complete understanding of a system looking at
just one file at a time. Being able to switch between files with a single keyboard
shortcut is more efficient than starting a new editor to view another file.
If you have unsaved changes to a file and need to look at another file, what
do you do if your editor does not support multiple files?
Investment
You need to learn a few keyboard shortcuts: (a) to open a file; (b) to cycle
through your open files; (c) to split windows horizontally and vertically; (d)
to cycle through your open windows; and (e) minimizing and maximizing windows.
The first two will get you up and running so that you can maintain a working
set of open files. The last three will help you move to the next level.
Conclusion
It’s natural to resist change. Learning a new editor requires an investment
of time and a change of work habits. You will seldom regain your investment
in the timeframe of your first project with a new editor. But the time
you will save in the long run will quickly eclipse the small amount
of time you invest. Perhaps you feel that you are extremely proficient with
your current editor, maybe even working at power programmer level. This may
trick you into thinking that you are already working at peak productivity and
will not benefit from a better programmer’s editor. The truth is exactly the
opposite, you will benefit even more. Your tools are your foundation. Think
of this analogy. No matter how proficient you are at riding a bicycle; you can
go further faster on a motorcycle.
The features outlined in this article are things that I have grown to view as essential for writing code proficiently. It can be hard to appreciate exactly how much they help you until you seriously set down to work with these tools in your hands. After which, I can assure you that you will ask yourself how you ever managed to work without them.
Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
Disclaimer:
Last modified: August 12, 2009