Ruby Glossary: Common Programming Terms & What They Mean

This page contains a list of common programming terms for Ruby developers.

Hope you find it helpful!

Object-Related Terms

  • Object-Oriented Programming A programming paradigm which is centered around the idea of objects. Objects hold data & logic together, so a Car object would know it’s current speed, but also how to speed up & down.
  • Polymorphism The ability to call any method on different objects, as long as those objects implement that method, without regard to the actual class of the object.
  • Predicate method A method that returns true or false. Typically ends with a question mark (like empty?).
  • Instance method A method that is bound to a particular instance of a class.
  • Singleton method A method that can be used directly from the class, without having to create an object. In a singleton method’s body, the scope changes to the class itself, so you won’t be able to access your regular instance variables.
  • Enumerable A module which includes many specialized versions of each, like map & select.
  • Method A method is a way to encapsulate code & give it a name. In good code, methods have one responsibility, and the name describes what the methods does & now how it does it.
  • Class A class groups together a set of related methods & data. It’s like a blueprint that you can use to create new objects (like a Book or a ShoppingCart).
  • Module A module has two main roles: it can be used for name-spacing & it can be used to store methods. Modules can be included in classes to extend their functionality.
  • Local variable A variable that only exists within the context of the current method.
  • Instance variable A variable that only exists within the context of the current object.
  • Global variable A variable that is available anywhere. Should be avoided if possible because it makes code harder to maintain.
  • Inheritance In OOP (Object-Oriented Programming), this is the ability for classes to inherit behavior (methods) from a parent class, effectively creating parent-child relationships. In Ruby, it’s only possible to inherit from one class at a time, although it’s somewhat possible to overcome this limitation by using Modules.
  • Composition This is when you use other classes to use their methods. For a great example of this, you may want to research the strategy design pattern.

Database & Networking Terms

  • ORM Stands for Object-Relational Mapping. An ORM helps you work with a database (like MySQL or PostgreSQL) in a way that avoids most of the raw SQL code necessary.
  • MVC MVC stands for Model, View, Controller. It’s the architechture used by Rails to try to separate code.
  • SQL Stands for Structured-Query Language. A language used to send commands to a database (like MySQL or PostgreSQL), these commands could be used to read data, add new data, modify the database schema, get usage stats…
  • HTTP Stands for Hyper-Text Transfer Protocol. This is a plain-text protocol (HTTP v2 is binary) which is used for communication between web browsers & web servers.
  • TCP/IP This duo of protocols (TCP & IP) represent the majority of communications on the Internet. IP covers the presentation layer of the OSI model, while TCP covers the transport layer.
  • Interpreter In the context of programming languages, this refers to a program which translates source code into an intermediate language which is then executed via a Virtual Machine (like the JVM or YARV). A list of popular Ruby interpreters include: MRI, JRuby & Rubinius.
  • Thread A running program is composed of one process & one or more threads. A thread executes code. Every thread within a process can be working on different tasks, and although they can share data, it’s usually a source of issues like race conditions (one thread overwriting the work of another).
  • Cookie A bit of data stored in a web browser (typically in a text file or a SQLite database) where a session key & user preferences (like language selection) can be stored. Cookies are sent with every request that a web browser makes.

Ruby Specific Terms

  • Gem A gem represents a single package within the Ruby Gems ecosystem. It’s used to distribute & share code between Ruby developers. For example, you could create a “calculator” gem & upload it, then anyone could install that gem to use your calculator.
  • Exception An error that is raised when something unexpected happens. It will terminate the program unless it’s handled using the “rescue” keyword.
  • Lambda An anonymous method that is represented as a Proc object. Can be saved in a variable to be executed later. Note that this is affected by the “closure” effect.
  • REPL Read, Eval, Print, Loop. A technique which makes things like IRB & Pry possible. Read user input, evaluate this input, print it, then repeat.
  • Nil An object used to represent “nothing”. In a boolean context, it evaluates to false.
  • Spaceship operator The <=> method, which is used to compare two objects. It should return 1, 0 or -1.
  • Hash A data structure used to store key-value pairs. The keys & the values can be any Ruby object. One way to think about this is a dictionary: you can look up any word & find its definition. In a hash you can look up a key & find its value.
  • Truthy A value that is considered true when evaluated in a boolean context. In Ruby, everything is truthy, except nil & false.

Misc Terms

  • Test-Driven Development A programming technique where you write a failing test before the actual code & then write just as little code as possible to make the test pass.
  • Metaprogramming A technique & set of methods that allow you to get information about objects (like the class name, methods available…). It also allows you to create new methods dynamically & to respond to missing methods and constants.
  • Business Logic / Domain logic This is the logic for taking decisions about data & events. It determines how data is transformed and/or calculated. For example, in a video-game, if a player is a attacked by a monster, the game needs to decide what happens (calculate damage taken & maybe trigger other events).
  • SOLID A set of principles which guide the developer to produce better OOP (Object-Oriented Programming) code. S stands for Single-Responsibility Principle. O for the Open/Closed principle. L for the Liskov-substitution principle. I for the Interface segregation principle. And D for the Dependency Inversion principle.
  • Version control A system used to keep track of changes after every revision. One example of a version control tool is Git.