Komodo 3.5 for Dynamic Languages
This article was published by O'Reilly Network ONLamp.com, , as a feature article on their website.
Newly minted software developers are typically delighted to discover the power of modern programmer's editors, with syntax highlighting and coloring, auto-indenting, incremental search, etc. But the delight quickly disappears when drowning in a sea of 'print' statements needed to watch the changing values of variables. That's the fundamental reason why integrated development environments (IDEs) are a must-have tool for programmers. They make coding, debugging, project management, and other aspects of software development, so much easier and faster. This in turn allows the developer to focus his or her energy and attention on less mundane activities, with more creative energy.
There are many IDEs on the market for interpreted computer languages, such as PHP, Perl, and Ruby. I personally have tried several of them, ranging from such heavyweights as Eclipse, to little-known IDEs that lack in features but not idiosyncrasies.
This article reviews one of the most respected IDEs available, Komodo, by ActiveState. As of this writing, the current version of Komodo is 3.5.3. Komodo is available for Linux (Debian/Ubuntu 5.04+, Red Hat/Fedora 3+, and SuSE 9.0+), Mac OS X (10.4 and 10.3), Solaris (8+), and Windows (XP, 2000, NT 4.0, ME, and 98).
Within each platform category, there are two different editions of Komodo: Personal and Professional. The former is intended for personal and educational use, while the latter is intended for corporate and commercial use, and has additional features to support professional and team development, including source code control, GUI building, and package management. Furthermore, the Professional edition's licensing fees of $295 USD are an order of magnitude higher than those of the Personal edition, at $29.95 USD. ActiveState licenses allow you to use a licensed product on all supported platforms.
Komodo recognizes over 30 languages, and boasts especially powerful support for Perl, PHP (including 5.1), Python, Ruby, Tcl, and XSLT. In fact, it has fully integrated Ruby support, including debugging, code intelligence (including Code Browser support, Object Browser support, AutoComplete, and CallTips), an interactive shell, syntax checking, syntax highlighting, and code folding. In this latest version, the graphical debugger now supports Ruby on Rails.
Editor
Komodo's built-in editor offers the functionality that experienced coders have come to expect of modern programmer's editors: multi-document editing with tabs, syntax highlighting, stream and block selection, multiple undo and redo, smart-indenting and outdenting, incremental and cross-document search, code-folding (collapsing and expanding blocks), split view, keystroke repetition, recordable macros, code block commenting, as well as text joining and reflowing. Komodo's syntax capabilities are excellent, including syntax highlighting with color, and syntax checking. This instant visual feedback invariably saves time and reduces bugs. Komodo offers syntax highlighting for over 30 languages. Also, the syntax colors are fully customizable (via Edit > Preferences, not the more standard Tools > Options).
Like the better non-IDE programmer's editors, Komodo has extra features, such as code completion ("AutoComplete"), display of language and user-defined function parameter lists ("CallTips"), Emacs-like key binding, and optional removal of whitespace on line endings.
Programmers spend a lot of time searching and replacing text within code. Thus, an IDE's search-and-replace capabilities are of paramount importance. In this regard, Komodo is more than adequate, though not stellar. It allows regular expressions in text searching, including the use of found text dynamically within the replacement string. It is not documented, but uses the standard Python and Perl syntax of grouping using parentheses and replacement strings identified as $1, $2, etc.
Komodo allows searching within directory trees. The menu item is Edit > Find in Files, which I did not even notice at first, being accustomed to having it as part of a single search-and-replace dialog. One nice feature, which I have not seen elsewhere, is the ability to exclude files from being searched, with support for wildcards.
For programmers who find themselves pasting the same type of code frequently, Komodo's code snippets capability should prove quite handy. It allows you to store any piece of code for later reuse. On the other hand, large snippets should be used judiciously, as any copying and pasting should first alert the wise programmer to perhaps modularize that code in a separate function — true reuse.
Developers creating code for applications and websites intended for an international audience, will appreciate Komodo's multilingual Input Method Editor (IME) support, which allows a standard keyboard to be used for entering complex multibyte characters and symbols, such as
French, German, and Spanish, as well as Asian languages.
Graphical Debugger
If the features discussed above were all that Komodo offered, then a top-of-the-line programmer's editor, such as jEdit, would suffice. But perhaps the first capability that attracts a new developer to any IDE is the debugger, which beats endless 'print' statements, and, for Perl code, beats the text-based native Perl debugger.
Komodo's graphical debugger has all the standard debugging capabilities: breakpoints; stepping in, over, or out of a function; watched variables; display of the call stack; and display of terminal output. You can modify variables midstream, in a debugging session. You can disable a breakpoint without deleting it, which saves time when later trying to remember the optimal locations of unneeded breakpoints. One terrific feature is that complex watched variables are presented in a tree format, which is quite intuitive, and allows you to expand numbered and associative arrays, and individual parts of those which are nested.
The IDE also has some features that are more appropriate for advanced programming scenarios and special cases, such as remote debugging and multi-session debugging, or simultaneously debugging multiple applications in multiple languages — scenarios that are beyond the scope of this review.
Being originally aimed at the PHP and Perl arenas, Komodo has full CGI emulation, which allows you to control the environment seen by the CGI script running locally in a Web server on your machine. Unfortunately, by default, every Debug run causes the "Debugging Options" dialog box to appear, even if you do not want to change any of the debugging options for that run. Fortunately, this can be bypassed ad hoc in Linux and Windows by holding down the Ctrl key. It can be bypassed automatically by changing one's preferences.
Before running any CGI scripts, to get PHP CGI emulation to work, you must first disable "force-cgi-redirect" by setting cgi.force_redirect to 0 in Komodo's php.ini. Otherwise, Komodo can report the error "Security Alert! The PHP CGI cannot be accessed directly. This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive." After updating php.ini, test it by running a PHP script with "Simulate CGI Environment" (in the "Debugging Options" dialog box) checked.
Somewhat related, when I tried to run the PHP tutorial script (php_tutorial.kpf), I got the error "Please correct your interpreter selection in preferences", even though it was set correctly to the appropriate PHP executable. If you get this error, restarting Komodo should resolve it. (Think of it as a holdover from Windows' Ctrl+Alt+Del…)
Code Control
An essential part of any sizable software development project, is controlling the code, in the form of organizing it well, easily seeing its structure, and being able to store and track revisions to that code. Komodo makes it possible to do all of this without leaving the IDE, as it has built-in browsing of projects, code, and objects, as well as hooks to version control systems.
In the upper left-hand corner of the IDE, there is a "Project" tab that displays all open projects, with their constituent files. Double-clicking on any listed file opens it in the right-hand pane. Some IDEs that I have tried and abandoned make it difficult to import existing files trees as a new project within the IDE. It's as if their designers refuse to consider that programmers may have already done some coding before choosing that IDE. Komodo, on the other hand, offers a much-appreciated "Import from File System" feature that can be used to quickly make existing code efforts visible within Komodo.
The other tab in the upper left-hand corner, labeled "Code", allows browsing of the source structure within the code files. For PHP projects, it displays included and required files, global variables, and function names, as well as objects, if any. For Perl projects, it displays modules, too. These clickable lists could provide a fast way to jump around the code. Sadly, there is a lack of coordination between the Code browser and the other panes. Clicking on a different source file tab in the right-hand pane should show that code in the Code browser pane as well, but it doesn't. Even opening a new project doesn't change the Code browser's contents. That is because the Code browser in the current version is not aware of projects, and only shows files opened in the editor. Apparently that enhancement is slated for the future.
Unlike the browsing of projects and source files, the browsing of objects is accessed via the menu item Tools > Object Browser, which seems unintuitive to me. It would have been better located as a third tab in the upper left-hand corner.
The Professional edition of Komodo facilitates source code revisioning, by allowing the user to perform all conventional versioning tasks (e.g., check-in, check-out, and differences) using several popular code version control systems: CVS, Perforce, and now, with version 3.1, Subversion. Komodo can monitor the repositories and their files, so if they get changed by another user, then this is indicated. Also, it is possible to set up a remote CVS repository and interact with it securely via SSH.
Other Features
Komodo has more capabilities than can be deeply explored in a single article. But it would be remiss to not mention some of them that could be a real boon to the typical programming group. One is the built-in browser, which allows previewing of HTML, XML, and CSS files, and can thereby save considerable time and frustration from switching back and forth from one's CGI source code to a Web browser to see the results.
Regular expressions (regexes) are a powerful tool in the hands of a skilled programmer, and particularly useful when performing text processing. Perl and PHP both provide solid support for regexes, and Komodo, in like spirit, does the same. In addition to regexes in search-and-replace, as noted earlier, Komodo has a utility that allows you to try various regexes and see how (or if) they match. There are several match type modes: Match, Match All, Split, Replace, and Replace All. In addition, there are modifiers, including case insensitivity. Unfortunately, ActiveState should have named this utility the "Regex Toolkit", but instead chose "Rx Toolkit", which makes it sound like a doctor's medicine bag or a pharmacist's toolkit. To make matters worse, the application's icon is a mortar and pestle — the only instance in the product that I saw of cuteness being chosen over clarity.
Komodo features a Visual Package Manager, which is designed for Web-based management of installed Perl modules. It is only available in Komodo's Professional edition, as are the Toolbox (a team-shareable storage area for commands, macros, code snippets, etc.) and the ActiveState GUI Builder (for making Tk-based GUI dialogs). For significant application development with a team, integrated source code revisioning alone should make the Professional edition worth the extra cost; but these additional tools would be icing on the cake.
Support
Like most programming tools nowadays, Komodo offers product support in the form of online documentation in HTML and PDF formats, bug tracking, and cookbooks (code collections), in addition to an ActiveState Programmer Network (ASPN).
The online documentation for Komodo is extensive and indexed, with full text searching. F1 brings up the "Komodo User Guide", which is installed locally, accessed via a Web browser, and divided into 26 sections — ranging from a welcome page to a reference manual. If any text in the current script is highlighted, then pressing Shift + F1 searches the PHP function list for the highlighted string (if the script is PHP), or Googles the highlighted string within www.perldoc.com (if the script is Perl). Ctrl + F1 searches all of Google, regardless of the script's language.
Komodo's user guide contains tutorials on Perl, PHP, Python, Ruby, Tcl, and XSLT — bracketed by a "Feature Showcase" tutorial with 21 subsections explaining many valuables techniques, and a "Run Command Tutorial".
The user guide has a lot of information. The HTML pages use frames, with the left-hand panel used for navigation and the right-hand panel displaying contents. It starts with "Welcome to Komodo 3.5.3". Be careful, because if you use your browser's ability to go back to previous pages, and you returned to the welcome page, then the left-hand panel's links no longer work. Also, the fonts and other styling is broken, suggesting that the frame is no longer seeing its intended stylesheet.
If and when the user guide fails to guide the user to an answer, he or she should next try the ASPN mentioned above. It offers links to dozens of mailing lists and their archives, and user groups, for ActiveState, Perl, PHP, Python, Tcl, .NET Framework, open source, XML and XSLT, and Web services. It also has FAQs, tutorials, cookbooks (code recipes), and a bug tracking system (Bugzilla), as well as documentation for most of those languages, regular expressions, and ActiveState's other programming tools.
Conclusion
Overall, Komodo is a capable and impressive IDE that is well-suited for programmers hoping to harness the power of assisted editing, graphical debugging, project versioning and management, and the other tasks essential to those developing software in PHP or Perl. However, there are still some shortcomings that should be fixed in the future, to make Komodo even more attractive versus its strongest competitors, such as Eclipse.
To learn more about Komodo, as well as ActiveState's other products for developers and teams, visit their website at http://www.activestate.com/Products/Komodo/. It has links for downloading fully-functional editions of Komodo, with free 21-day trial periods. There is also information on upgrade pricing, screenshots, feature lists, release notes, install notes, and other documentation.