Learning modern programming languages like Ruby made easy
The challenge of teaching modern programming languages
When teaching a programming language, one of the biggest challenges is developing a scenario that will help drive the learning, without bogging down the developer in the semantics of the problem itself. When a programming language is first taught, it's a tradition to start with the obligatory "Hello World" example. This is a great test to ensure the environment is working and that a user can indeed compile and run a piece of code, but as far as actual learning goes, "Hello World" really doesn't have much to offer.
Problem-based learning is always the most effective way to learn, regardless of whether the goal is to become an expert at software development or a world-renowned pastry chef. Adults always learn faster if they are forced to apply recently acquired knowledge to solving a particular task. The challenge when doing course development or stringing together a set of tutorials is determining the type of problem with which the user should be challenged.
The "Hello World" example is far too simplistic. Any software developer who experiences a training course that never goes beyond "Hello World" should be angry. They haven't been challenged and they really haven't been given the opportunity to apply their learning.
On the other hand, many courses, learning guides and tutorials tackle problem domains that are far too complex. Some respectable IT companies sell courseware in which the learner is expected to work through the development of an online shopping application that rivals Amazon.com in scope and complexity. The problem domain is so complex that it usually takes students three or four days to figure out exactly how the application works and what the application is supposed to do. The problem itself is so overwhelming that the student fails to learn any software development skills.
Balancing complexity and simplicity
In an attempt to identify a problem domain that resides somewhere between "Hello World" and Amazon.com on the complexity scale, the coding challenge TheServerSide chose is the implementation of the ubiquitous rock-paper-scissors game or, as it is known in other parts of the world, roshambo.
Figure 1. A Java Swing-based GUI approach to the rock-paper-scissors game.
Why does rock-paper-scissors work well as a learning aid? First and foremost, it requires little explanation. Most people understand the basic nuances of the game in which rock beats scissors, scissors beat paper and paper beats rock. There's no need for extensive use case diagrams or Agile story boards to describe what is going on. Having said that though, if a developer was tasked with creating use case diagrams or writing user stories, he wouldn't have a hard time doing so, because he already understands how the problem domain works. On the other hand, if use case development was part of an exercise or challenge, the roshambo application would still be a great problem with which to drive the learning, because the developer would be able to concentrate on the technical aspect of creating these Agile and UML artifacts and not have to waste time on understanding the business problem.
The roshambo problem also has very distinct parts that map well to key software development challenges, such as obtaining user input, processing the input, handling errors and outputting results back to the client. Furthermore, the game is very testable, with very clear outcomes given a particular piece of input.
The extensibility of the roshambo application
The scenario is also very extensible. If you follow this series, you will be amazed to see how many different ways the roshambo application can be used to demonstrate different programming constructs. The first few tutorials will demonstrate basic programming skills, including conditional logic, variable declarations and iterative structures. From there, a highly procedural application will be refactored into something much more object oriented. Once object orientation is complete, we will use testing frameworks such as JUnit, TestNG, Cucumber and Gherkin to make sure everything is working properly. And once testing is complete, we'll distribute the whole application, providing the opportunity to see how you might integrate Enterprise JavaBeans, distributed persistence, NoSQL databases and even SOAP-based or RESTful Web services into the mix.
Figure 3. A Ruby-based command-line solution to the rock-paper-scissors game.
In this set of tutorials the same problems will be solved using different modern programming languages. If you're a Java developer, you can quickly compare a Ruby or Scala application to the approach used by the language with which you are more familiar. Being able to compare, analyze and evaluate different approaches to solving a problem is perhaps the most effective way to learn and expand your knowledge.
What software development language do you think compliments Java the most? Let us know.
Modern programming languages made easy for Java developers
The catalog of tutorials currently includes the following:
- Roshambo: The programming problem to be solved
- An introduction to Java programming
- Working with advanced conditional statements in Java
- An introduction to Ruby programming
- Working with advanced conditional statements in Ruby