Datasheet

Book VIII
Chapter 1
Programming
Dynamically!
771
Shifting C# Toward Dynamic Typing
Python
Cobra (my new favorite)
Groovy
Boo
Newspeak
Programmers who work in dynamic languages — how can I put this gently —
feel strongly about their choice of tools. The communities are very strong.
Developers who work in dynamic languages use them for practically every-
thing except highly structured team-build kinds of environments, like:
Scripting infrastructure for system maintenance
Building tests
One-use utilities
Server farm maintenance
Scripting other applications
Building Web sites
File maintenance
Dynamic languages are popular for these kinds of tasks for two reasons.
First, they provide instant feedback, because you can try a piece of code
outside the constraints of the rest of the program you are writing. Second,
you can start building your higher-level pieces of code without building the
plumbing that makes it work.
For instance, Ruby has a command line interface that you can simply paste
a function into, even out of context, and see how it works. There is even a
Web version at http://tryruby.hobix.com/. You can type code right in
there, even if there are classes referenced that aren’t defined, because Ruby
will just take a guess at it.
This moves nicely into the next point, that a dynamic language enables you
to build a class that refers to a type that you haven’t defined elsewhere. For
example, you can make a class to schedule an event, without actually having
to build the underlying Event type first.
All of this lends itself to a language that is a lot more responsive to change.
You can make a logic change in one place and not have to dig through reams
of code to fix all the type declarations everywhere. Add this to optional and
named parameters (see Chapter 2) and you have a lot less typing to do when
you have to change your program.
53_563489-bk08ch01.indd 77153_563489-bk08ch01.indd 771 3/19/10 8:17 PM3/19/10 8:17 PM