UNVEILING THE ORIGINS, MYTHS, USE AND BENEFITS OF DYNAMIC LANGUAGES - A CLOSER LOOK AT PERL, PYTHON, TCL, PHP, JAVASCRIPT AND OTHERS - ActiveState

Page created by Clarence Barber
 
CONTINUE READING
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES
A CLOSER LOOK AT PERL, PYTHON, TCL, PHP, JAVASCRIPT AND OTHERS
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

ABSTRACT                                                      bound systems, have propelled dynamic languages
                                                              into a new, critical role. In addition to their traditional
Dynamic languages are high-level, dynamically typed
                                                              role in support of scripting tasks, these programming
open source languages. These languages, designed to
                                                              languages have demonstrated an unequaled ability to
solve the problems that programmers of all abilities face
                                                              build a diverse set of important software systems.
in building and integrating heterogeneous systems, have
proven themselves both despite and thanks to their            We believe this shift in importance warrants replacing the
independence from corporate platform strategies, relying      term “scripting language” with one that better describes
instead on grassroots development and support. Ideally        the languages’ nature and impact, and suggest the
suited to building loosely coupled systems that adapt         use of the term dynamic languages. The choice of the
to changing requirements, they form the foundation of         word “dynamic” over “scripting” is a pragmatic one—the
myriad programming projects, from the birth of the web        original term has tended to minimize the broad range
to tomorrow’s challenges.                                     of applicability of the languages in question. The new
                                                              term reflects the belief that the real-world value of these
INTRODUCTION                                                  languages derives more from their dynamics (technical
                                                              and social) than their approachability.
There is a category of programming languages which
share the properties of being high-level, dynamically         In what follows, we present the essential characteristics
typed and open source. These languages have been              of dynamic languages as they contrast with other lan-
referred to in the past by some as “scripting languages”  1
                                                              guage categories. Popular dynamic languages are briefly
and by others as “general-purpose programming lan-            surveyed, followed by an analysis of their emergent
guages”. Neither moniker accurately represents the true       properties in current technical, social, economic, and
strengths of these languages. We propose the term             legal contexts. We suggest software environments where
dynamic languages as a compact term which evokes both         they are most and least appropriate. After discussing
the technical strengths of the languages and the social       some popular beliefs about these languages, we explore
strengths of their communities of contributors and users.     the future of these languages, touching both on key
                                                              upcoming challenges, as well as opportunities for growth.
While many of the arguments presented in John
Ousterhout’s landmark paper on scripting are as valid
                                                              LANGUAGE CATEGORIES
as when they were written, changes in the informa-
tion technology landscape and maturation of thinking          Among the hundreds of programming languages avail-
about open source lead us to reexamine his argu-              able, a relatively small number are widely used. These
ment. This paper will argue that many of the pressures        can be grouped into a few broad categories. The catego-
on software systems, such as the push for standards-          rization used in this paper is deliberately not based on
compliant open systems and the competitive advan-             strictly technical features of the languages, but instead
tages granted to customizable systems , combined
                                         2
                                                              on a combination of technical, social, business, and use-
with a shift from CPU-bound systems to network-               in-practice features.

                                                                                                                          11
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

Legacy Languages                                               Dynamic Languages
Legacy languages, such as Cobol, Fortran, and PL/I, are        Described in detail in the next section, dynamic lan-
important because no matter how much one would like            guages are defined as high-level, dynamically typed, and
to at times, the past can’t be wished away, especially in      open source, developed by a grassroots community
corporate IT systems. Few IT strategies can effectively        rather than a corporation or consortium.
accept a “closed world” hypothesis; hence, it is important
when considering a new language to evaluate its ability to     MODERATION IN ALL THINGS
be bridged to preexisting systems.
                                                               Before we discuss the strengths and weaknesses of
System Languages                                               dynamic languages, a note about the extent of the claims
System languages include C, C++, and, more recently,           being made. The topic of programming language choice
Java and C#. These languages are characterized by              often leads to heated arguments where categorical posi-
strong typing (as explained in Ousterhout (1998)), the         tions are stated, often in the face of clear evidence that
ability to build tightly-coupled efficient systems, and,       more moderate approaches may be more rational. A pri-
especially for Java and C#, a tight binding between            mary argument in this paper is that dynamic languages
the language and the underlying platforms (the Java            play an extremely effective and crucial role as part of
Runtime Environment and .NET Common Language                   an overall pragmatic programming language strategy.
Runtime respectively). One consequence of the tight            Some situations may be best served by a single-language
integration between the language and the platform              approach, whether dynamic or not; however, many situ-
is that situations which require breaking the “closed          ations are best addressed with a combination of system,
world” assumption can be problematic.                          proprietary and dynamic languages, with connections to
                                                               legacy systems. There is no silver bullet in the world of
Proprietary Languages
                                                               programming languages.
We use the term “proprietary languages” to refer to
languages which share many technical features with
                                                               WHAT IS A DYNAMIC LANGUAGE?
dynamic languages, but which are owned, controlled,
and evolved by corporations. The prototypical example          For the purposes of this paper, the term dynamic
is Visual Basic, which is high-level and adaptable for both    languages refers to high-level, grassroots, open source
scripting tasks and building applications, but whose evo-      programming languages with dynamic typing, including
lution is driven directly by Microsoft’s platform plans. For   but not limited to Perl, PHP, Python, Tcl, and Ruby. We will
example, the evolution of Visual Basic from version 6 to       first cover each of the three definitional criteria (high-
Visual Basic .NET caused considerable frustration among        level, grassroots open source, and dynamic typing). We
its users, but makes sense from the Microsoft point            will then briefly introduce each of the currently popular
of view because Microsoft believes that all of its users       languages. By focusing on the most popular languages,
should move to using the .NET framework, something             we’ll be able to identify: 1) properties which emerge from
that required deep changes in VB6.                             combinations of the properties of the language and the

                                                                                                                            12
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

