|By Rick Hightower||
|February 1, 2000 12:00 AM EST||
Back before Java became popular, I was a C++ bigot. I programmed in nothing but C++. I lived, ate and breathed C++. If it wasn't C++, it was rubbish. I thought C++ was the alpha and omega of object-oriented programming. I had "operator overloading" for breakfast, "templates" for lunch and "multiple inheritance" for dinner, and I always went back for seconds.
Then a funny thing happened. I got a new job at another company as a C++ programmer. But they pulled the old bait and switch. Once I started working, someone suggested writing a good portion of a large project in a scripting language. I protested - I would not condescend to program in any other language but C++.
Shortly after I started at this new company the following edict was put forth: "Thou shall use a scripting language." Thus I was forced by management to write a good portion of the project in a high-level scripting language. They told us to glue components written in C++ together with this scripting language (in addition to writing components in C++). At first I hated it, as any self-respecting C++ bigot would. Then, gradually, the productivity of my team - and me - skyrocketed.
I became a true believer in scripting languages. The more I saw productivity climb, the less I coded in C++ and the more I coded in the scripting language. Granted, the scripting language had some limitations, but for many tasks it was just what the doctor ordered. Have you had a similar experience with a scripting language? If not, perhaps you should.
Many scripting languages are either object-oriented or object-based. Almost all of them are interpreted and use late-bound polymorphism. This makes scripting languages extremely dynamic and easy to program, which is essential for rapid application development (RAD), gluing components together and prototyping projects.
There's a fine line between a scripting language and a programming language. For example, Smalltalk is an extremely dynamic interpreted language, yet I dare you to call it a scripting language to a Smalltalk evangelist - you'll probably get punched in the nose. When I refer to scripting languages, I'm referring essentially to languages that are mostly interpreted and extremely dynamic, that is, they employ late-bound polymorphism and dynamic typing.
Java for the most part is a glorified scripting language - granted, a scripting language on steroids. Unlike most such languages, however, Java uses statically typed polymorphism; thus it has been called a hybrid language. At first this may seem like a disadvantage, but as it turns out, statically typed polymorphism is great for systems programming, framework definition and component development. Java's design by interface is truly great for large systems and frameworks.
Calling Java a system programming language to a system programmer is likely to evoke a nasty response (similar to calling Smalltalk a scripting language to a Smalltalk evangelist). However, don't view Java as a system programming language in the classic sense. Instead, view it as a virtual system programming language for a virtual system, that is, a virtual machine: the Java Virtual Machine (JVM). And Java, like its scripting language cousins, can be very dynamic - not as dynamic as Python, Smalltalk, and their ilk, but more dynamic than C++.
The funny thing is that the parts of Java that make it a great system language are the same parts that make it a mediocre scripting language. Don't get me wrong. Java is a great language. I jumped on the Java bandwagon as soon as I could hop a ride, and it's been good to me. However, Java is not as easy to use as scripting languages are. You really need a glue language in your toolkit. Build components and frameworks with Java, but glue the frameworks with a scripting language.
Don't fret! There's a history of using high-level scripting languages with system languages. Thus it's no surprise that there are scripting languages for Java. (Note: Don't get hung up on the term scripting; you can replace it with programming.)
Scripting Languages and System Languages: A Marriage Made in Heaven
For example, on UNIX systems many programmers program in C and C++, then glue modules together using higher-level shell programming (KornShell, C Shell, Bourne Shell, etc. Thus C is the system language and the shell scripts are the glue.
Another example: C and C++ programmers on UNIX often use Tcl (a scripting language) to do their GUI programming and glue together classes and libraries written in C++. C++ is the systems language and Tcl is the glue.
At other times C and C++ programmers will use Python as a control language - Python often ships with the UNIX system preinstalled. Python is easy to extend with a C. Again, C is the system programming language, Python is the glue.
The most prevalent example of an object-based scripting language is Visual Basic, which is often used to glue together COM components written in a variety of languages - C++, Delphi, and so on. Thus C++ is the systems language and Visual Basic is the glue.
Scripting Equals Increased Productivity
For more information on scripting languages and increased productivity check out the paper "Scripting: Higher Level Programming for the 21st Century" by John K. Ousterhout ( www.scriptics.com/people/john.ousterhout/scripting.html). The paper basically states what I have experienced: namely, a sharp increase in productivity by using a higher-level language. The paper states that a scripting language is five to 10 times more productive than a strongly typed language like Java.
Scripting languages, however, don't replace a system language; they augment it. And five to 10 times more productive seems a little high to me. My personal experience has been two to three times as fast, depending on the application. Your results may vary.
You may want to use a scripting language for the following reasons:
- To extend an application, that is, an extension language
- To debug an application
- To learn and experiment with the Java API
- To prototype a system rapidly
- To glue together subsystems and components
- To automate testing and regression testing
The best way to learn the Java API is by experimenting. Working with dynamically typed, interactive scripting languages allows you to experiment quickly. Even though the Java API is documented well, it helps to try things out interactively. I do this all the time.
The properties listed above make scripting languages ideal for prototyping. Once you start using an interactive, dynamic scripting language, you won't stop. It's addictive and productive.
Java Was Built to Be Scripted
Java has wonderful features that make creating scripting languages easy. The class reflection and bean introspection APIs are a great basis for integrating these languages. Essentially, the scripting language can get metadata about a Java's class properties, events and methods. The scripting language can then use this metadata to change properties, handle events and invoke methods.
To learn more about introspection and reflection see the API documentation under java.lang.reflect.* and java.beans.Introspector. I've had the pleasure of doing metaprogramming with COM, CORBA and Java. Out of the three, I much prefer Java's reflection and introspection mechanism and APIs. It's a lot easier to use.
Scripting Languages for the Java Virtual Machine
Some may feel that the only language for the JVM is Java. They're wrong. Like many platforms (and Java is very much a platform), the JVM has many languages. And the list of those that work in the JVM seems to keep growing. Mixing Java with a scripting language for RAD is a powerful one-two punch that could make your next project fly.
Introduction to a Regular Column
The Column's First Series
To kick off the column's birth, I'll start with a multipart series on programming and scripting languages that run in the JVM. These languages are Java-friendly, and often run in the JVM in both interpreted mode and as compiled Java classes, that is, they can be compiled to Java bytecode. These languages integrate well with Java classes and beans via the introspection and reflection APIs. They're great for prototyping, gluing together Java components and rapid application development. All of the languages are 100% Pure Java.
A lot of languages work in the JVM. Rather than just pick the ones I think are best, I want to solicit your feedback on which ones are most important to you. You can take part by going to the JDJ forum and voting. However, I've made a short list of languages that I think you should consider.
- JPython (Python)
- Instant Basic (Visual Basic clone)
- JACL (Tcl)
- BeanShell (Java-like)
- Bistro (Smalltalk-like)
- Skij (Lisp/Scheme-like)
Short Drill-Down of Different Languages
- Python (JPython): Java implementation of Python, a high-level, extremely dynamic, object-oriented language. JPython is very close to Python, and has been certified 100% Pure Java. Recently, NetBeans (the Java IDE maker that was bought by Sun) had a poll on their Web site regarding integrating a scripting language with their Java IDE. JPython won by a landslide. If you've used it, you know why.
You can develop JSP in JPython - called PSP for Python Server Pages. Python and JPython are open source. To learn more about JPython visit www.jpython.org and www.python.org. To learn more about Python Server Pages, which run in a Java Servlet server, see www.ciobriefings.com/psp/. (PSP is freely available.)
- Tcl (JACL): Java Command Language (JACL, i.e., Java Tcl) is a Java implementation of Tcl 8.x. With JACL you can write scripts for Java components and APIs. In addition, there is Tcl blend, which allows manipulation of Java objects directly from Tcl. Tcl is open source. To learn more about Jacl see the Scriptics Web site at www.scriptics.com/products/java/. Many Tcl users have claimed significant reduction in development costs. Tcl is the definition of RAD.
- Java (BeanShell): BeanShell is interpreted Java. The syntax is very much like Java, i.e., BeanShell executes Java statements and expressions. Like other scripting languages, BeanShell is dynamically typed; thus much of Java syntax for type declaration and casting is optional. This is a wonderful language for writing prototypes and learning new APIs (new to you) through experimentation. In addition, BeanShell, as the name implies, adds extra support for dealing with beans. I find it very easy to use, and it's freely available and open source under the GPL license. To learn more visit www.beanshell.org. (You may also want to check out Dynamic Java, which seems similar to BeanShell, at www.inria.fr/koala/djava/.)
- Smalltalk (Bistro): Bistro is a Smalltalk variant with extensions for Java features and integration. It offers software developers the ability to code in a syntax that is very readable and expressive. Like BeanShell, Bistro is dynamically typed with the option of being statically typed for closer integration with Java. Thus you can mix and match statically typed systems with those that are dynamically typed. For prototyping, the dynamically typed languages make a lot more sense. Smalltalk is purely dynamically typed. This variant has a good mix of the Java type safeness with the Smalltalk fast development. For more information on Bistro see www.jps.net/nikboyd/bistro/.
- Scheme (Skij): Skij is a small Scheme interpreter implemented in Java. Scheme is a variant of Lisp. Skij enables rapid prototyping in the Java environment. It has many advanced features like macros and first-class continuations. You can download a copy of Skij at www.alphaworks.ibm.com/formula/skij . There are at least 15 ports of Scheme to the JVM. If Skij isn't your favorite Java Scheme variant, let us know what is and why.
The above-mentioned languages are just suggestions. If your favorite isn't listed or none of them tickled your fancy, then go to Robert Tolksdorf's comprehensive list of programming languages for the JVM at http://grunge.cs.tu-berlin.de/vmlanguages.html. Over 100 languages are listed! Find one you like and tell us convincingly why it's the best thing since sliced bread. We don't want to miss the next great thing.
Convergence Dynamic to Static,
and Static to Dynamic Typing
It's interesting to compare BeanShell and Bistro. The former is essentially a Java variant that has added dynamic typing with optional static typing. The latter is a Smalltalk variant that has added static typing with optional dynamic typing. Java and Smalltalk are on both ends of the typing spectrum; these variants have crossed the chasm to provide a mix of dynamic and static typing (see Figure 1).
BeanShell and Bistro are on the right track. The most popular scripting language of all time, Visual Basic, also has support for both static and dynamic typing. Note that JPython has yet another way to fill in this typing gap, as we'll see when we cover JPython in the first article in this series.
Rosetta Stone Examples for Programming Languages
This article series will give specific examples that demonstrate how scripting languages can be more productive. Some are great for certain problem domains; the series will highlight the languages working in those domains. Other languages are general purpose; the series will show all of the languages working in a general-purpose manner.
The first part in the series will cover scripting languages in general, and will introduce JPython. Every article (including the first) will demonstrate several sample applications as follows:
- A simple GUI application
- A simple statistics application
- Embedding the script into an application (if applicable)
- A threaded animation application
- A simple example parsing text
Criteria for Judging the Best Languages
- Ease of use
- Resemblance to parent language
- Unique features
- String parsing
- Working well with Java classes
- Development environment/debugging
- Ease of use: This will cover how easy the language is to learn and use. This could be a combination of market factors. For example, the language is a lot like Visual Basic, and a lot of developers know Visual Basic. Therefore it's easy for many developers to learn. Ease of use could also be based on the syntax of the language. For example, Python is a really easy syntax to learn.
- Embedability: One reason many people use scripting languages is to embed the language into a large application to make it more extensible. Examples of this in the industry are Visual Basic for Applications (VBA) for Microsoft Excel and LotusScript for Lotus Notes. The advantage of using many of these languages is that you can embed them into your own application. In addition, you can use them to control a large system of components and frameworks written in Java. Thus this criterion is how easily you can embed the scripting language in your application and how well the language integrates with Java.
- Unique features: What makes this language cool? What features set this language apart from Java or the other languages? This could be a set of language features that gear the language to a particular problem domain. For example, the language could have a library that's good for generating XML and HTML documents, and the language is easy to integrate with JSP; thus the language is great for Web programming.
- String parsing: Many scripting languages are really keen at doing common tasks like string parsing. Some really excel at it. This covers the string-parsing capabilities of the languages being covered.
- Productivity: If this language is more productive than Java, then this section will highlight that fact. Productivity can be made up of several factors. For example, Smalltalk and Python have an extensive class library that can make it easy to perform common tasks. In addition, Python has built-in language support for collection objects including collection literals that let you define a collection. These language constructs and class libraries make programming strikingly productive.
- Working well with Java classes and APIs: Some languages can compile to Java bytecode, a Java class you can use from other Java classes. Some can extend a Java class into the equivalent of a class for that language. This section will measure how well a developer can integrate this language into existing Java projects.
For example, a language that allows you to define a class that subclasses a Java class may be considered to have very good Java integration.
As another example, Bistro extends Smalltalk syntax so that methods can have type signature. This makes integration with Java easier. Smalltalk ordinarily is only dynamically typed; however, Bistro can be dynamically typed or statically typed. This is a cool feature that will make integrating with Java easier.
- Development environment/debugging: Some languages have facilities to develop and debug code. Some of the development environments are a lot nicer than others. This section will compare the development environments of these scripting languages.
- Other items to be covered: What are the origins of the languages? Why were they developed? What problem domain were they developed for? This often helps in understanding why a language is adept in certain areas.
You've probably seen some reference to the famous (read: infamous) "Hello, World" sample program that a lot of programming language books put as their first example program (thanks to the creators of the C language).
Let's continue the tradition in this column, and give you a taste of some of these scripting languages. Instead of covering one language, however, we'll do two from the language series. Also, instead of a simple "Hello, World," we'll have a "say hello" button. When the user selects this button, another window will pop up and display "Hello, World" in an 18-point bold font. To start this off, we'll show this program in Java as in Listing 1.
Since you likely know Java well, I won't explain the listing in detail. Now use it to compare some of the other languages. The code snippets in Listings 2 and 3 will be as close to Listing 1 as possible (as close as the language permits while still showing the advantages of the featured language).
Now let's show one of my personal favorites - JPython. JPython integrates nicely with the Java bean properties and event model. Also, JPython is very expressive (it weighs in at about two thirds the size of the shorter of the other two listings - size measured in bytes, not lines, since Java can all be on one line).
JPython has a lot of momentum, and its syntax is easy to learn and real tight (not verbose). A version of JSP, PSP (Python Server Pages), works in a servlet engine. Keep an eye out for this one. (Note the double underbar, i.e., __sayHello denotes that sayHello is a private method.) The first article in the language series will be devoted to JPython, which is to JavaBeans what Visual Basic is to ActiveX. We'll cover it in more detail in the next article.
Interest is growing in some of these languages. The JDK 1.3 has added more features for hooking scripting languages to events. IDE developers are starting to include scripting language support in their tools. One or two of these languages are likely to be the next Java or XML, that is, insanely popular Internet Phenomena.
Components (JavaBeans) and distributed components (CORBA, EJB, RMI) have a symbiotic relationship with high-level languages. For example, Visual Basic did well because of VBX, OCX and ActiveX components. And COM/ ActiveX/DCOM did well because of tools like Visual Basic, PowerBuilder, Delphi, and so on. On the Java platform we have the component models; we need the glue, that is, tools for the high-level languages - such as debuggers and IDEs.
Scripting languages are dynamic, interactive environments that help you develop Java code rapidly. The mere assertion that scripting languages improve productivity five to 10 times merits your interest. Go find a scripting language that runs in the JVM and conquer your next Java project in record time. Then let us know how it went.
The Internet of Things can drive efficiency for airlines and airports. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Sudip Majumder, senior director of development at Oracle, discussed the technical details of the connected airline baggage and related social media solutions. These IoT applications will enhance travelers' journey experience and drive efficiency for the airlines and the airports.
Jan. 17, 2017 04:15 PM EST Reads: 1,952
In 2014, Amazon announced a new form of compute called Lambda. We didn't know it at the time, but this represented a fundamental shift in what we expect from cloud computing. Now, all of the major cloud computing vendors want to take part in this disruptive technology. In his session at 20th Cloud Expo, John Jelinek IV, a web developer at Linux Academy, will discuss why major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform are all trying to sidestep VMs and containers...
Jan. 17, 2017 03:26 PM EST Reads: 203
SYS-CON Events announced today that Catchpoint, a leading digital experience intelligence company, has been named “Silver Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Catchpoint Systems is a leading Digital Performance Analytics company that provides unparalleled insight into your customer-critical services to help you consistently deliver an amazing customer experience. Designed for digital business, C...
Jan. 17, 2017 02:30 PM EST Reads: 1,727
With major technology companies and startups seriously embracing IoT strategies, now is the perfect time to attend @ThingsExpo 2016 in New York. Learn what is going on, contribute to the discussions, and ensure that your enterprise is as "IoT-Ready" as it can be! Internet of @ThingsExpo, taking place June 6-8, 2017, at the Javits Center in New York City, New York, is co-located with 20th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry p...
Jan. 17, 2017 02:15 PM EST Reads: 3,622
In his General Session at 17th Cloud Expo, Bruce Swann, Senior Product Marketing Manager for Adobe Campaign, explored the key ingredients of cross-channel marketing in a digital world. Learn how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects).
Jan. 17, 2017 02:00 PM EST Reads: 5,351
Things are changing so quickly in IoT that it would take a wizard to predict which ecosystem will gain the most traction. In order for IoT to reach its potential, smart devices must be able to work together. Today, there are a slew of interoperability standards being promoted by big names to make this happen: HomeKit, Brillo and Alljoyn. In his session at @ThingsExpo, Adam Justice, vice president and general manager of Grid Connect, will review what happens when smart devices don’t work togethe...
Jan. 17, 2017 01:45 PM EST Reads: 209
"There's a growing demand from users for things to be faster. When you think about all the transactions or interactions users will have with your product and everything that is between those transactions and interactions - what drives us at Catchpoint Systems is the idea to measure that and to analyze it," explained Leo Vasiliou, Director of Web Performance Engineering at Catchpoint Systems, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York Ci...
Jan. 17, 2017 12:45 PM EST Reads: 5,531
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Jan. 17, 2017 12:45 PM EST Reads: 5,047
"Tintri was started in 2008 with the express purpose of building a storage appliance that is ideal for virtualized environments. We support a lot of different hypervisor platforms from VMware to OpenStack to Hyper-V," explained Dan Florea, Director of Product Management at Tintri, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jan. 17, 2017 12:45 PM EST Reads: 4,424
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Jan. 17, 2017 11:45 AM EST Reads: 4,176
SYS-CON Events announced today that Super Micro Computer, Inc., a global leader in Embedded and IoT solutions, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 7-9, 2017, at the Javits Center in New York City, NY. Supermicro (NASDAQ: SMCI), the leading innovator in high-performance, high-efficiency server technology, is a premier provider of advanced server Building Block Solutions® for Data Center, Cloud Computing, Enterprise IT, Hadoop/Big Data, HPC and E...
Jan. 17, 2017 11:45 AM EST Reads: 5,704
SYS-CON Events announced today that Linux Academy, the foremost online Linux and cloud training platform and community, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Linux Academy was founded on the belief that providing high-quality, in-depth training should be available at an affordable price. Industry leaders in quality training, provided services, and student certification passes, its goal is to c...
Jan. 17, 2017 11:45 AM EST Reads: 1,903
IoT is at the core or many Digital Transformation initiatives with the goal of re-inventing a company's business model. We all agree that collecting relevant IoT data will result in massive amounts of data needing to be stored. However, with the rapid development of IoT devices and ongoing business model transformation, we are not able to predict the volume and growth of IoT data. And with the lack of IoT history, traditional methods of IT and infrastructure planning based on the past do not app...
Jan. 17, 2017 11:15 AM EST Reads: 520
Fact is, enterprises have significant legacy voice infrastructure that’s costly to replace with pure IP solutions. How can we bring this analog infrastructure into our shiny new cloud applications? There are proven methods to bind both legacy voice applications and traditional PSTN audio into cloud-based applications and services at a carrier scale. Some of the most successful implementations leverage WebRTC, WebSockets, SIP and other open source technologies. In his session at @ThingsExpo, Da...
Jan. 17, 2017 10:30 AM EST Reads: 2,738
In the next five to ten years, millions, if not billions of things will become smarter. This smartness goes beyond connected things in our homes like the fridge, thermostat and fancy lighting, and into heavily regulated industries including aerospace, pharmaceutical/medical devices and energy. “Smartness” will embed itself within individual products that are part of our daily lives. We will engage with smart products - learning from them, informing them, and communicating with them. Smart produc...
Jan. 17, 2017 10:30 AM EST Reads: 1,636
Why do your mobile transformations need to happen today? Mobile is the strategy that enterprise transformation centers on to drive customer engagement. In his general session at @ThingsExpo, Roger Woods, Director, Mobile Product & Strategy – Adobe Marketing Cloud, covered key IoT and mobile trends that are forcing mobile transformation, key components of a solid mobile strategy and explored how brands are effectively driving mobile change throughout the enterprise.
Jan. 17, 2017 10:00 AM EST Reads: 5,753
Smart Cities are here to stay, but for their promise to be delivered, the data they produce must not be put in new siloes. In his session at @ThingsExpo, Mathias Herberts, Co-founder and CTO of Cityzen Data, discussed the best practices that will ensure a successful smart city journey.
Jan. 17, 2017 08:00 AM EST Reads: 1,957
WebRTC sits at the intersection between VoIP and the Web. As such, it poses some interesting challenges for those developing services on top of it, but also for those who need to test and monitor these services. In his session at WebRTC Summit, Tsahi Levent-Levi, co-founder of testRTC, reviewed the various challenges posed by WebRTC when it comes to testing and monitoring and on ways to overcome them.
Jan. 17, 2017 07:45 AM EST Reads: 5,901
For basic one-to-one voice or video calling solutions, WebRTC has proven to be a very powerful technology. Although WebRTC’s core functionality is to provide secure, real-time p2p media streaming, leveraging native platform features and server-side components brings up new communication capabilities for web and native mobile applications, allowing for advanced multi-user use cases such as video broadcasting, conferencing, and media recording.
Jan. 17, 2017 07:00 AM EST Reads: 6,775
The best-practices for building IoT applications with Go Code that attendees can use to build their own IoT applications. In his session at @ThingsExpo, Indraneel Mitra, Senior Solutions Architect & Technology Evangelist at Cognizant, provided valuable information and resources for both novice and experienced developers on how to get started with IoT and Golang in a day. He also provided information on how to use Intel Arduino Kit, Go Robotics API and AWS IoT stack to build an application tha...
Jan. 17, 2017 06:30 AM EST Reads: 3,778