Saltar al contenido ForoHackers

Ruby: start here

Ruby
#3071 · · Citar · Denunciar

Ruby is a dynamic, object-oriented language designed to make programmers happy. It reads almost like prose, treats everything as an object and bends easily into small domain-specific languages. It is known for web development, scripting and tooling, and for a culture that values readable code, testing and convention over configuration.

Key concepts

  • Everything is an object: numbers, strings and classes all respond to messages.
  • Blocks and iterators: code passed to a method, the heart of loops, callbacks and resource handling.
  • Open classes and modules: classes can be reopened, and modules add shared behaviour as mixins.
  • Duck typing: what matters is what an object responds to, not its class.
  • Metaprogramming: methods can be defined, intercepted and inspected at run time.
  • Gems and bundler: libraries are packaged as gems, with dependencies pinned per project.

Vocabulary

  • Symbol: a lightweight, immutable name such as :id, used for keys.
  • Mixin: a module whose methods are added to a class.
  • Proc and lambda: objects that wrap a block of code.
  • Idiom: the habitual Ruby way to write something, such as each rather than a counting loop.

What to study, in order

  1. Basic syntax, strings, arrays and hashes, in the interactive shell.
  2. Methods, blocks, and the Enumerable methods such as map and select.
  3. Classes, modules, mixins and how method lookup works.
  4. Write a command-line tool with tests, and package it as a gem.
  5. Metaprogramming in small doses: define methods dynamically and read a library's source.
  6. A web application with a framework, once the language is comfortable.

Related tags

#interpreters #web-frameworks #backend #testing

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder