As a newcomer to Ruby, the ease of using the language was a welcomed surprise.
In the comp sci program at UC Davis, many of the core lower division courses, including those that introduce students to object-oriented programming (OOP), are taught in C/C++. Simultaneously learning the fundamentals for memory management and OOP, along with the unique C/C++ syntax, can quickly become a headache for those of us just starting out in computer science.
Implementing the OOP concepts taught in lecture becomes tedious when you’re unable to mentally parse the code that you are writing. You end up spending your time dealing with syntax errors rather than thinking of efficient ways to structure your program - what OOP is supposed to teach. The attention is pulled away from the high-level concepts that you want to practice and towards trivial syntactical details. (A big chunk of my first year of CS education was simply me learning how to effectively Google errors.) In this sense, C/C++ seem to be an inefficient choice for teaching the fundamentals of OOP, simply because the languages introduce too much, too fast.
In contrast, I believe that Ruby would have made an excellent introductory language to object-oriented programming, as it allows you to more easily apply concepts without being slowed down by syntactic peculiarities. Ruby’s streamlined syntax facilitates the creation of programs, thus allowing you to focus on what you are trying to make.
Ruby has given me an environment in which I can practice things like enforcing single responsibility or DRYing out my programs, because the syntax makes it clear what each class, method, and line of code is actually doing. This is a contrast to my early coding in C/C++, where the syntax obscured my code structure. Rather than learning best practices, I was mostly attempting to just get the program to compile.
The more complex method declarations and their placement in header files, as well as the strange syntax C/C++ use to emulate OOP, made it unclear to me what was going on and where. Naturally, if you don’t understand what different parts of your code are doing, you will not know how to efficiently structure your program. Throughout my introductory courses, this made object-oriented programming appear much more difficult than it had to be.
With that being said, starting in C/C++ made the transition to working in languages like Python and Java significantly easier. But at the end of the day, I believe Ruby would make a much more suitable choice for introducing object-oriented programming. Languages such as C and C++ simply do not allow you to isolate the application of OOP concepts in the way that Ruby does. Universities should consider adapting their curriculum to use languages optimized for student learning.
Maddii Brigham is a developer intern at Rietta where she has been learning Ruby on Rails, Docker, and collaborative work within an remote agency setting to bolster her formal computer science education.