|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 Everything is re-shaping technology trends–moving away from “request/response” architecture to an “always-on” Streaming Web where data is in constant motion and secure, reliable communication is an absolute necessity. As more and more THINGS go online, the challenges that developers will need to address will only increase exponentially. In his session at @ThingsExpo, Todd Greene, Founder & CEO of PubNub, will explore the current state of IoT connectivity and review key trends and technology requirements that will drive the Internet of Things from hype to reality.
Oct. 9, 2015 05:30 PM EDT
Today air travel is a minefield of delays, hassles and customer disappointment. Airlines struggle to revitalize the experience. GE and M2Mi will demonstrate practical examples of how IoT solutions are helping airlines bring back personalization, reduce trip time and improve reliability. In their session at @ThingsExpo, Shyam Varan Nath, Principal Architect with GE, and Dr. Sarah Cooper, M2Mi's VP Business Development and Engineering, will explore the IoT cloud-based platform technologies driving this change including privacy controls, data transparency and integration of real time context w...
Oct. 9, 2015 05:15 PM EDT Reads: 114
The buzz continues for cloud, data analytics and the Internet of Things (IoT) and their collective impact across all industries. But a new conversation is emerging - how do companies use industry disruption and technology enablers to lead in markets undergoing change, uncertainty and ambiguity? Organizations of all sizes need to evolve and transform, often under massive pressure, as industry lines blur and merge and traditional business models are assaulted and turned upside down. In this new data-driven world, marketplaces reign supreme while interoperability, APIs and applications deliver un...
Oct. 9, 2015 04:00 PM EDT Reads: 306
The Internet of Things (IoT) is growing rapidly by extending current technologies, products and networks. By 2020, Cisco estimates there will be 50 billion connected devices. Gartner has forecast revenues of over $300 billion, just to IoT suppliers. Now is the time to figure out how you’ll make money – not just create innovative products. With hundreds of new products and companies jumping into the IoT fray every month, there’s no shortage of innovation. Despite this, McKinsey/VisionMobile data shows "less than 10 percent of IoT developers are making enough to support a reasonably sized team....
Oct. 9, 2015 04:00 PM EDT Reads: 241
Electric power utilities face relentless pressure on their financial performance, and reducing distribution grid losses is one of the last untapped opportunities to meet their business goals. Combining IoT-enabled sensors and cloud-based data analytics, utilities now are able to find, quantify and reduce losses faster – and with a smaller IT footprint. Solutions exist using Internet-enabled sensors deployed temporarily at strategic locations within the distribution grid to measure actual line loads.
Oct. 9, 2015 03:49 PM EDT
You have your devices and your data, but what about the rest of your Internet of Things story? Two popular classes of technologies that nicely handle the Big Data analytics for Internet of Things are Apache Hadoop and NoSQL. Hadoop is designed for parallelizing analytical work across many servers and is ideal for the massive data volumes you create with IoT devices. NoSQL databases such as Apache HBase are ideal for storing and retrieving IoT data as “time series data.”
Oct. 9, 2015 03:45 PM EDT Reads: 509
Too often with compelling new technologies market participants become overly enamored with that attractiveness of the technology and neglect underlying business drivers. This tendency, what some call the “newest shiny object syndrome,” is understandable given that virtually all of us are heavily engaged in technology. But it is also mistaken. Without concrete business cases driving its deployment, IoT, like many other technologies before it, will fade into obscurity.
Oct. 9, 2015 03:45 PM EDT Reads: 144
The IoT market is on track to hit $7.1 trillion in 2020. The reality is that only a handful of companies are ready for this massive demand. There are a lot of barriers, paint points, traps, and hidden roadblocks. How can we deal with these issues and challenges? The paradigm has changed. Old-style ad-hoc trial-and-error ways will certainly lead you to the dead end. What is mandatory is an overarching and adaptive approach to effectively handle the rapid changes and exponential growth.
Oct. 9, 2015 03:00 PM EDT Reads: 210
Today’s connected world is moving from devices towards things, what this means is that by using increasingly low cost sensors embedded in devices we can create many new use cases. These span across use cases in cities, vehicles, home, offices, factories, retail environments, worksites, health, logistics, and health. These use cases rely on ubiquitous connectivity and generate massive amounts of data at scale. These technologies enable new business opportunities, ways to optimize and automate, along with new ways to engage with users.
Oct. 9, 2015 02:00 PM EDT Reads: 190
The IoT is upon us, but today’s databases, built on 30-year-old math, require multiple platforms to create a single solution. Data demands of the IoT require Big Data systems that can handle ingest, transactions and analytics concurrently adapting to varied situations as they occur, with speed at scale. In his session at @ThingsExpo, Chad Jones, chief strategy officer at Deep Information Sciences, will look differently at IoT data so enterprises can fully leverage their IoT potential. He’ll share tips on how to speed up business initiatives, harness Big Data and remain one step ahead by apply...
Oct. 9, 2015 01:45 PM EDT Reads: 565
There will be 20 billion IoT devices connected to the Internet soon. What if we could control these devices with our voice, mind, or gestures? What if we could teach these devices how to talk to each other? What if these devices could learn how to interact with us (and each other) to make our lives better? What if Jarvis was real? How can I gain these super powers? In his session at 17th Cloud Expo, Chris Matthieu, co-founder and CTO of Octoblu, will show you!
Oct. 9, 2015 01:15 PM EDT
As a company adopts a DevOps approach to software development, what are key things that both the Dev and Ops side of the business must keep in mind to ensure effective continuous delivery? In his session at DevOps Summit, Mark Hydar, Head of DevOps, Ericsson TV Platforms, will share best practices and provide helpful tips for Ops teams to adopt an open line of communication with the development side of the house to ensure success between the two sides.
Oct. 9, 2015 01:00 PM EDT Reads: 611
SYS-CON Events announced today that ProfitBricks, the provider of painless cloud infrastructure, will exhibit at SYS-CON's 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. ProfitBricks is the IaaS provider that offers a painless cloud experience for all IT users, with no learning curve. ProfitBricks boasts flexible cloud servers and networking, an integrated Data Center Designer tool for visual control over the cloud and the best price/performance value available. ProfitBricks was named one of the coolest Clo...
Oct. 9, 2015 01:00 PM EDT Reads: 801
SYS-CON Events announced today that IBM Cloud Data Services has been named “Bronze Sponsor” of SYS-CON's 17th Cloud Expo, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. IBM Cloud Data Services offers a portfolio of integrated, best-of-breed cloud data services for developers focused on mobile computing and analytics use cases.
Oct. 9, 2015 12:00 PM EDT Reads: 741
SYS-CON Events announced today that Sandy Carter, IBM General Manager Cloud Ecosystem and Developers, and a Social Business Evangelist, will keynote at the 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA.
Oct. 9, 2015 11:15 AM EDT
Developing software for the Internet of Things (IoT) comes with its own set of challenges. Security, privacy, and unified standards are a few key issues. In addition, each IoT product is comprised of at least three separate application components: the software embedded in the device, the backend big-data service, and the mobile application for the end user's controls. Each component is developed by a different team, using different technologies and practices, and deployed to a different stack/target - this makes the integration of these separate pipelines and the coordination of software upd...
Oct. 9, 2015 09:00 AM EDT Reads: 299
Mobile messaging has been a popular communication channel for more than 20 years. Finnish engineer Matti Makkonen invented the idea for SMS (Short Message Service) in 1984, making his vision a reality on December 3, 1992 by sending the first message ("Happy Christmas") from a PC to a cell phone. Since then, the technology has evolved immensely, from both a technology standpoint, and in our everyday uses for it. Originally used for person-to-person (P2P) communication, i.e., Sally sends a text message to Betty – mobile messaging now offers tremendous value to businesses for customer and empl...
Oct. 9, 2015 08:30 AM EDT Reads: 314
"Matrix is an ambitious open standard and implementation that's set up to break down the fragmentation problems that exist in IP messaging and VoIP communication," explained John Woolf, Technical Evangelist at Matrix, in this SYS-CON.tv interview at @ThingsExpo, held Nov 4–6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Oct. 9, 2015 07:00 AM EDT Reads: 5,887
WebRTC converts the entire network into a ubiquitous communications cloud thereby connecting anytime, anywhere through any point. In his session at WebRTC Summit,, Mark Castleman, EIR at Bell Labs and Head of Future X Labs, will discuss how the transformational nature of communications is achieved through the democratizing force of WebRTC. WebRTC is doing for voice what HTML did for web content.
Oct. 9, 2015 06:00 AM EDT Reads: 1,416
Nowadays, a large number of sensors and devices are connected to the network. Leading-edge IoT technologies integrate various types of sensor data to create a new value for several business decision scenarios. The transparent cloud is a model of a new IoT emergence service platform. Many service providers store and access various types of sensor data in order to create and find out new business values by integrating such data.
Oct. 9, 2015 04:00 AM EDT Reads: 575