RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


The Road to Ruby from C++ : Page 4

C++ developers learn Ruby at their own peril. Once they become familiar with this powerfully concise language, they may find returning to C++ a bitter pill to swallow.

A Summary of Language Features
To summarize, Table 1 presents some of the key features of C++ and Ruby discussed in this article (with Java included for comparison).

Language Features C++ Java Ruby
Type System Static Mostly static Dynamic
Object Orientation Hybrid Pure (with primitive types) Pure
Inheritance Multiple Single and interfaces Single and mixins
Overloading Method and Operator Method Operator
Polymorphism Yes Yes Yes
Visibility/Access Controls Public, protected, private, and friends Public, protected, package, and private Public, protected, private (instance)
Garbage Collection No Yes Yes
Generics Yes (templates) Yes (generics) No
Closures No (function objects) Yes, with some limitations (inner classes) Yes (blocks)
Exceptions Yes Yes Yes
Table 1. A Comparison of Features in C++, Java, and Ruby

Beyond the Basics
Ruby provides many more features and libraries than one article can cover, but this small sampling should give you some idea about where in your next programming project it would be useful. There are many excellent resources available for learning more about this powerful, concise programming language. The best places to start are at Ruby-Lang.org and Ruby-Doc.org.

Michael Voss is a Senior Staff Software Engineer at Intel Corp. Voss received his Ph.D. in Electrical Engineering from Purdue University in 2001. He is currently a Senior Staff Software Engineer in the Performance Analysis and Threading Lab at Intel and an adjunct Professor in the Edward S. Rogers Sr. Department of Electrical and Computer Engineering at the University of Toronto. His interests include parallel programming and optimizing compilers.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date