https://medium.com/workpath-thewaywework/learning-ruby-2-things-i-like-2-things-i-miss-from-python-6f60af8ed16c Sign in Workpath * Values * Team * Engineering * About Workpath Learning Ruby: 2 Things I Like, 2 Things I Miss From Python Steffen Wenz Steffen Wenz Follow Feb 7 * 4 min read I've recently had the fortune to join Workpath as VP of Engineering. Workpath's backend runs on Ruby on Rails, and while coding won't be a part of my day-to-day duties, I still need and want to learn the stack. Since most of my experience is with Python, let me tell you about 2 things I've liked in Ruby, and 2 that made me want to start up PyCharm again! - Follow us on Twitter @WorkpathEng Python vs. Ruby Python and Ruby are really similar. They're both interpreted, dynamically typed, general-purpose languages. There are similarities in the syntax, and they even share implementation details: * You can write extensions in C. * They're compiled to bytecode and then both Python and Ruby interpreters are basically a giant fascinating switch-statement in C. * Their interpreters are both plagued by a global interpreter lock, which limits parallelism ... the similarities are eerie! But Python and Ruby occupy different spaces today: Python's stronghold is data science, whereas Ruby is inseparable from the Rails framework. However, I posit that this might as well be accidental; the language designs are so similar that I could just as well imagine a world where Python is the web development lingua franca, and Ruby has all the machine learning libraries. Image for post Image for post Me at PyCon 2016 with ... yeah, a real Python #noanimalswereharmed Now, my thoughts on learning Ruby: I Like: The Syntax Ruby's syntax is concise, and the language is opinionated in areas where Python is not: * OOP all the way. In Ruby, you just structure your code with classes and methods. In Python, OOP is optional, and it's a matter of debate if it is actually "Pythonic". OOP did not get much love from Python language designers, so you'll have to make do without a private keyword and similar syntactic sugar. And the deeper you look at its type system, the more likely you are to find leaky abstractions shining through from its C interpreter. * Blocks. Ruby has a reputation of permitting multiple ways of doing the same thing (more on that below). But I find that blocks hold such a privileged position in the language syntax that you're just nudged to use them in your interface design. When leading a team around a large codebase, I appreciate a language that encourages a certain design. Fewer technical decisions, more time to focus on creating value for customers! I Dislike: ... Some Of The Syntax On the other hand, Ruby takes the "concise" part a bit far. There are nearly always different ways of expressing basic syntactic concepts. And Rubyists have a knack for loaded one-liners -- take this Rails scope: scope :registration_on, ->(date) { where created_at: date.beginning_of_day..date.end_of_day } Sure, if you just read the English words from left to right, you grasp what this does. But to my beginner's eyes, this is much more readable with a few more parentheses. And it seems that Ruby is determined to keep adding syntax. Ruby 3.0 comes with rightward assignment, which makes these gems (heh) possible: I Miss: Generators They say a programming language is worth learning if it changes the way you think. From Python, the thing that'll stick with me is generators. Especially for processing data, it just becomes so natural (and memory-efficient) to express generation or transformation of data through generators. In fact, I wrote a Python script to generate different Ruby representations of the Rails scope I mentioned as an example above. I would struggle to crank out this code as quickly in Ruby or any other language: Write a comment if you want to see the output of this thing. Generators gradually evolved to become the basis of async coroutines in modern Python versions. And Ruby 3.0 comes with Fibers, a very similar concept, which means maybe I won't have to miss generators for long. I Like: The Ecosystem An open-source language lives and dies with its community and ecosystem. And Ruby seems at a disadvantage here, since it's a well known language, but rather niche in the workplace, and often absent from top 10 rankings. However, my limited experience has been that tooling and libraries are very mature. Ruby seems to be focused around a few key projects, but these are rock solid. If you want to write a web application in Python, or write a BDD test suite etc. etc. you'll almost always be faced with a myriad of choices. There's another upside to this focus around a few key open source libraries: While Ruby developers are still few and far between, when you do get to interview one, they tend to have experience in at least 80% of the tech that we use. More To Come! There's much more to talk about -- the heavy presence of Rails in the Ruby language, the emergence of type hinting in Ruby 3.0, and then finally, how we put all this together to deliver great products here at Workpath. So stay tuned for more! - Learn more about Workpath, or see our open Rails software engineer positions in Munich, Berlin and Madrid Workpath Workpath Follow 235 * Ruby * Python * Engineering * Workpath 235 claps 235 claps Steffen Wenz Written by Steffen Wenz Follow VP Engineering at Workpath Follow Workpath Workpath Follow Articles on our team and #thewaywework Follow Steffen Wenz Written by Steffen Wenz Follow VP Engineering at Workpath Workpath Workpath Follow Articles on our team and #thewaywework More From Medium A streaming library with a superpower: FS2 and functional programming Daniel Sebban in freeCodeCamp.org [1] [1] Do I Need A Ledger Database? What Is It? Shaun Gehring in A Technologists POV [0] [0] Spark Query Plans for Dummies Anjana Sudhir in The Code Shelf [1] [1] Create your custom Matplotlib style Karthikeyan P in Analytics Vidhya [1] [1] Developer Tools to Increase Your Productivity Nabil Nalakath in Better Programming [1] [1] Semantic HTML, CSS Selectors & Specificity. Matt Basile in Matt's Lambda Minutes [1] [1] Web Scraping With Python Using BeautifulSoup and MongoDB Florian Domgjoni in The Startup [0] [0] Following the End-to-End User Journey: Project Firefly Guides Sarah Xu in Adobe Tech Blog [1] [1] Learn more. Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more Make Medium yours. Follow the writers, publications, and topics that matter to you, and you'll see them on your homepage and in your inbox. Explore Share your thinking. If you have a story to tell, knowledge to share, or a perspective to offer -- welcome home. It's easy and free to post your thinking on any topic. Write on Medium About Help Legal Get the Medium app A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store