Why Reia?
From Reia
A new language? Why? Aren't there enough languages already? Yes, there are certainly plenty of languages out there, but there's some areas for which Reia is particularly suitable. This article discusses these areas below.
Contents |
Erlang testing
Testing concurrent programs is extremely hard. Erlang has evolved some test frameworks, such as EUnit, ErUnit, and ErlUnit (in order of their appearance) which more or less provide the same sort of testing experience seen in static languages like Java. QuickCheck, a declarative testing framework, is compelling but also costs money. While QuickCheck provides excellent solutions for both fuzz testing and continuous integration, it does not particularly address the problems of testing concurrent programs.
Many have simply thrown their hands up in the air and declared the problem of testing concurrent programs as fundamentally unsolvable or at the very least too much trouble than it's worth, instead turning to logfiles and fixing problems as they arise in a production environment. Others have simply thrown code at the problem: Ericsson, the creator of Erlang, is rumored to have 2 lines of test cases for every 3 lines of their primary Telcom application written in Erlang. This monumental accumulation of test cases is a testament to the difficulty of testing concurrent programs, and such a large volume of test code requires considerable time and attention, particularly when changes to the application break existing test cases.
Dynamic scripting languages have taken a completely different approach to this problem. Two approaches have evolved relying on dynamic language facilities, called mocking and stubbing. Mocking allows you to create a fake object which can be used in a test case as a substitute for a real one, providing particular behaviors that the code being tested should respond to. Stubbing allows you make dynamic alterations to existing code, ripping out the existing functionality and substituting a fake version designed for use in conjunction with the test case. This means that modules under test can be hardcoded to a particular API, but no changes need to be made to that API to ensure the test case passes, nor do bugs in the API implementation matter as the stub gives correct expected output for a particular case.
Languages like Ruby have embraced an absurdly declarative, English-sounding approach to testing in the RSpec framework. Tests are structured as descriptions of how the module under test should behave, rather than just a bunch of functions with asserts that don't really give any clue as to how a particular module should behave. This approach has some wonderful benefits, such as allowing you to write behavior specifications alongside your tests. While such an approach might be doable in Erlang with enough work, it's much easier in Ruby where the multitude of language and syntactic features allow the tests to appear very expressive in terms of describing what the test is intended to demonstrate.
Reia has the potential to make it easy to write a declarative test framework which reads similarly to English, while simultaneously easy to use mocking and stubbing as a stand-in for functions, modules, or even entire processes. Such a framework could behave much like RSpec with minor syntactic changes. Furthermore, Reia provides seamless interfacing with Erlang and runs within the same VM, meaning you can use Reia to interact intimately and deeply with your existing Erlang programs. Reia even provides a first-class syntax for invoking Erlang functions, so porting over your existing tests should be incredibly easy.
Cloud computing
Services like Amazon's EC2, which effectively loan you as many computers as you want and charge you by the hour, have become increasingly popular, especially since they bring with them the possibility that you can rent out computers in proportion to the load that you're presently serving, then get away with not paying for them when load is low. This approach certainly seems much better than building in enough capacity to handle your peak load by buying lots and lots of expensive servers, then having them sit around idle most of the time.
Unfortunately, cloud computing is difficult to use effectively right now, because it requires programs be distributed and fault tolerant. Most languages make it difficult to create distributed, fault-tolerant programs, because for most programmers this is a relatively new problem and most languages have not been designed with these sort of systems in mind.
Reia brings both the ease of use of scripting languages and the immense capabilities of Erlang to build distributed, fault-tolerant systems. It's designed with Python and Ruby programmers in mind, languages which both provide for rapid development in short timeframes. Rapid development combined with cloud computing means that you can very quickly build programs which are able to scale to large audiences without massive alterations. This means you can bring good ideas to market quickly without having to rewrite your entire application from scratch.
Web applications / Network services
Network programming, particularly in the form of web applications, has shifted the focus from development of traditional desktop and server applications to a new approach where the two are effectively one and the same. This has shifted the economics: software has ceased to be a good and started to become a service. Rather than customers paying high upfront fees for software, they can often try-before-they-buy, or at the very least pay a small amount of money for limited time access to an application.
At the same time, this not only preserves the intellectual property of software developers, but allows them to charge recurring fees for access. In exchange, software as a service (SaaS) providers provide for the reliability of the application, backup data, and push out updates, all for a flat monthly fee. It's win-win for both the consumer and the software developer.
However, SaaS has some ugly drawbacks, the main one being that the service is effectively centralized which means that often it will be down for all users of the software simultaneously. If you have a small pool of servers running your service, and don't have proper redundancy, a hardware failure can often wipe out your entire service.
The solution is to decentralize your service and provide fault-tolerance in the form of redundant copies of services which fail over seamlessly. Mission critical applications can't afford for a hardware failure to take down an entire operation. Downtime costs companies money, so investing in software which is distributed and fault-tolerant can reduce costs.
Reia makes a great language for developing both web applications and network services. This comes first and foremost from its Erlang heritage and interoperability, which provides one of the best solutions for distributed, fault-tolerant applications available. Secondly, it comes from its dynamic scripting language heritage, which has a proven track record of great web application and network frameworks such as Ruby on Rails as well as Python's Django and Twisted.
Multi-core programming
CPU manufactures have been massively expanding the number of CPU cores on the processors they sell. Intel already has 8-core processors shipping, with 4-core CPUs available for under $200 and an 80-core processor as a research prototype whose release becomes increasingly feasible.
Unfortunately, existing programming languages make it difficult to write programs which can scale to larger and larger numbers of CPU cores. There's many reasons this is the case, the first and foremost being that these languages were never designed with concurrency in mind, and instead use approaches of tacking concurrency on as an afterthought, such as threads. Threads provide a poor solution for concurrent programming, because they're incredibly low level, error-prone, and tacked on as an afterthought to languages which were never designed to be concurrent in the first place.
Reia borrows upon the venerable lineages of languages like Erlang and Smalltalk. Particularly in the case of Erlang, concurrency was a fundamental consideration which is reflected throughout the design of the language. Because of this, Erlang programmers need not deviate too much from the design of programs for one processor when attempting to target dozens of processors, and it's not too much more difficult for programs to run on 10 different computers than it is for them to run on 1.
The same holds true for Reia, which has been designed to make concurrent programming accessible to those familiar with dynamic, object-oriented scripting languages like Python and Ruby. Reia also builds on the incredible facilities of Erlang, including its massively scalable virtual machine and its impressive standard library. Using Reia, a properly designed program will run N times faster on N CPU cores, a claim not possible in most other languages.

