Hi, I'm Jacob. I'm a computer programmer and the owner of TwoDesk Software Company.
In this blog, I write about the Delphi programming language and provide tips, tricks, and training for Castalia, a tool that I've written for other programmers using the Delphi programming language.
Castalia 2012.1 is now available, which means Delphi just got better!
This is a very exciting release. First, it includes the beta of my brand new scripting engine for Delphi. There will be a lot more blogging about this scripting engine coming up, but you early-adopter types will want to just jump in and see what you can do.
The scripting engine runs right in the Delphi IDE, and lets you write code to manipulate the contents of your Delphi editor.
It’s just a beta, and there are big plans for the future – this scripting engine is going to revolutionize the way you customize your IDE!
Castalia 2012.1 also includes several bug fixes:
Fixed: Delphi XE2 split editor doesn’t load color settings correctly
Fixed: Split editor in Delphi 2009 and later doesn’t copy text to the clipboard correctly
Fixed: Access Violation in the precompiler if certain registry values are blank or don’t exist
Fixed: “Raise” keyword not treated properly by the internal code formatter
Fixed: Parser doesn’t allow “Object” types to have class methods or properties (Thanks to “Thaddy,” for this fix contributed to the open source Castalia Delphi Parser).
Fixed: Navigation toolbar doesn’t recognize project namespace prefixes when opening external units
Fixed: Syntax error with a class helper for a class identified with a fully qualified name
(Note: The scripting engine beta is available to current Castalia Suite subscribers, and is not included in the “Essentials” edition or the free trial).
When you chose to use Delphi, you picked a great language with an absolutely perfect, flawless, IDE that couldn’t possibly be improved.
Right?
Wait, what’s that you’re saying?
It’s NOT perfect? It CAN be improved?
Ok, I admit, that was a lousy attention-getter to open with, but the fact is, I love Delphi, but I think the IDE can be improved to save you time and effort, and I’ve set out to improve it with Castalia for Delphi.
For example, Castalia adds some awesome advanced syntax highlighting that helps you understand code faster, whether it’s your own code, someone else’s code, or even your own code that you wrote a while ago and now it looks like someone else’s (we’ve all been there).
There’s also some great code navigation tools that let you find your way around that code super fast, without having to hunt for things.
<BillyMays>Plus, there’s more!</BillyMays>
In this video, I show a few ways that Castalia improves the Delphi code editor to save you time. It barely scratches the surface of what Castalia can do, but if you’re writing Delphi code, you WILL be able to do it faster after you watch this 8-and-a-half minute video:
I know you’re a good programmer, and you NEVER copy-and-paste code.
Right? RIGHT?
But sometimes, for whatever reason, you do need to select a chunk of code in the code editor.
How do you do this? Are you a drag-the-mouse-around-and-hope-to-get-it-right kind of programmer? Or are you a hold-down-the-shift-key-and-use-the-arrow-keys kind of programmer?
Whichever you are, forget it, because you’re about to learn a much better way:
Castalia has a feature called “Selection Expansion” that lets you select a chunk of code just by pressing a shortcut key (Ctrl+W by default).
When you press Ctrl+W, Castalia automatically selects the identifier under the cursor. Pressing Ctrl+W repeatedly will continue to expand the selection by logical groups, selecting the current expression, statement, block, etc… until you get the selection you wanted (or the whole method has been selected).
Consider this example (keep reading, there’s a movie at the bottom!):
Pressing Ctrl+W repeatedly selects:
Left
FirstInd.Left
FirstInd.Left+FDragOfs-GutterWid
The entire Trunc() call
The entire Editor.Paragraph.FirstIndent assignment
All of the code in the method
The entire method
Here’s a movie of Castalia’s Selection Expansion in action in the Delphi IDE
Selection Expansion is just one of the many ways Castalia saves Delphi programmers time and effort. Learn more (and try it out) at http://www.twodesk.com/castalia.
A little while ago, I asked a random sample of Castalia users to complete a survey. The primary purpose of this survey was to get feedback on how I can make Castalia better, and I tried to ask questions that would both tell me what I’m doing right as well as where I can improve.
One of the questions was “What is the primary benefit that you have received from using Castalia?”
90% of the respondents answered the question, and OVERWHELMINGLY, the responses used words like “productive” and “productivity.”
The thing is, “productivity” is one of those sort of late-90′s business management buzzwords that has come to mean so many things that it’s just about meaningless. So here’s my question for you: What does “productivity” mean to a Delphi developer?
I’ll start: I think that a productive programmer does three major things:
Writes better code faster
Understands code (whether his own or someone else’s) better, and faster
Improves old code accurately (and faster)
As a programmer, what does “productivity” mean to you?
I’ve been working on something new for Castalia. It’s nowhere near ready for general release, but here’s a sneak preview: http://screencast.com/t/FXaoj2AcO
In case it’s not obvious what’s going on, here’s a hint: Reversing a selection is *NOT* what’s being previewed here.
Castalia 2011.4.1 is now available. This is a bugfix release that fixes the following issues:
Fixed: Rename Method doesn’t work correctly with some nested method calls.
Fixed: Rename Method doesn’t work in some “with” statements
Fixed: Assertion failure in “Eliminate With” refactoring under some circumstances
Castalia users with a current maintenance subscription can download the update at the customer portal. Everyone else can try Castalia for free at twodesk.com/castalia.
Recently, a Castalia user asked me for a demo of how to use the Code Templates that Castalia adds to the Delphi editor. I took his suggestion and created a video:
The video is about 9 minutes long, and walks you through several of Castalia’s built-in templates:
if..then
if..then with a begin..end block
if..then..else
if..then..else with begin..end blocks
try..except
try..finally with local object creation
for loops
fori and forj, which automatically declare the looping variable if it hasn’t already been declared
Then, you’ll see the code template editor (and many more of Castalia’s included templates) and the template options dialog, where you can configure Castalia’s code templates to best work for you…
The Castalia Delphi Parser, a high-speed, open-source parser for the Delphi language, has been moved from its former home at Google Code to Github. You can find it at github.com/jacobthurman/Castalia-Delphi-Parser.
The Castalia Delphi Parser isn’t very well known, but it is very useful if you need to write code that understands Delphi code. Here are a couple of projects that have made good use of the parser:
Obviously, Castalia - My set of Delphi IDE plugins that make Delphi even better
Anders Ohlsson’s Unicode Statistics Tool - A utility that collects statistics on how hard it would be migrate your older applications to Unicode.
The Castalia Delphi Parser is the exact same parser that’s used to make the magic of Castalia happen. From high-speed code templates and IDE scripting to smart refactoring and syntax highlighting, Castalia takes the greatness of Delphi and makes it even better.