network effect exhibited by all successful open source         of volunteer developers; and the sociological usage
projects; and 2) the particular challenges of building con-    refers to the communities which form around specific
temporary software systems, taking Dynamic Languages           software projects, characterized by close relationships
into account market, technical, and legal issues.              between users and developers.

Criterion 1: High-level                                        Given the recent adoption of various open source
The ever-increasing diversity of software systems has          licenses by traditionally proprietary software behemoths,
pushed programming language evolution along several            it’s worth noting that all of the successful dynamic
dimensions which are generally referred to by a catch-all      languages to date are “old fashioned” open source,
term: “high-level” . This evolution is evident in: 1) a bias
                  3
                                                               meaning that an individual released an early version of
toward more abstract built-in data types, from associative     the language to “the net”, attracted a following of users
arrays to URIs; 2) particular syntactic choices empha-         and contributors, and built a community of peers. While
sizing readability, concision and other “soft” aspects of      the licensing aspects of an open source project make no
language design; 3) specific approaches to typing of vari-     distinction between individual and corporate creators,
ables, variously referred to as loosely typed,” “dynamically   the nature of the original creator (biological or corporate)
typed,” or “weakly typed,” in clear opposition to “static      has massive impact on the language’s adoption and
typing”; 4) automation of routine tasks such as memory         evolution , for legal as well as psychological reasons. Most
management and exception handling; and finally 5) a            likely, contributors to Perl, Python, etc. would have been
tendency to favor interactive interpreter-based systems        neither as enthusiastic to help “pitch in,” nor as quickly
over machine-code-generating compiler models.                  accepted as contributors, had the language creators
                                                               been corporations rather than individuals.
Somewhat tied to each of these trends is the notion that,
as computers become faster and humans have more                On the other hand, it’s also clear that corporations have
to do in the same amount of time, newer programming            learned how to run successful open-source projects. The
languages should fit with human constraints rather than        Eclipse IDE framework, originated at IBM, has been quite
with computational ones. Thus, high-level languages aim        successful at gathering input from organizations, particu-
to require less from the human programmer, and more            larly educational institutions.
from the computer. This leads, generally, to languages
                                                               While each of the successful dynamic languages have
that are easier to use and slower to execute (naturally,
                                                               chosen different specific licenses, it is far from accidental
there are exceptions to this generalization).
                                                               that none selected the more extreme GPL license used
Criterion 2: Grassroots Open Source                            by the Linux kernel. All of the successful language com-
The term “open source” is used in at least three               munities have deliberately picked licenses that fit equally
ways: The legal usage refers to open source software           well with corporate requirements for non-viral licenses
licenses which encourage code sharing; the method-             and the Free Software Foundation’s goals (although
ological usage refers to a development model char-             clearly not the tactics, given the license differences). In
acterized by loose networks of self-organizing pools           general, the language communities view themselves as

                                                                                                                             13
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

on the “liberal” side of the open source debate (inasmuch     Hundreds of programming languages exist, with dozens
as any large group can be described as having a con-          of new ones developed every year. Our focus is on the
sistent opinion), and aren’t compelled to pick sides on       impact, successes, and future of programming languages
the morality of proprietary licenses. This approach has       from a pragmatic, marketreflecting point of view, rather
served them well, with significant successes both within      than a more academic “state of the art” perspective.
the Linux and Windows communities.                            Therefore, we look at languages that have achieved a
                                                              certain degree of popular success, rather than languages
Criterion 3: Dynamically Typed
                                                              that, although technically significant, have had less influ-
The strongest technical difference between dynamic
                                                              ence on the market.
languages and most of their competitors is that the
typing systems (in layman’s terms, the mechanisms             Perl
by which programming languages refer to the kinds             Perl is often referred to as “the duct tape of the Internet.”
of objects being manipulated) are more dynamic than           It arose from the need to extend the capabilities of
static. Being dynamic is an asset if one needs to be able     Unix command-line tools into a more general-purpose
to change quickly. Thus, being dynamically typed makes        programming system. Perl’s strength at processing text
sense if the nature of objects being manipulated is           and its accessibility to a broad range of users led to its
either unknown or unpredictable. This tends to be the         massive success concurrent with the growth of
case in systems which:
                                                              the web. Its affinity for processing text files has meant
1) are not precisely specified (the problems addressed        both that it is it used in many such situations, and that
aren’t yet well understood ); 2) are evolving fast (due to    a multitude of popular tools are built in Perl. Thus, it is a
changing standards or changes of opinion); or 3) need to      language that many IT managers can safely assume their
interact with other systems which change unpredictably        staff know. In addition to being used for daily sysadmin or
(for example, third party web applications). In addition to   “glue” tasks, Perl has been successfully used in a tremen-
dynamic typing, dynamic languages often build in other        dous variety of larger systems, from enterprise-class mail
dynamic behaviors, such as loading arbitrary code at          processing to world-class websites such as Amazon.com.
runtime, runtime code evaluation, and more.
                                                              Python
                                                              Python, of the same generation as Perl, embodies a pref-
POPULAR DYNAMIC LANGUAGES
                                                              erence for clean design and clarity over concision. Akin
While the preceding three criteria are useful in under-       to a dynamic, less verbose version of Java, Python has
standing what we define as a dynamic language, what’s         found particular affinity with seasoned programmers who
important is not their intrinsic features so much as          are looking for rapid ways of building flexible systems. As
their extrinsic behaviors in the broader information          such, Python is often used in prototyping contexts such
technology ecosystem. There, it’s important to consider       as scientific computation and GUI application design,
separately those dynamic languages that have proven           as well as in high-performance systems. Two notable,
to be widely adopted.                                         recent Python-powered successes include the BitTorrent

                                                                                                                           14
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

peer-to-peer system, with over 1.5 million downloads per     JavaScript/JScript/ECMAScript
month, and the SpamBayes Bayesian anti-spam classi-          The language that is technically referred to as ECMAS-
fier, which delivers world-class results using advanced      cript, but more commonly known by the name of its
mathematics. In both cases, a key benefit of Python lies     Netscape-authored implementation, JavaScript, deserves
in its ability to “stay out of the way” of the programmers   special mention at this point. It certainly qualifies as a
implementing sophisticated algorithms.                       dynamically-typed language, is quite high-level, and has
                                                             at least two open source implementations. Exceedingly
PHP
                                                             popular, it is supported by all major web browsers, and,
PHP, unlike Perl and Python which were very broad
                                                             as a result, is part of a huge number of websites. Signifi-
in scope, focused from its inception on a single
                                                             cant applications have been built using it, especially on
task: building dynamic websites. It’s safe to say that
                                                             the client-side of the web transaction, such as webmail
it has succeeded, with the latest Netcraft surveys
                                                             interfaces and blogging tools. It is worth noting, how-
finding PHP installed on over 16 million domains.
                                                             ever, that JavaScript is unlike the languages previously
PHP combines a syntax that is easy for even novice
                                                             mentioned in two significant respects. First, because it
web designers to learn, with a rich library of modules
                                                             was defined as the language of the browser, it had to
that capitalize on the fact that most websites need
                                                             combine strict security requirements (e.g. a JavaScript
to do similar things (talk to databases, cache images,
                                                             program can’t, as a rule, access files on disk) with odd
process forms, etc.). PHP is now considered the most
                                                             user interface challenges. For example, it is “better”
serious competition to the web strategies of both
                                                             for a JavaScript program to fail quietly in the case of a
Microsoft (with ASP.NET) and Sun (with J2EE).
                                                             programming error, and this behavior can make it a
Tcl                                                          significant challenge to build large systems in JavaScript.
Tcl (short for Tool Command Language), designed with         Furthermore, and more critically, JavaScript has suffered
application integration in mind, has found applicability     from too much corporate interest. The design of the
across a wide variety of platforms and application do-       language was one of the battlefields between Microsoft
mains. It has been particularly successful at GUI applica-   and Netscape, and it can be argued that the resulting
tions (through its Tk toolkit), automation in general, and   language is a casualty of war. Even with open-source
test automation in particular. Its small code size has led   implementations, the language did not evolve according
to it being deployed in a variety of embedded contexts;      to normal open source mechanisms; instead, evolution
for example, Tcl is part of Cisco’s IOS router operating     was governed by the politics of the ECMA standards
system, and as such is included in all high-end Cisco        process, under considerable pressures from both major
routers and switches. A different, but equally important,    browser vendors. As a result, JavaScript is effectively
example of Tcl usage is AOLserver, America Online’s web      unchanging (a polite word for ‘dead’), and web designers
server—yet another example where a scripting language        are pondering moves to other technologies such as Mac-
runs some of the largest and busiest production environ-     romedia’s Flash, Microsoft’s proposed XAML, or Mozilla’s
ments in the world.                                          XUL frameworks.

                                                                                                                          15
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

Ruby, Groovy and Others                                       exhibited, viz. Visual Basic’s recent changes. Note that
The languages described above are simply the most             technical purity should not be confused with a more
popular today. Depending on when you read this, their         academic notion of purity. The successful dynamic
relative popularity may have shifted due to evolution of      languages all embrace the pragmatic constraints of the
the languages, the market requirements, fashion-like          real-world, such as integration with ‘foreign’ systems and
“buzz”, importance of various platforms, etc. New lan-        backwards-compatibility, even though those constraints
guages have emerged and have achieved varied levels of        often make the technical details much “messier.” The
adoption. Some languages include Ruby, which provides         crux is that they are pure in intent, in that they do not
a blend of Perl and Python-inspired features; and             serve a non-technical agenda.

Groovy, which is an agile language for the Java Virtual       Optimizing Person-time, Not Computer-time
Machine and builds upon the strengths of Java but has         The driving forces for the creation of each major dynamic
additional power features inspired by languages like          language centered on making tasks easier for people,
Python and Ruby.                                              with raw computer performance a secondary concern. As
                                                              the language implementations have matured, they have
It’s much too early to tell whether any or all of these
                                                              enabled programmers to build very efficient software,
languages will achieve the success of Perl. What’s reas-
                                                              but that was never their primary focus. Getting the job
suring is that, because of the market dynamics at play,
                                                              done fast is typically prioritized above getting the job
the winners will win because they are better at doing
                                                              done so that it runs faster. This approach makes sense
something that many people value.
                                                              when one considers that many programs are run only
                                                              periodically, and take effectively no time to execute,
PROPERTIES OF DYNAMIC LANGUAGES
                                                              but can take days, weeks, or months to write. When
More important than the differences among the lan-            considering networked applications, where network
guages noted above are their commonalities.                   latency or database accesses tend to be the bottlenecks,
                                                              the folly of hyper-optimizing the execution time of the
Technical Purity
                                                              wrong parts of the program is even clearer. A notable
Dynamic languages were designed to solve the technical
                                                              consequence of this difference in priority is seen in the
problems faced by their inventors, not to address specific
                                                              different types of competition among languages. While
goals identified as part of a ‘strategic plan’ to influence
                                                              system languages compete like CPU manufacturers on
buyers of IT solutions. As such, they have a “pure” focus
                                                              performance measured by numeric benchmarks such as
on solving technical problems, with no agenda to push
                                                              LINPACK, dynamic languages compete, less formally, on
a particular platform, operating system, security model,
                                                              productivity arguments and, through an indirect measure
or other piece of the IT stack (this focus is true of most
                                                              of productivity, on how “fun” a language is. It is apparently
successful grassroots open source projects). The value
                                                              widely believed that fun languages correspond to more
of technical purity is most notable in comparison to
                                                              productive programmers—a hypothesis that would be
competing proprietary languages where it is clearly not
                                                              interesting to test.

                                                                                                                          16
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

Open Source, Deeply                                            evolution of the language occur on public mailing lists,
All of the successful dynamic languages have, according        subject to the scrutiny of all. There is no hiding behind
to our definition, a primary implementation which is open      firewalls or membership in an organization.
source. This simple fact has in practice meant that the
                                                               Evolution by Meritocracy and
open source implementations have been the de facto
                                                               Natural Selection
language definition. An important consequence of the
                                                               Dynamic languages evolve along two, often orthogonal,
open source nature of the primary implementation has
                                                               directions. The core of the language is often controlled by
been that modifications to the language by third parties
                                                               a tight-knit, extremely competent set of individuals who
have been easier to adopt into the mainstream code
                                                               are in charge of the language’s basic tenets. These teams
base than if any kind of contractual relationship had been
                                                               are meritocratic rather than democratic, and consider
necessary. Any engineer anywhere can “tweak” the lan-
                                                               usersuggested changes only inasmuch as they don’t
guage to his or her heart’s content, without having to ask
                                                               present a deviation from the aesthetic or philosophical
anyone for permission. This ease with which experiments
                                                               principles of the language design. It is through this rather
can be performed by anyone is without equal. Main-
                                                               autocratic process that the languages have managed to
taining any significant modifications in the face of a lan-
                                                               remain “true to their core” over 10+ years of evolution.
guage under constant change is a maintenance burden,
                                                               In contrast, the capabilities of the languages (rather than
and it is widely understood that it’s best to contribute
                                                               their style) has most effectively grown through exten-
modifications back to the main code base. The resulting
                                                               sions, libraries, and modules. In that area, individual
phenomenon of naturally aggregating improvements
                                                               contributions are equally valued, and frenetic market
from “anybody” is (relatively) unencumbered by bureau-
                                                               competition rewards authors of important and useful
cracy, either of the nondisclosure-agreement-signing
                                                               modules, giving massive feedback to all contributors.
kind or of the standards-body kind. While a challenge for
                                                               Programming languages are unique among open source
organizations that require the use of standards-based
                                                               projects in that the gap between users and authors is
technologies, this has allowed the languages to evolve
                                                               minute; users can give valuable design feedback because,
quickly, and to incorporate feedback from stakeholders
                                                               just like the library creators, they write software and
of all sizes4. It is worth noting that academics (university
                                                               understand the perspective of the software designer.
students in particular) have been able to convert ideas
into implementations with remarkable efficiency through        It is through that bazaar of module distribution that
open source, a process that tends to be quicker than           practical usefulness emerges, because for a dynamic
either academic publication or the traditional industrial      language to support a new technology, the language itself
model of getting the idea reified in a product.                rarely needs to change; all that’s needed is someone
                                                               to write a special-purpose module. Thus, as soon as a
One of the ways in which dynamic languages are deeply
                                                               library, file format, or Internet protocol becomes “useful
open source is the almost total transparency about how
                                                               enough,” the language communities build language-spe-
the languages are evolved. The bug lists and patch review
                                                               cific modules to support it. It is the ability of open source
processes are public, and most conversations about the

                                                                                                                           17
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

communities to distribute the workload to those who            This approach has both negative and positive conse-
first feel the need to scratch a particular itch, that makes   quences. Dynamic languages cannot fit frameworks
them able to compete effectively against multi-million         such as .NET or the JVM as well as languages explicitly
dollar efforts. It is worth noting that dynamic typing is an   designed to fit them. On the other hand, dynamic
important edge in the race to “embrace and extend” new         language communities are free from the need to
technologies; for example, if a web application changes        restrict themselves to specific platforms definitions,
the schema of the data being transmitted, clients written      and have tended to embrace a wider variety of plat-
in a dynamically typed language will require fewer             forms. It’s important to note that platform neutrality
changes than their statically typed counterparts, all other    doesn’t mean “cross-platform at any cost”, where a
things being equal.                                            feature must be available on all platforms before it is
                                                               available on any. Instead, platform-specific language
Platform Neutrality
                                                               extensions (typically through libraries or modules)
Dynamic languages have naturally been platform-
                                                               are developed by users who have needs for particular
neutral. Building a programming language that
                                                               platform support.
is limited to a particular platform is anathema to
language designers; the language designer tends to             It is thus possible to write cross-platform programs
believe that “everyone” would be better off by using           using dynamic languages (most are), and it is equally
their language, or if not everyone, then at least ev-          possible to write programs which fully exploit plat-
eryone trying to solve a particular kind of problem            form-specific features.
with a particular background. These goals tend to
                                                               Languages you can build a plan on because
define target audiences which span all platforms (e.g.
                                                               users determine the language plan
the programming challenges of web designers should
                                                               Since the effort required for maintenance of the
be mostly independent of the underlying platform).
                                                               language is borne by the users of the language, the
While all of the popular dynamic languages were born
                                                               decision to end support for a platform is closely tied
with individual platform “biases,” they also embrace
                                                               to the disappearance of users of that language on that
the notion that they should work as well as possible
                                                               platform. Business drivers which accelerate unneces-
on all platforms. Over time, each language evolves to
                                                               sary changes, such as the idea of forcing customer
fit an ever-increasing set of target operating systems,
                                                               upgrades because of a requirement for revenue, don’t
naturally covering Linux and other Unix variants,
                                                               exist for technologies such as dynamic languages
and various Windows platforms, but also reaching
                                                               which are volunteer-driven and free. Importantly,
into more esoteric platforms like mainframes, super-
                                                               corporate users of dynamic languages who have
computers, phones, and various embedded devices.
                                                               investments in particular ports find it relatively cheap
Operating systems and platforms, more generally, are
                                                               to maintain these ports either directly or through
