From 9d5c289a84ba56e1dafe5c563961842ae1804f77 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 11 Oct 2025 15:42:59 +0300 Subject: Update content for md --- about/resources.md | 198 +++++++++--------- gemfeed/2021-07-04-the-well-grounded-rubyist.md | 2 +- .../2025-10-11-the-well-grounded-rubyist-notes.md | 221 -------------------- ...key-takeaways-from-the-well-grounded-rubyist.md | 223 +++++++++++++++++++++ gemfeed/index.md | 2 +- index.md | 4 +- uptime-stats.md | 2 +- 7 files changed, 327 insertions(+), 325 deletions(-) delete mode 100644 gemfeed/2025-10-11-the-well-grounded-rubyist-notes.md create mode 100644 gemfeed/2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md diff --git a/about/resources.md b/about/resources.md index c94b18ad..f2a99305 100644 --- a/about/resources.md +++ b/about/resources.md @@ -35,107 +35,107 @@ You won't find any links on this site because, over time, the links will break. In random order: -* The DevOps Handbook; Gene Kim, Jez Humble, Patrick Debois, John Willis; Audible -* Programming Perl aka "The Camel Book"; Tom Christiansen, brian d foy, Larry Wall & Jon Orwant; O'Reilly -* Systemprogrammierung in Go; Frank Müller; dpunkt -* Object-Oriented Programming with ANSI-C; Axel-Tobias Schreiner -* Go Brain Teasers - Exercise Your Mind; Miki Tebeka; The Pragmatic Programmers -* Kubernetes Cookbook; Sameer Naik, Sébastien Goasguen, Jonathan Michaux; O'Reilly -* Funktionale Programmierung; Peter Pepper; Springer -* The Pragmatic Programmer; David Thomas; Addison-Wesley -* Learn You a Haskell for Great Good!; Miran Lipovaca; No Starch Press -* Perl New Features; Joshua McAdams, brian d foy; Perl School -* Effective Java; Joshua Bloch; Addison-Wesley Professional -* The Kubernetes Book; Nigel Poulton; Unabridged Audiobook +* 21st Century C: C Tips from the New School; Ben Klemens; O'Reilly +* Think Raku (aka Think Perl 6); Laurent Rosenfeld, Allen B. Downey; O'Reilly +* Hands-on Infrastructure Monitoring with Prometheus; Joel Bastos, Pedro Araujo; Packt +* Concurrency in Go; Katherine Cox-Buday; O'Reilly * 97 things every SRE should know; Emil Stolarsky, Jaime Woo; O'Reilly -* Clusterbau mit Linux-HA; Michael Schwartzkopff; O'Reilly -* 100 Go Mistakes and How to Avoid Them; Teiva Harsanyi; Manning Publications -* Polished Ruby Programming; Jeremy Evans; Packt Publishing -* Raku Recipes; J.J. Merelo; Apress -* Effective awk programming; Arnold Robbins; O'Reilly -* Programming Ruby 3.3 (5th Edition); Noel Rappin, with Dave Thomas; The Pragmatic Bookshelf -* Systems Performance Tuning; Gian-Paolo D. Musumeci and others...; O'Reilly -* The Practise of System and Network Administration; Thomas A. Limoncelli, Christina J. Hogan, Strata R. Chalup; Addison-Wesley Professional Pro Git; Scott Chacon, Ben Straub; Apress -* Pro Puppet; James Turnbull, Jeffrey McCune; Apress +* The Go Programming Language; Alan A. A. Donovan; Addison-Wesley Professional +* Systemprogrammierung in Go; Frank Müller; dpunkt * Developing Games in Java; David Brackeen and others...; New Riders +* Ultimate Go Notebook; Bill Kennedy +* Distributed Systems: Principles and Paradigms; Andrew S. Tanenbaum; Pearson +* Effective awk programming; Arnold Robbins; O'Reilly * Amazon Web Services in Action; Michael Wittig and Andreas Wittig; Manning Publications * Site Reliability Engineering; How Google runs production systems; O'Reilly -* 21st Century C: C Tips from the New School; Ben Klemens; O'Reilly * The Docker Book; James Turnbull; Kindle -* Java ist auch eine Insel; Christian Ullenboom; -* Ultimate Go Notebook; Bill Kennedy -* DevOps And Site Reliability Engineering Handbook; Stephen Fleming; Audible -* Distributed Systems: Principles and Paradigms; Andrew S. Tanenbaum; Pearson -* Terraform Cookbook; Mikael Krief; Packt Publishing * C++ Programming Language; Bjarne Stroustrup; -* Hands-on Infrastructure Monitoring with Prometheus; Joel Bastos, Pedro Araujo; Packt -* Leanring eBPF; Liz Rice; O'Reilly -* Think Raku (aka Think Perl 6); Laurent Rosenfeld, Allen B. Downey; O'Reilly -* Chaos Engineering - System Resiliency in Practice; Casey Rosenthal and Nora Jones; eBook -* Data Science at the Command Line; Jeroen Janssens; O'Reilly +* The Practise of System and Network Administration; Thomas A. Limoncelli, Christina J. Hogan, Strata R. Chalup; Addison-Wesley Professional Pro Git; Scott Chacon, Ben Straub; Apress +* Raku Fundamentals; Moritz Lenz; Apress +* Raku Recipes; J.J. Merelo; Apress +* The DevOps Handbook; Gene Kim, Jez Humble, Patrick Debois, John Willis; Audible +* Programming Perl aka "The Camel Book"; Tom Christiansen, brian d foy, Larry Wall & Jon Orwant; O'Reilly +* Terraform Cookbook; Mikael Krief; Packt Publishing +* Pro Puppet; James Turnbull, Jeffrey McCune; Apress +* Learn You a Haskell for Great Good!; Miran Lipovaca; No Starch Press +* Learn You Some Erlang for Great Good; Fred Herbert; No Starch Press +* Clusterbau mit Linux-HA; Michael Schwartzkopff; O'Reilly +* The KCNA (Kubernetes and Cloud Native Associate) Book; Nigel Poulton * DNS and BIND; Cricket Liu; O'Reilly * Higher Order Perl; Mark Dominus; Morgan Kaufmann -* Learn You Some Erlang for Great Good; Fred Herbert; No Starch Press -* Concurrency in Go; Katherine Cox-Buday; O'Reilly -* Raku Fundamentals; Moritz Lenz; Apress +* Object-Oriented Programming with ANSI-C; Axel-Tobias Schreiner +* Polished Ruby Programming; Jeremy Evans; Packt Publishing +* Perl New Features; Joshua McAdams, brian d foy; Perl School +* Systems Performance Tuning; Gian-Paolo D. Musumeci and others...; O'Reilly +* Programming Ruby 3.3 (5th Edition); Noel Rappin, with Dave Thomas; The Pragmatic Bookshelf +* Kubernetes Cookbook; Sameer Naik, Sébastien Goasguen, Jonathan Michaux; O'Reilly +* DevOps And Site Reliability Engineering Handbook; Stephen Fleming; Audible +* Chaos Engineering - System Resiliency in Practice; Casey Rosenthal and Nora Jones; eBook +* The Pragmatic Programmer; David Thomas; Addison-Wesley +* Leanring eBPF; Liz Rice; O'Reilly +* Funktionale Programmierung; Peter Pepper; Springer * Modern Perl; Chromatic ; Onyx Neon Press * Tmux 2: Productive Mouse-free Development; Brain P. Hogan; The Pragmatic Programmers -* The KCNA (Kubernetes and Cloud Native Associate) Book; Nigel Poulton -* The Go Programming Language; Alan A. A. Donovan; Addison-Wesley Professional +* 100 Go Mistakes and How to Avoid Them; Teiva Harsanyi; Manning Publications +* Java ist auch eine Insel; Christian Ullenboom; +* The Kubernetes Book; Nigel Poulton; Unabridged Audiobook +* Go Brain Teasers - Exercise Your Mind; Miki Tebeka; The Pragmatic Programmers +* Effective Java; Joshua Bloch; Addison-Wesley Professional +* Data Science at the Command Line; Jeroen Janssens; O'Reilly ## Technical references I didn't read them from the beginning to the end, but I am using them to look up things. The books are in random order: -* Groovy Kurz & Gut; Joerg Staudemeier; O'Reilly -* Relayd and Httpd Mastery; Michael W Lucas -* Go: Design Patterns for Real-World Projects; Mat Ryer; Packt * Understanding the Linux Kernel; Daniel P. Bovet, Marco Cesati; O'Reilly -* BPF Performance Tools - Linux System and Application Observability, Brendan Gregg; Addison Wesley -* The Linux Programming Interface; Michael Kerrisk; No Starch Press * Implementing Service Level Objectives; Alex Hidalgo; O'Reilly * Algorithms; Robert Sedgewick, Kevin Wayne; Addison Wesley +* Groovy Kurz & Gut; Joerg Staudemeier; O'Reilly +* The Linux Programming Interface; Michael Kerrisk; No Starch Press +* Relayd and Httpd Mastery; Michael W Lucas +* BPF Performance Tools - Linux System and Application Observability, Brendan Gregg; Addison Wesley +* Go: Design Patterns for Real-World Projects; Mat Ryer; Packt ## Self-development and soft-skills books In random order: -* Consciousness: A Very Short Introduction; Susan Blackmore; Oxford Uiversity Press * The Joy of Missing Out; Christina Crook; New Society Publishers -* Psycho-Cybernetics; Maxwell Maltz; Perigee Books -* The Good Enough Job; Simone Stolzoff; Ebury Edge -* Soft Skills; John Sommez; Manning Publications -* 97 Things Every Engineering Manager Should Know; Camille Fournier; Audiobook -* Deep Work; Cal Newport; Piatkus -* Search Inside Yourself - The Unexpected path to Achieving Success, Happiness (and World Peace); Chade-Meng Tan, Daniel Goleman, Jon Kabat-Zinn; HarperOne -* Solve for Happy; Mo Gawdat (RE-READ 1ST TIME) -* Buddah and Einstein walk into a Bar; Guy Joseph Ale, Claire Bloom; Blackstone Publishing * Meditation for Mortals, Oliver Burkeman, Audiobook -* Influence without Authority; A. Cohen, D. Bradford; Wiley -* Time Management for System Administrators; Thomas A. Limoncelli; O'Reilly -* The Obstacle Is The Way; Ryan Holiday; Profile Books Ltd -* Ultralearning; Scott Young; Thorsons -* Stop starting, start finishing; Arne Roock; Lean-Kanban University +* Deep Work; Cal Newport; Piatkus +* The Good Enough Job; Simone Stolzoff; Ebury Edge +* Who Moved My Cheese?; Dr. Spencer Johnson; Vermilion +* Psycho-Cybernetics; Maxwell Maltz; Perigee Books +* Staff Engineer: Leadership beyond the management track; Will Larson; Audiobook +* So Good They Can't Ignore You; Cal Newport; Business Plus * The Phoenix Project - A Novel About IT, DevOps, and Helping your Business Win; Gene Kim and Kevin Behr; Trade Select -* The Off Switch; Mark Cropley; Virgin Books (RE-READ 1ST TIME) * The Daily Stoic; Ryan Holiday, Stephen Hanselman; Profile Books +* Stop starting, start finishing; Arne Roock; Lean-Kanban University +* The Obstacle Is The Way; Ryan Holiday; Profile Books Ltd +* 101 Essays that change the way you think; Brianna Wiest; Audiobook +* Consciousness: A Very Short Introduction; Susan Blackmore; Oxford Uiversity Press +* Never Split the Difference; Chris Voss, Tahl Raz; Random House Business +* Getting Things Done; David Allen * The Bullet Journal Method; Ryder Carroll; Fourth Estate -* Staff Engineer: Leadership beyond the management track; Will Larson; Audiobook * Eat That Frog!; Brian Tracy; Hodder Paperbacks +* Ultralearning; Anna Laurent; Self-published via Amazon * Eat That Frog; Brian Tracy -* Who Moved My Cheese?; Dr. Spencer Johnson; Vermilion -* The 7 Habits Of Highly Effective People; Stephen R. Covey; Simon & Schuster UK * Digital Minimalism; Cal Newport; Portofolio Penguin +* The 7 Habits Of Highly Effective People; Stephen R. Covey; Simon & Schuster UK +* Time Management for System Administrators; Thomas A. Limoncelli; O'Reilly +* Influence without Authority; A. Cohen, D. Bradford; Wiley * The Complete Software Developer's Career Guide; John Sonmez; Unabridged Audiobook -* Coders at Work - Reflections on the craft of programming, Peter Seibel and Mitchell Dorian et al., Audiobook -* Never Split the Difference; Chris Voss, Tahl Raz; Random House Business -* 101 Essays that change the way you think; Brianna Wiest; Audiobook -* So Good They Can't Ignore You; Cal Newport; Business Plus -* Atomic Habits; James Clear; Random House Business * The Power of Now; Eckhard Tolle; Yellow Kite -* Getting Things Done; David Allen +* Solve for Happy; Mo Gawdat (RE-READ 1ST TIME) +* Buddah and Einstein walk into a Bar; Guy Joseph Ale, Claire Bloom; Blackstone Publishing +* 97 Things Every Engineering Manager Should Know; Camille Fournier; Audiobook +* Coders at Work - Reflections on the craft of programming, Peter Seibel and Mitchell Dorian et al., Audiobook +* Ultralearning; Scott Young; Thorsons +* Search Inside Yourself - The Unexpected path to Achieving Success, Happiness (and World Peace); Chade-Meng Tan, Daniel Goleman, Jon Kabat-Zinn; HarperOne +* Soft Skills; John Sommez; Manning Publications +* The Off Switch; Mark Cropley; Virgin Books (RE-READ 1ST TIME) * Slow Productivity; Cal Newport; Penguin Random House -* Ultralearning; Anna Laurent; Self-published via Amazon +* Atomic Habits; James Clear; Random House Business [Here are notes of mine for some of the books](../notes/index.md) @@ -143,22 +143,22 @@ In random order: Some of these were in-person with exams; others were online learning lectures only. In random order: -* Structure and Interpretation of Computer Programs; Harold Abelson and more...; -* Cloud Operations on AWS - Learn how to configure, deploy, maintain, and troubleshoot your AWS environments; 3-day online live training with labs; Amazon +* Developing IaC with Terraform (with Live Lessons); O'Reilly Online +* Protocol buffers; O'Reilly Online +* Ultimate Go Programming; Bill Kennedy; O'Reilly Online * F5 Loadbalancers Training; 2-day on-site training; F5, Inc. +* AWS Immersion Day; Amazon; 1-day interactive online training +* Functional programming lecture; Remote University of Hagen * The Ultimate Kubernetes Bootcamp; School of Devops; O'Reilly Online * Linux Security and Isolation APIs Training; Michael Kerrisk; 3-day on-site training -* Developing IaC with Terraform (with Live Lessons); O'Reilly Online -* Scripting Vim; Damian Conway; O'Reilly Online -* AWS Immersion Day; Amazon; 1-day interactive online training +* Cloud Operations on AWS - Learn how to configure, deploy, maintain, and troubleshoot your AWS environments; 3-day online live training with labs; Amazon * Algorithms Video Lectures; Robert Sedgewick; O'Reilly Online -* Ultimate Go Programming; Bill Kennedy; O'Reilly Online -* The Well-Grounded Rubyist Video Edition; David. A. Black; O'Reilly Online +* Structure and Interpretation of Computer Programs; Harold Abelson and more...; * Red Hat Certified System Administrator; Course + certification (Although I had the option, I decided not to take the next course as it is more effective to self learn what I need) +* The Well-Grounded Rubyist Video Edition; David. A. Black; O'Reilly Online * MySQL Deep Dive Workshop; 2-day on-site training * Apache Tomcat Best Practises; 3-day on-site training -* Protocol buffers; O'Reilly Online -* Functional programming lecture; Remote University of Hagen +* Scripting Vim; Damian Conway; O'Reilly Online ## Technical guides @@ -174,58 +174,58 @@ These are not whole books, but guides (smaller or larger) which I found very use In random order: -* The Changelog Podcast(s) -* Maintainable +* The Pragmatic Engineer Podcast +* Deep Questions with Cal Newport +* Dev Interrupted * Fork Around And Find Out * Wednesday Wisdom -* Dev Interrupted -* Cup o' Go [Golang] -* BSD Now [BSD] -* The Pragmatic Engineer Podcast +* Modern Mentor +* Pratical AI * Fallthrough [Golang] -* Deep Questions with Cal Newport +* Maintainable +* Cup o' Go [Golang] * Hidden Brain -* Modern Mentor +* The Changelog Podcast(s) +* BSD Now [BSD] * The ProdCast (Google SRE Podcast) -* Pratical AI * Backend Banter ### Podcasts I liked I liked them but am not listening to them anymore. The podcasts have either "finished" (no more episodes) or I stopped listening to them due to time constraints or a shift in my interests. -* Java Pub House -* Ship It (predecessor of Fork Around And Find Out) -* Modern Mentor -* FLOSS weekly * Go Time (predecessor of fallthrough) * CRE: Chaosradio Express [german] +* Java Pub House +* FLOSS weekly +* Modern Mentor +* Ship It (predecessor of Fork Around And Find Out) ## Newsletters I like This is a mix of tech and non-tech newsletters I am subscribed to. In random order: -* VK Newsletter +* Applied Go Weekly Newsletter +* Register Spill * Ruby Weekly * byteSizeGo -* Register Spill -* Applied Go Weekly Newsletter -* The Imperfectionist -* Monospace Mentor -* The Valuable Dev +* VK Newsletter * Andreas Brandhorst Newsletter (Sci-Fi author) -* The Pragmatic Engineer -* Golang Weekly * Changelog News +* Monospace Mentor +* Golang Weekly +* The Imperfectionist +* The Pragmatic Engineer +* The Valuable Dev ## Magazines I like(d) This is a mix of tech I like(d). I may not be a current subscriber, but now and then, I buy an issue. In random order: -* freeX (not published anymore) * Linux User -* Linux Magazine * LWN (online only) +* Linux Magazine +* freeX (not published anymore) # Formal education diff --git a/gemfeed/2021-07-04-the-well-grounded-rubyist.md b/gemfeed/2021-07-04-the-well-grounded-rubyist.md index 6f5accc0..0c435f41 100644 --- a/gemfeed/2021-07-04-the-well-grounded-rubyist.md +++ b/gemfeed/2021-07-04-the-well-grounded-rubyist.md @@ -120,7 +120,7 @@ E-Mail your comments to `paul@nospam.buetow.org` :-) Other Ruby-related posts: -[2025-10-11 Key Takeaways from The Well-Grounded Rubyist](./2025-10-11-the-well-grounded-rubyist-notes.md) +[2025-11-11 Key Takeaways from The Well-Grounded Rubyist](./2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md) [2021-07-04 The Well-Grounded Rubyist (You are currently reading this)](./2021-07-04-the-well-grounded-rubyist.md) [Back to the main site](../) diff --git a/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.md b/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.md deleted file mode 100644 index e32fb70e..00000000 --- a/gemfeed/2025-10-11-the-well-grounded-rubyist-notes.md +++ /dev/null @@ -1,221 +0,0 @@ -# Key Takeaways from The Well-Grounded Rubyist - -> Published at 2025-10-11T15:25:14+03:00 - -Some time ago, I wrote about my journey into Ruby and how "The Well-Grounded Rubyist" helped me to get a better understanding of the language. I took a lot of notes while reading the book, and I think it's time to share some of them. This is not a comprehensive review, but rather a collection of interesting tidbits and concepts that stuck with me. - -## Table of Contents - -* [⇢ Key Takeaways from The Well-Grounded Rubyist](#key-takeaways-from-the-well-grounded-rubyist) -* [⇢ ⇢ The Object Model](#the-object-model) -* [⇢ ⇢ ⇢ Everything is an object (almost)](#everything-is-an-object-almost) -* [⇢ ⇢ ⇢ The `self` keyword](#the-self-keyword) -* [⇢ ⇢ ⇢ Singleton Methods](#singleton-methods) -* [⇢ ⇢ ⇢ Classes are Objects](#classes-are-objects) -* [⇢ ⇢ Control Flow and Methods](#control-flow-and-methods) -* [⇢ ⇢ ⇢ `case` and the `===` operator](#case-and-the--operator) -* [⇢ ⇢ ⇢ Blocks and `yield`](#blocks-and-yield) -* [⇢ ⇢ Fun with Data Types](#fun-with-data-types) -* [⇢ ⇢ ⇢ Symbols](#symbols) -* [⇢ ⇢ ⇢ Arrays and Hashes](#arrays-and-hashes) -* [⇢ ⇢ Final Thoughts](#final-thoughts) - -[My first post about the book.](./2021-07-04-the-well-grounded-rubyist.md) - -## The Object Model - -One of the most fascinating aspects of Ruby is its object model. The book does a great job of explaining the details. - -### Everything is an object (almost) - -In Ruby, most things are objects. This includes numbers, strings, and even classes themselves. This has some interesting consequences. For example, you can't use `i++` like in C or Java. Integers are immutable objects. `1` is always the same object. `1 + 1` returns a new object, `2`. - -### The `self` keyword - -There is always a current object, `self`. If you call a method without an explicit receiver, it's called on `self`. For example, `puts "hello"` is actually `self.puts "hello"`. - -```ruby -# At the top level, self is the main object -p self -# => main -p self.class -# => Object - -def foo - # Inside a method, self is the object that received the call - p self -end - -foo -# => main -``` - -This code demonstrates how `self` changes depending on the context. At the top level, it's `main`, an instance of `Object`. When `foo` is called without a receiver, it's called on `main`. - -### Singleton Methods - -You can add methods to individual objects. These are called singleton methods. - -```ruby -obj = "a string" - -def obj.shout - self.upcase + "!" -end - -p obj.shout -# => "A STRING!" - -obj2 = "another string" -# obj2.shout would raise a NoMethodError -``` - -Here, the `shout` method is only available on the `obj` object. This is a powerful feature for adding behavior to specific instances. - -### Classes are Objects - -Classes themselves are objects, instances of the `Class` class. This means you can create classes dynamically. - -```ruby -MyClass = Class.new do - def say_hello - puts "Hello from a dynamically created class!" - end -end - -instance = MyClass.new -instance.say_hello -# => Hello from a dynamically created class! -``` - -This shows how to create a new class and assign it to a constant. This is what happens behind the scenes when you use the `class` keyword. - -## Control Flow and Methods - -The book clarified many things about how methods and control flow work in Ruby. - -### `case` and the `===` operator - -The `case` statement is more powerful than I thought. It uses the `===` (threequals or case equality) operator for comparison, not `==`. Different classes can implement `===` in their own way. - -```ruby -# For ranges, it checks for inclusion -p (1..5) === 3 # => true - -# For classes, it checks if the object is an instance of the class -p String === "hello" # => true - -# For regexes, it checks for a match -p /llo/ === "hello" # => true - -def check(value) - case value - when String - "It's a string" - when (1..10) - "It's a number between 1 and 10" - else - "Something else" - end -end - -p check(5) # => "It's a number between 1 and 10" -``` - -### Blocks and `yield` - -Blocks are a cornerstone of Ruby. You can pass them to methods to customize their behavior. The `yield` keyword is used to call the block. - -```ruby -def my_iterator - puts "Entering the method" - yield - puts "Back in the method" - yield -end - -my_iterator { puts "Inside the block" } -# Entering the method -# Inside the block -# Back in the method -# Inside the block -``` - -This simple iterator shows how `yield` transfers control to the block. You can also pass arguments to `yield` and get a return value from the block. - -```ruby -def with_return - result = yield(5) - puts "The block returned #{result}" -end - -with_return { |n| n * 2 } -# => The block returned 10 -``` - -This demonstrates passing an argument to the block and using its return value. - -## Fun with Data Types - -Ruby's core data types are full of nice little features. - -### Symbols - -Symbols are like immutable strings. They are great for keys in hashes because they are unique and memory-efficient. - -```ruby -# Two strings with the same content are different objects -p "foo".object_id -p "foo".object_id - -# Two symbols with the same content are the same object -p :foo.object_id -p :foo.object_id - -# Modern hash syntax uses symbols as keys -my_hash = { name: "Paul", language: "Ruby" } -p my_hash[:name] # => "Paul" -``` - -This code highlights the difference between strings and symbols and shows the convenient hash syntax. - -### Arrays and Hashes - -Arrays and hashes have a rich API. The `%w` and `%i` shortcuts for creating arrays of strings and symbols are very handy. - -```ruby -# Array of strings -p %w[one two three] -# => ["one", "two", "three"] - -# Array of symbols -p %i[one two three] -# => [:one, :two, :three] -``` - -A quick way to create arrays. You can also retrieve multiple values at once. - -```ruby -arr = [10, 20, 30, 40, 50] -p arr.values_at(0, 2, 4) -# => [10, 30, 50] - -hash = { a: 1, b: 2, c: 3 } -p hash.values_at(:a, :c) -# => [1, 3] -``` - -The `values_at` method is a concise way to get multiple elements. - -## Final Thoughts - -These are just a few of the many things I learned from "The Well-Grounded Rubyist". The book gave me a much deeper appreciation for the language and its design. If you are a Ruby programmer, I highly recommend it. Meanwhile, I also read the book "Programming Ruby 3.3", just I didn't have time to process my notes there yet. - -E-Mail your comments to `paul@nospam.buetow.org` :-) - -Other Ruby-related posts: - -[2025-10-11 Key Takeaways from The Well-Grounded Rubyist (You are currently reading this)](./2025-10-11-the-well-grounded-rubyist-notes.md) -[2021-07-04 The Well-Grounded Rubyist](./2021-07-04-the-well-grounded-rubyist.md) - -[Back to the main site](../) diff --git a/gemfeed/2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md b/gemfeed/2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md new file mode 100644 index 00000000..758f7cb5 --- /dev/null +++ b/gemfeed/2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md @@ -0,0 +1,223 @@ +# Key Takeaways from The Well-Grounded Rubyist + +> Published at 2025-10-11T15:25:14+03:00 + +Some time ago, I wrote about my journey into Ruby and how "The Well-Grounded Rubyist" helped me to get a better understanding of the language. I took a lot of notes while reading the book, and I think it's time to share some of them. This is not a comprehensive review, but rather a collection of interesting tidbits and concepts that stuck with me. + +## Table of Contents + +* [⇢ Key Takeaways from The Well-Grounded Rubyist](#key-takeaways-from-the-well-grounded-rubyist) +* [⇢ ⇢ The Object Model](#the-object-model) +* [⇢ ⇢ ⇢ Everything is an object (almost)](#everything-is-an-object-almost) +* [⇢ ⇢ ⇢ The `self` keyword](#the-self-keyword) +* [⇢ ⇢ ⇢ Singleton Methods](#singleton-methods) +* [⇢ ⇢ ⇢ Classes are Objects](#classes-are-objects) +* [⇢ ⇢ Control Flow and Methods](#control-flow-and-methods) +* [⇢ ⇢ ⇢ `case` and the `===` operator](#case-and-the--operator) +* [⇢ ⇢ ⇢ Blocks and `yield`](#blocks-and-yield) +* [⇢ ⇢ Fun with Data Types](#fun-with-data-types) +* [⇢ ⇢ ⇢ Symbols](#symbols) +* [⇢ ⇢ ⇢ Arrays and Hashes](#arrays-and-hashes) +* [⇢ ⇢ Final Thoughts](#final-thoughts) + +[My first post about the book.](./2021-07-04-the-well-grounded-rubyist.md) + +[![./the-well-grounded-rubyist/book-cover.jpg](./the-well-grounded-rubyist/book-cover.jpg)](./the-well-grounded-rubyist/book-cover.jpg) + +## The Object Model + +One of the most fascinating aspects of Ruby is its object model. The book does a great job of explaining the details. + +### Everything is an object (almost) + +In Ruby, most things are objects. This includes numbers, strings, and even classes themselves. This has some interesting consequences. For example, you can't use `i++` like in C or Java. Integers are immutable objects. `1` is always the same object. `1 + 1` returns a new object, `2`. + +### The `self` keyword + +There is always a current object, `self`. If you call a method without an explicit receiver, it's called on `self`. For example, `puts "hello"` is actually `self.puts "hello"`. + +```ruby +# At the top level, self is the main object +p self +# => main +p self.class +# => Object + +def foo + # Inside a method, self is the object that received the call + p self +end + +foo +# => main +``` + +This code demonstrates how `self` changes depending on the context. At the top level, it's `main`, an instance of `Object`. When `foo` is called without a receiver, it's called on `main`. + +### Singleton Methods + +You can add methods to individual objects. These are called singleton methods. + +```ruby +obj = "a string" + +def obj.shout + self.upcase + "!" +end + +p obj.shout +# => "A STRING!" + +obj2 = "another string" +# obj2.shout would raise a NoMethodError +``` + +Here, the `shout` method is only available on the `obj` object. This is a powerful feature for adding behavior to specific instances. + +### Classes are Objects + +Classes themselves are objects, instances of the `Class` class. This means you can create classes dynamically. + +```ruby +MyClass = Class.new do + def say_hello + puts "Hello from a dynamically created class!" + end +end + +instance = MyClass.new +instance.say_hello +# => Hello from a dynamically created class! +``` + +This shows how to create a new class and assign it to a constant. This is what happens behind the scenes when you use the `class` keyword. + +## Control Flow and Methods + +The book clarified many things about how methods and control flow work in Ruby. + +### `case` and the `===` operator + +The `case` statement is more powerful than I thought. It uses the `===` (threequals or case equality) operator for comparison, not `==`. Different classes can implement `===` in their own way. + +```ruby +# For ranges, it checks for inclusion +p (1..5) === 3 # => true + +# For classes, it checks if the object is an instance of the class +p String === "hello" # => true + +# For regexes, it checks for a match +p /llo/ === "hello" # => true + +def check(value) + case value + when String + "It's a string" + when (1..10) + "It's a number between 1 and 10" + else + "Something else" + end +end + +p check(5) # => "It's a number between 1 and 10" +``` + +### Blocks and `yield` + +Blocks are a cornerstone of Ruby. You can pass them to methods to customize their behavior. The `yield` keyword is used to call the block. + +```ruby +def my_iterator + puts "Entering the method" + yield + puts "Back in the method" + yield +end + +my_iterator { puts "Inside the block" } +# Entering the method +# Inside the block +# Back in the method +# Inside the block +``` + +This simple iterator shows how `yield` transfers control to the block. You can also pass arguments to `yield` and get a return value from the block. + +```ruby +def with_return + result = yield(5) + puts "The block returned #{result}" +end + +with_return { |n| n * 2 } +# => The block returned 10 +``` + +This demonstrates passing an argument to the block and using its return value. + +## Fun with Data Types + +Ruby's core data types are full of nice little features. + +### Symbols + +Symbols are like immutable strings. They are great for keys in hashes because they are unique and memory-efficient. + +```ruby +# Two strings with the same content are different objects +p "foo".object_id +p "foo".object_id + +# Two symbols with the same content are the same object +p :foo.object_id +p :foo.object_id + +# Modern hash syntax uses symbols as keys +my_hash = { name: "Paul", language: "Ruby" } +p my_hash[:name] # => "Paul" +``` + +This code highlights the difference between strings and symbols and shows the convenient hash syntax. + +### Arrays and Hashes + +Arrays and hashes have a rich API. The `%w` and `%i` shortcuts for creating arrays of strings and symbols are very handy. + +```ruby +# Array of strings +p %w[one two three] +# => ["one", "two", "three"] + +# Array of symbols +p %i[one two three] +# => [:one, :two, :three] +``` + +A quick way to create arrays. You can also retrieve multiple values at once. + +```ruby +arr = [10, 20, 30, 40, 50] +p arr.values_at(0, 2, 4) +# => [10, 30, 50] + +hash = { a: 1, b: 2, c: 3 } +p hash.values_at(:a, :c) +# => [1, 3] +``` + +The `values_at` method is a concise way to get multiple elements. + +## Final Thoughts + +These are just a few of the many things I learned from "The Well-Grounded Rubyist". The book gave me a much deeper appreciation for the language and its design. If you are a Ruby programmer, I highly recommend it. Meanwhile, I also read the book "Programming Ruby 3.3", just I didn't have time to process my notes there yet. + +E-Mail your comments to `paul@nospam.buetow.org` :-) + +Other Ruby-related posts: + +[2025-11-11 Key Takeaways from The Well-Grounded Rubyist (You are currently reading this)](./2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md) +[2021-07-04 The Well-Grounded Rubyist](./2021-07-04-the-well-grounded-rubyist.md) + +[Back to the main site](../) diff --git a/gemfeed/index.md b/gemfeed/index.md index 72f7530c..531e8cde 100644 --- a/gemfeed/index.md +++ b/gemfeed/index.md @@ -2,7 +2,7 @@ ## To be in the .zone! -[2025-10-11 - Key Takeaways from The Well-Grounded Rubyist](./2025-10-11-the-well-grounded-rubyist-notes.md) +[2025-11-11 - Key Takeaways from The Well-Grounded Rubyist](./2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md) [2025-10-02 - f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments](./2025-10-02-f3s-kubernetes-with-freebsd-part-7.md) [2025-09-14 - Bash Golf Part 4](./2025-09-14-bash-golf-part-4.md) [2025-08-15 - Random Weird Things - Part Ⅲ](./2025-08-15-random-weird-things-iii.md) diff --git a/index.md b/index.md index a79c7731..eabecaad 100644 --- a/index.md +++ b/index.md @@ -1,6 +1,6 @@ # Hello! -> This site was generated at 2025-10-11T15:30:19+03:00 by `Gemtexter` +> This site was generated at 2025-10-11T15:41:33+03:00 by `Gemtexter` Welcome to the foo.zone! @@ -38,7 +38,7 @@ Everything you read on this site is my personal opinion and experience. You can ### Posts -[2025-10-11 - Key Takeaways from The Well-Grounded Rubyist](./gemfeed/2025-10-11-the-well-grounded-rubyist-notes.md) +[2025-11-11 - Key Takeaways from The Well-Grounded Rubyist](./gemfeed/2025-11-11-key-takeaways-from-the-well-grounded-rubyist.md) [2025-10-02 - f3s: Kubernetes with FreeBSD - Part 7: k3s and first pod deployments](./gemfeed/2025-10-02-f3s-kubernetes-with-freebsd-part-7.md) [2025-09-14 - Bash Golf Part 4](./gemfeed/2025-09-14-bash-golf-part-4.md) [2025-08-15 - Random Weird Things - Part Ⅲ](./gemfeed/2025-08-15-random-weird-things-iii.md) diff --git a/uptime-stats.md b/uptime-stats.md index cd78e6a3..5d815bd1 100644 --- a/uptime-stats.md +++ b/uptime-stats.md @@ -1,6 +1,6 @@ # My machine uptime stats -> This site was last updated at 2025-10-11T15:30:19+03:00 +> This site was last updated at 2025-10-11T15:41:33+03:00 The following stats were collected via `uptimed` on all of my personal computers over many years and the output was generated by `guprecords`, the global uptime records stats analyser of mine. -- cgit v1.2.3