seen as “just another context to operate in.” Whether
                                                               funding vehicles such as specialized vendors.
or not each use case is supported is simply a matter
of perceived need and volunteer time.

                                                                                                                       18
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

WHEN TO USE DYNAMIC LANGUAGES                                 has made them favorites of agile development methods,
                                                              which favor iterative approaches over top-down models.
We’ve mentioned some successful deployments of
                                                              Ideally suited for loose coupling
dynamic languages and some of their observable
properties. We’ve stated that system languages are also       As argued by many observers5, always-on networks,
important pieces of the IT puzzle. When should one            mobile devices and open networking protocols allow for
consider using a dynamic language ? There are, naturally,     a radically new way of building software systems, focused
no simple answers that cover every possible scenario.         less on the PC and more on the power of coordinating
In particular, any policy that prescribes a particular        and aggregating network resources, e.g. through the use
language is incompatible with a value-based approach to       of web services6. In this new model, deeply integrated
language choice. If we assume an environment in which         platforms are not as valuable as components (using the
language choice is possible, however, some areas have         broadest definition) accessible through open interfaces.
shown to be ideal for the use of dynamic languages.
                                                              Steering Computational Tasks
Scripting tasks                                               The scientific computing area, known for its obsessive
Scripting is certainly an arena where dynamic languages       pursuit of optimization, outrageous supercomputing
are without equal. Whether the specific task involves         facilities and need for always-increasing computing
simple text processing, database exploration, or gluing       power, may seem odd to associate with dynamic
together existing tools, scripting languages have the right   languages. Indeed, most serious scientific computa-
blend of ease-of-use, rapid development support, and          tions are done using system or legacy languages that
rich interfaces to support these scenarios.                   have benefited from decades of optimization work.
                                                              However, those optimizations are typically restricted
Prototyping
                                                              to specific computations (linear algebra, numeric
A different use is the construction of complex systems,
                                                              optimization, etc.). In many cases, the “scientific” part
especially if the requirements aren’t wellspecified ahead
                                                              of scientific computation involves a great deal of what
of time. The domain can vary considerably, from process
                                                              other disciplines would call prototyping—trying out an
automation to scientific research to GUI development.
                                                              idea to “see if it works.” This experimentation needs
If the programmer isn’t sure at the onset of the project
                                                              to be done by computer scientists in collaboration
how the final application will look or act, then the rapid
                                                              with non-computational scientists, the specialists
development capability of dynamic languages leads to
                                                              in physics, biology, chemistry, climatology, or other
higher productivity and better end-point quality. If it’s
                                                              disciplines who drive the science behind the computa-
“cheap and easy” to correct a mistake, you correct it
                                                              tions. Given this environment, it is not surprising to
more often, leading to shorter projects or better software
                                                              learn that dynamic languages are routinely used as
(or both). Furthermore, experienced users of dynamic
                                                              part of a holistic approach to scientific computation, in
languages tend to take on more ambitious projects,
                                                              which computational scientists build flexible systems
because the cost of failure is lower. The rapid edit-
                                                              that are then easily scripted by domain experts.
compile-run-test cycle exhibited by dynamic languages

                                                                                                                       19
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

Business Logic                                                language than in a lower-level language,8 and thus should
The distinction between variable, high-level domain-          have fewer errors. In addition, this suggests that high-
specific choices and optimized, constant building blocks      level languages make it easier for a programmer to keep
occurs in every application domain. For example, in many      a larger part of their program in working memory.
corporate applications a distinction is made between
                                                              Given this, the success of dynamic languages in the
“business logic” (e.g. what data should be collected from
                                                              scientific and engineering communities at large is not
the user, what kinds of reports should be generated),
                                                              surprising; those kinds of users need to focus on the
and the “back-end code,” (e.g. database or network calls,
                                                              complexities of the business logic, and worrying about
communication with other subsystems). In this regard,
                                                              the details of the optimized memory pools is detrimental
dynamic languages share the same benefits as languages
                                                              to getting the important work done.
such as Visual Basic: rapid development, easily learned
by occasional programmers, well suited for end-user
                                                              WHEN NOT TO USE DYNAMIC LANGUAGES
scriptability, and forgiving to programming errors.
                                                              Only the most zealous advocates of dynamic languages
Advanced Technologies
                                                              will recommend their use in all situations. There are
Because of the language design aspects that strive to
                                                              software contexts that seem plainly inappropriate for
minimize the human effort required to express com-
                                                              their use.
putational ideas in code, dynamic languages are deeply
appreciated by people writing complex or sophisticated        Some High-performance Tasks
systems, be they nuclear scientists, network engineers, or    While we’ve argued that dynamic languages can be used
web architects. System languages tend to require more         to build high performance systems, even those applica-
discipline of the “bookkeeping” variety than do dynamic       tions rely on code written in more static languages to
languages, be that through requirements for explicit          do key parts of the work. Several kinds of tasks, such
type annotation, explicit memory management, interface        as some numeric computations, machine code genera-
definitions prior to implementation, etc. While useful in     tion, or low-level hardware interfacing, are best done
systems that require specific guarantees of robustness,       in programming languages where the concepts being
the scaffolding needed by those language approaches           manipulated (be they numbers, bytes, pixels, or memory
can get in the way of seeing the sculpture as a whole.        addresses) are expressed in a language optimized for
                                                              them. In most of these cases, there is no ambiguity about
A widely-held (but hard to test) belief is that the rate of
                                                              the requirements—a mathematical routine should do the
coding errors per line of code is roughly independent
                                                              same operation as it did when it was first invented—or
of programming language, regardless of the level of
                                                              the types of objects manipulated. It makes sense to
the language7. Casual inspection of high-level language
                                                              use a language like Fortran or C++ (which benefit from
code contrasted with equivalent systems code will show
                                                              decades of optimization research) to implement it. There
that dynamic languages are more concise. A given task
                                                              is a diverse set of such tasks where performance is the
requires fewer lines of code to execute in a high-level
                                                              overwhelming concern, and where dynamic languages

                                                                                                                         20
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

would result in unacceptable results. In many cases,       Myth: “You can’t build real applica-
combining a “steering layer” written in a dynamic          tions with scripting languages”
language and optimized components written in other         While Ousterhout (1998) should be credited for widely
languages can lead to a system with the flexibility of a   publicizing the strengths and value of languages such as
dynamic language approach and the effective perfor-        Perl, Tcl, Python etc., some believe that by adopting the
mance of a low-level language.                             moniker “scripting language,” he unwittingly facilitated
                                                           the propagation of one of the biggest criticisms of these
Small Memory Systems
                                                           languages—that they are only useful for small, simple,
Dynamic languages, because they are high-level and
                                                           automation tasks, and shouldn’t be considered for
interpreted, require more machinery to execute than
                                                           the serious programming challenges that professional
either lower-level languages or languages that get
                                                           programmers routinely face. While rigorous objective
compiled to machine code or equivalent. Thus, generally
                                                           analyses on the topic are hard to find, there is an abun-
speaking, they are inappropriate choices for very small
                                                           dance of anecdotal evidence suggesting that professional
memory systems.
                                                           programmers can, and have, built world-class systems
It is interesting to consider, however, that what were     using these languages.
once considered very small memory systems, such
                                                           The world-wide web, arguably the most successful IT
as phones and TV set-top boxes, are now laden with
                                                           project of the last decade, is substantially based on
enough memory to run much larger applications.
                                                           dynamic languages. At every stage of the web’s growth,
                                                           from homegrown “home pages” (which were most often
MYTHS ABOUT DYNAMIC LANGUAGES
                                                           powered by Perl) to today’s mission-critical websites (a
Given that much of what is said above is “old news,”       large percentage of which are written in PHP and Perl),
one must wonder why dynamic languages haven’t              dynamic languages have been critical components of
garnered more visibility among the mainstream,             identifying new challenges, prototyping architectures,
especially in the media and corporate boardrooms.          and building scalable, robust systems. It could be
In addition to the commercial forces at play (some of      claimed that, without high-level languages, a project
the competing languages are actively promoted by           with the combined risk and size of Yahoo! would never
marketing organizations with advertising budgets and       have been started, let alone completed. Web applica-
PR firms), and acknowledging that the technical com-       tions of all kinds, such as the Mailman list management
munities at the core of these open source languages        software, the Bugzilla bug tracking system, the Typepad/
tend to do a poor job of presenting their ideas to         Moveable Type blogging system, or the Gallery photo
non-technical audiences, it must be noted that part        archival system, are all powered by dynamic languages.
of the problem has been a lack of challenge to persis-     Google uses Python in a variety of systems. The social
tent myths or misconceptions surrounding dynamic           software site Friendster.com recently shifted from a JSP
languages. We examine some of these critically.            architecture to one based on PHP, specifically to address
                                                           performance problems.

                                                                                                                      21
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

Myth: “Dynamic languages are brittle”                          so on. These challenges are orthogonal to the language
                                                               choice, and certainly quite large systems have been built
Dynamic typing has in practice meant that the compiler
                                                               with dynamic languages.
is unable to make strong statements about the types
of objects at compile time9. This does mean that excep-        Myth: “There’s no innovation in open source”
tional conditions may occur at runtime. Instead of looking     This myth has received airtime recently with executives
on this as a critical weakness of dynamic languages, it can    from some proprietary software vendors accusing the
be argued that this has led to systems which are more          open source community of producing clones rather
robust to runtime failures than statically-typed coun-         than building innovative software. We’ll leave it to others
terparts. Because runtime failures happen more often,          to defend the work done in the domains of operating
defensive mechanisms have been built to deal with them,        systems or productivity applications. The argument that
and the overall system is more stable. As a result, ap-        open source produces no innovative work certainly
plications written in dynamic languages tend to fail more      doesn’t hold much water when it comes to program-
gracefully than those written in lower-level languages. For    ming languages. Not only have programming languages
example, writing code that robustly deals with possible        typically come out of academic research efforts (which
network outages is orders of magnitude easier with a           are effectively open source), but open source language
dynamic language than with a language such as C. This          designers have continued to innovate, even though that
ability to effectively deal with exceptional situations will   innovation has occured through different mechanisms
only become more important as systems become more              than those of proprietary languages.
interconnected.
                                                               Unlike languages such as Java and C#, which are the
Myth: “You can’t build large sys-                              focus of serious, goal-directed, funded research efforts,
tems with dynamic languages”                                   dynamic languages evolve in a more spontaneous (but
The above sentence is usually followed by an argu-             not necessarily worse) way. Academics worldwide find
ment as to why tight coupling, strong typing, and strict       it easy to get the implementations, understand them
interface checking are key to building large systems.          (with direct help from the maintainers), experiment with
Smalltalk experts, who have been building large systems        changes, and argue for language changes. Much aca-
for decades, probably chuckle at that argument more            demic language research therefore looks at the dynamic
than any others. Building large systems does present           languages as a fertile ground on which to develop next
different challenges than building smaller systems. The        generation approaches.
importance of infrastructure components such as error
                                                               In general, the spirit of cooperation that pervades
handling, logging, and performance monitoring are key,
                                                               open source makes for rapid experiments and rapid
as are design-time concerns such as architectural sound-
                                                               implementations. Examples include the Stackless imple-
ness and scalability planning, and development-time
                                                               mentation of Python, which is proving to be exceptionally
issues such as multi-tiered testing strategies, iterative
                                                               useful in some high-performance contexts; Tcl’s virtual
development, proper planning and documentation, and
                                                               filesystem, which is still unique in the flexibility it offers

                                                                                                                                22
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

developers looking to distribute their applications effort-     Swift adoption of open source major organizations has
lessly; and the Perl 6 effort, which is the focus for con-      created a demand for stable open source language dis-
siderable design and engineering work toward building           tributions and comprehensive support and maintenance
a fast register-based virtual machine with unparalleled         for open source deployments. So, when the open source
flexibility. Perl is an interesting project to contrast with    community does not provide answers to common devel-
proprietary languages. Technically speaking, the shift          oper pains, companies like ActiveState fill the gap with an
from Perl 5 to Perl 6 is probably as significant as the shift   enterprise-grade, third-party solution for managing and
from Visual Basic 6 to Visual Basic .NET. Indeed, the archi-    supporting open source software. ActiveState recognized
tects of Perl 6 don’t expect it to be backwards-compatible      early on that businesses with commercial implementa-
with Perl 5 (just like VB.NET isn’t backwards-compatible        tions of open source were taking big risks when it came
with VB6). However, unlike VB, there is every reason            to code stability, unreliable technical support, and
to believe that the Perl 5 language will continue to be         potential license infringement. The company developed
developed, supported, documented, and used for years.           enterprise-level open source language distributions that
The investment in Perl 5 by the community will ensure           have become renowned for quality and are now the
its long-term health, as no one has a strong commercial         de-facto standards for millions of developers around the
interest in “forcing upgrades.”                                 world. Like all open source code, ActiveState language
                                                                distributions are provided free to the community.
Myth: “Dynamic languages
aren’t well supported”                                          Myth: “Dynamic languages
This myth has been fading in recent years as the ben-           don’t have good tools”
efits of open source support systems have become                This myth deserves two answers. The first is that
more well known, thanks to the success of Linux.                there are tools for dynamic languages, but the
The dynamic language communities have organized                 providers of these tools are either not commer-
a variety of support mechanisms, from professional              cial vendors (open source projects tend to spawn
trainers to peer-support online discussion groups to            complementary open source projects) or they are
vendors offering enterprise support contracts, to con-          not the same tool vendors that target proprietary or
tractors able to modify the languages to fit particular         systems languages. ActiveState has been vigorously
customer needs, and, in some cases, shepherd the                competing in the dynamic languages tools market
changes back into the core language distribution.               for seven years, along with many others. The tools
                                                                can be found if you look for them, and some equal or
A related point is the availability of books and other
                                                                exceed the quality and features of large commercial
teaching or reference resources. Book publishers
                                                                vendor tools. The second answer is that the tools
compete fiercely for shelf-space to cover dynamic
                                                                for dynamic languages aren’t the same as the tools
languages. It is rare not to see books on dynamic
                                                                for systems languages. If you define a tool as a piece
languages among the top-sellers in the Programming
                                                                of software that helps you build a system better or
category on sites like Amazon.com.
                                                                faster, then the diversity of software available on the

                                                                                                                         23
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

Internet targeted at dynamic language programmers           Statically Typed and Security Focused
is awe-inspiring (browse through search.cpan.org            Foremost, Java is statically typed. A Java programmer
for a Perl-centric example). Because of the positive        needs to specify the type of each variable, as well as the
feedback cycle evident among dynamic language               particular interfaces each class implements; any deviation
programmers, there are thousands of libraries,              from these declarations causes (intended!) syntax errors
modules, packages, and frameworks available for             or compilation failures. The choice of static typing in Java
use, most under open source licenses. When the              wasn’t done for arbitrary reasons, naturally—it was done
open source community doesn’t provide the answer            because it is far easier to optimize programs for which
to a commonly felt pain among dynamic language              type information is know and guaranteed by the system.
programmers, companies such as ActiveState jump in          Additionally, it is far easier to make security guarantees
with commercial offerings.                                  about statically-typed languages, and one will recall that
                                                            the need for “verifiable” code is at the foundation of
Myth: “Dynamic languages don’t
                                                            both the Java Virtual Machine architecture and the .NET
fit with .NET, Java, System X”
                                                            Common Language Runtime. It is possible to implement
Interoperability is a natural consequence of the de-
                                                            dynamically typed languages on top of such systems
centralized development model of dynamic languages.
                                                            (Jython is a Python implementation for Java, and Groovy is
All of the major languages have interfaces to well-es-
                                                            a new dynamically-typed language for Java), but Java-the-
tablished frameworks, be they COM, CORBA, etc. More
                                                            language is far from that.
recent platforms haven’t been ignored either; there
are successful ports of the dynamic languages to Java       Not As Loose
( Jacl and Jython in particular) and interesting projects   Java’s design makes it easy to build highly integrated Java
and products targeting the .NET platform (IronPython,       applications, and harder to build interfaces between Java
PerlNET). History seems to argue that as soon as a          systems and non-Java systems. This is somewhat related
real and well-defined need is articulated, it’s simply      to a feeling that there is a “Java way” of doing any given
a matter of time before the right talent emerges            task. Contrasting that with the dynamic language model
from the volunteer community (usually without fore-         where there are multiple ways to do any one thing, one
warning) to lead the effort to meet that need.              understands why the Java approach is simpler to manage
                                                            and also possibly blinkered—changing the officially sup-
WHAT ABOUT JAVA?                                            ported way of doing any one thing becomes a significant
                                                            effort—in the dynamic languages world, for better of
Java, especially when seen as “organized opposition to
                                                            worse, it happens (or doesn’t!) as part of a brutal natural
Microsoft,” is interesting to contrast with the dynamic
                                                            selection process.
languages, since a superficial look at the language could
lead one to group them together. There are technical        There are more subjective difference between the dy-
and non-technical reasons why Java isn’t considered a       namics of the Java community and those of the dynamic
dynamic language.                                           language communities. Dynamic language communities

                                                                                                                         24
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

are looser than the Java community. This is true at many      A good example to highlight here is the different ap-
levels—the definition of “community member” is fuzzier        proaches toward newer standards such as SOAP, evident
in the dynamic language world. There is no equivalent         in dynamic languages vs. Java and C#, for example. The
to the formalized Java Community Process (JCP), which,        dynamic language communities are generally content
while designed to be inclusive, effectively raises the bar    with letting “someone else” worry about the standards-
compared to the informal models used by the grass-            definition process, and are confident that they’ll be able
roots open source communities . While the JCP is more
                                   10
                                                              to support them when they are defined and stable. In
broadly accepting of organizations than some other            contrast, Microsoft and Sun have committed significant
standards-defining bodies, it still requires a financial      resources to defining the standard, for clearly competi-
commitment from companies, effectively filtering out          tive, non-altruistic reasons. It is reasonable to expect
many possible contributors. This may be by design (e.g.
                                                              that the resulting standards have been more influenced
to ensure “committed” contributors). Regardless, it does
                                                              by how well they fit with those languages than with
narrow the scope of the self-defined community.
                                                              languages that got involved late in the standard-defini-
                                                              tion process. In this case, the combination of strategic
CHALLENGES FOR DYNAMIC LANGUAGES
                                                              planning and the resources of large corporations clearly
As discussed earlier, dynamic languages are not appropriate   resulted in shifts in the standard toward more strongly-
in all contexts and their future success is not necessarily   typed languages. An interesting counter-spin is that
guaranteed. It is worth asking whether the organizational     dynamic language enthusiasts tend to prefer a different
behaviors that have spawned them are appropriate for long-    approach to web services over SOAP (namely REpre-
term success, both individually and as a category.            sentational State Transfer, known as REST), which (they
                                                              claim) is simpler, more pragmatic, portable, robust, and
Lack of Strategic Vision
                                                              less resource-intensive.
To date, dynamic languages have not been driven by
strategic plans. In fact, most successful open source         No Real/Formal Budget
projects (Mono and Gnome being notable exceptions)            Given the importance of programming languages in
have enjoyed success in spite of a lack of a long-term        shaping IT, and the effective success of dynamic lan-
plan, let alone a clearly defined vision. The pragmatic,      guages, it is stunning to realize that these languages
tactical approach to fix what’s broken today as op-           have effectively succeeded with no budget. Certainly real
posed to anticipate the problems of tomorrow, has,            value is invested, through sponsored work by individual
when combined with the selection processes inherent           companies, to some degree through the various organi-
in the open source ecosystem, led to a survival of the        zations that support the languages, and predominantly
fittest for today’s problems, rather than rewarding           through the volunteer labor that goes in on a daily basis.
those with the most compelling vision for future              The fact remains, however, that there is no budget either
success. It’s worth asking if the lack of a plan is guar-     for significant marketing activities, or, more problemati-
anteed to be a winning approach in the long term.             cally, to engage in long-term technical projects.

                                                                                                                         25
UNVEILING THE ORIGINS,
MYTHS, USE AND BENEFITS
OF DYNAMIC LANGUAGES

If one guesses the budget supporting either the                 Clearly the reward mechanisms which have led to
language-related aspects of the .NET framework project          a growing pool of technical talent in each language
at Microsoft or the Java-related projects at Sun and IBM,       community have not led to a sizable pool of marketing
and compares it with the “sweat and tears” budget of            talent. Technologists are their own worst enemies
developer groups in the dynamic language communities,           in cases such as these—they believe that the better
it’s hard to bet on the “little guy.” However, even greater     technologies will “win”, in the face of centuries of data
inequalities have existed in the operating system or            showing that sometimes it’s the technology with the
database sectors, where the open source alternatives            better ads that wins. While dynamic languages will un-
have made tremendous strides, showing that traditional          doubtedly survive without marketing, it is interesting
budgeting and investment models should not be applied           to contemplate how different the software world
blindly to open source efforts.                                 would be in the absence of marketing (or, failing that,
                                                                with less asymmetric promotion).
One important advantage that open source can bring to
bear in such competitive battles is that its costs of failure   Legal Stability / Patent Threats
and limits on success are negligible. If an effort to re-       One of the most vague but real threats to open source
engineer the Python virtual machine fails, all that’s lost is   in general is the unequal position of open source
volunteer time. This makes it possible to entertain doing       communities in the face of legally savvy corporate
several such experiments simultaneously, and pick the           opposition. Specifically, the risk of patent and other
winner. Similarly, there are no limits on success—there is      intellectual property attacks against open source
no “cost of sales” to worry about with open source suc-         projects is worth considering seriously. The current
cess stories, nor are there support costs. The dynamics         state of software patents (especially in the United
of open source success tend to scale the pool of talented       States) makes it disproportionately easy for larger
contributors and the support bandwidth along with the           corporations to claim (and receive) software patents
success. Still, ask any dynamic language lead if he could       for inventions that can be independently developed
use two manyears of dedicated work on the language              by open source developers. Volunteer developers, as
and the answer will always be yes.                              a rule, have no direct economic interest in developing
                                                                the software, hence no interest in acquiring such
Lack of a Marketing Department
                                                                patents (even if the cost weren’t prohibitive for most
Budgetary constraints aside, it is worth noting that
                                                                individuals). It is possible for patent-holding corpora-
the market influence that dynamic languages have had
                                                                tions to bring suits against commercial distributors
is the accomplishment of a wide pool of people with
                                                                of dynamic languages, commercial users of dynamic
quite narrow technical skills. While a few programmers
                                                                languages and, least likely but most threatening,
can also turn a good phrase or design a nice logo,
                                                                against the individual contributors to those languages.
it’s fair to say that there is no marketing department
                                                                The asymmetry evident in the relative legal arsenals
with the coordination, plan-based activities, and,
                                                                on both sides of that divide is worrisome11.
again, budget with which to influence decision makers.

                                                                                                                         26
You can also read