---
title: "Meaning & Key Takeaway of: When Ruby programmers say that some class…"
description: "\"“When Ruby programmers say that some class “quacks like an Array,” they usually mean that it’s not necessarily an Array nor a descendant of Array, but ..."
image: "https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg"
---

#  When Ruby programmers say that some class “quacks like an…

![“When Ruby programmers say that some class “quacks like an Array,” they usually mean that it’s not necessarily an Array nor a descendant of Array, but it responds to most of the same methods as Array and can therefore be used wherever an Array would be used.” quote by Armando Fox](https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg)   [Download](https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg) [Open image](https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg)

> ““When Ruby programmers say that some class “quacks like an Array,” they usually mean that it’s not necessarily an Array nor a descendant of Array, but it responds to most of the same methods as Array and can therefore be used wherever an Array would be used.””

[Armando Fox](https://sms4smile.com/quotes/author/armando-fox/)

## About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

A class can be used like an Array if it implements the same methods, even without inheriting from Array.

**In simple terms:** Non‑Array class can act like an Array by matching its interface.

Key Takeaway

Design objects to match required interfaces.

Themes

polymorphism interface software design

Mood

technical analytical

Type

educational explanatory

When to use this quote

- API design
- library usage
- code reuse
- testing
- refactoring

Key Concepts

duck typing method compatibility

Questions to Reflect On

- What methods must your class implement to be interchangeable?
- How does duck typing affect code safety?

A Different Perspective

If the class lacks subtle Array behaviors, substitution may fail.

★ ★ ★ ★ ★   No ratings yet

[Array Responds](https://sms4smile.com/quotes/about/array-responds-1323712/) [Array Usually](https://sms4smile.com/quotes/about/array-usually-1323711/) [Like Array](https://sms4smile.com/quotes/about/like-array-1323715/) [Methods Array](https://sms4smile.com/quotes/about/methods-array-1323713/) [Necessarily Array](https://sms4smile.com/quotes/about/necessarily-array-1323714/) [Programming](https://sms4smile.com/quotes/about/programming/) [Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [Of everything I have done, 'The Archers' always gets the most excitement; there's a sort of uncontrollable joy from fans of the program.](https://sms4smile.com/quotes/felicity-jones/of-everything-i-have-done-the-archers-always-gets-the-most-excitement/)

[Felicity Jones](https://sms4smile.com/quotes/author/felicity-jones/)

> [I kind of pride myself on coming onto things that are well-oiled machines and finding a way to bring what I bring and fit…](https://sms4smile.com/quotes/rob-lowe/i-kind-of-pride-myself-on-coming-onto-things-that-are-well-oiled/)

[Rob Lowe](https://sms4smile.com/quotes/author/rob-lowe/)

> [I loved 'Chicago Code;' I watched that a lot. It was great because it really captured the city - I'm from Chicago, too.](https://sms4smile.com/quotes/jessy-schram/i-loved-chicago-code-i-watched-that-a-lot-it-was-great-because-it/)

[Jessy Schram](https://sms4smile.com/quotes/author/jessy-schram/)

> [A lot of the kids gave a lot of positive feedback about if I ever became a coach, they would love to play in…](https://sms4smile.com/quotes/penny-hardaway/a-lot-of-the-kids-gave-a-lot-of-positive-feedback-about-if-i-ever/)

[Penny Hardaway](https://sms4smile.com/quotes/author/penny-hardaway/)

> [It would be a piece of ingenuousness to accuse the man of today of his lack of moral code. The accusation would leave him…](https://sms4smile.com/quotes/jose-ortega-y-gasset/it-would-be-a-piece-of-ingenuousness-to-accuse-the-man-of-today-of/)

[Jose Ortega y Gasset](https://sms4smile.com/quotes/author/jose-ortega-y-gasset/)

> [With VR, we have this same vision, which is create this ultimate platform for sharing your imagination. Our huge community of 300,000 developers creates…](https://sms4smile.com/quotes/david-baszucki/with-vr-we-have-this-same-vision-which-is-create-this-ultimate/)

[David Baszucki](https://sms4smile.com/quotes/author/david-baszucki/)

> [I'm publicist, patron of nine charities, creative director, food consultant, recipe developer - and mum.](https://sms4smile.com/quotes/jack-monroe/i-m-publicist-patron-of-nine-charities-creative-director-food/)

[Jack Monroe](https://sms4smile.com/quotes/author/jack-monroe/)

> [Limit use of shareware and public domain software to systems without fixed disks. If you do use them on fixed disks, allocate separate subdirectories...…](https://sms4smile.com/quotes/john-mcafee/limit-use-of-shareware-and-public-domain-software-to-systems-without/)

[John McAfee](https://sms4smile.com/quotes/author/john-mcafee/)

> [Writing code means always having to say you're sorry.](https://sms4smile.com/quotes/paul-ford/writing-code-means-always-having-to-say-you-re-sorry/)

[Paul Ford](https://sms4smile.com/quotes/author/paul-ford/)

> [One of my most productive days was throwing away 1,000 lines of code.](https://sms4smile.com/quotes/ken-thompson/one-of-my-most-productive-days-was-throwing-away-1-000-lines-of-code/)

[Ken Thompson](https://sms4smile.com/quotes/author/ken-thompson/)

> [Programmers are always surrounded by complexity; we cannot avoid it… If our basic tool, the language in which we design and code our programs,…](https://sms4smile.com/quotes/tony-hoare/programmers-are-always-surrounded-by-complexity-we-cannot-avoid-it-if/)

[Tony Hoare](https://sms4smile.com/quotes/author/tony-hoare/)

> [“Check the program before you two start undressing and...well, doing whatever freaky shit you talked Harley into.” I”](https://sms4smile.com/quotes/james-cox/check-the-program-before-you-two-start-undressing-and-well-doing/)

[James Cox](https://sms4smile.com/quotes/author/james-cox/)

> [It is no secret that I have read 'The Da Vinci Code' several times. I genuinely believe that 'The Da Vinci Code' and 'Angels…](https://sms4smile.com/quotes/ashwin-sanghi/it-is-no-secret-that-i-have-read-the-da-vinci-code-several-times-i/)

[Ashwin Sanghi](https://sms4smile.com/quotes/author/ashwin-sanghi/)

> [When we shipped 'Borderlands 2,' we didn't ship it with a plan of how the level cap was going to increase. We didn't have…](https://sms4smile.com/quotes/randy-pitchford/when-we-shipped-borderlands-2-we-didn-t-ship-it-with-a-plan-of-how/)

[Randy Pitchford](https://sms4smile.com/quotes/author/randy-pitchford/)

> [“By rendering the model in ASN.1, the NCBI created a system that combined objects (DNA sequences, protein sequences, references, sequence features) from a variety…](https://sms4smile.com/quotes/anonymous/by-rendering-the-model-in-asn-1-the-ncbi-created-a-system-that/)

[Anonymous](https://sms4smile.com/quotes/author/anonymous/)

## More by Armando Fox

> [“The five letters of the SOLID acronym stand for: Single Responsibility Principle: a class should have one and only one responsibility; that is, only…](https://sms4smile.com/quotes/armando-fox/the-five-letters-of-the-solid-acronym-stand-for-single-responsibility/)

[Armando Fox](https://sms4smile.com/quotes/author/armando-fox/)

> [“if you cannot describe the responsibility of a class in 25 words or less, it may have more than one responsibility, and the new…](https://sms4smile.com/quotes/armando-fox/if-you-cannot-describe-the-responsibility-of-a-class-in-25-words-or/)

[Armando Fox](https://sms4smile.com/quotes/author/armando-fox/)

> [“The purpose of velocity is to give all stakeholders an idea how many iterations it will take a team to add the desired set…](https://sms4smile.com/quotes/armando-fox/the-purpose-of-velocity-is-to-give-all-stakeholders-an-idea-how-many/)

[Armando Fox](https://sms4smile.com/quotes/author/armando-fox/)

[Explore all 4 Armando Fox quotes ](https://sms4smile.com/quotes/author/armando-fox/)

## More Programming quotes

> [Of everything I have done, 'The Archers' always gets the most excitement; there's a sort of uncontrollable joy from fans of the program.](https://sms4smile.com/quotes/felicity-jones/of-everything-i-have-done-the-archers-always-gets-the-most-excitement/)

[Felicity Jones](https://sms4smile.com/quotes/author/felicity-jones/)

> [When we shipped 'Borderlands 2,' we didn't ship it with a plan of how the level cap was going to increase. We didn't have…](https://sms4smile.com/quotes/randy-pitchford/when-we-shipped-borderlands-2-we-didn-t-ship-it-with-a-plan-of-how/)

[Randy Pitchford](https://sms4smile.com/quotes/author/randy-pitchford/)

> [It is no secret that I have read 'The Da Vinci Code' several times. I genuinely believe that 'The Da Vinci Code' and 'Angels…](https://sms4smile.com/quotes/ashwin-sanghi/it-is-no-secret-that-i-have-read-the-da-vinci-code-several-times-i/)

[Ashwin Sanghi](https://sms4smile.com/quotes/author/ashwin-sanghi/)

> [“Check the program before you two start undressing and...well, doing whatever freaky shit you talked Harley into.” I”](https://sms4smile.com/quotes/james-cox/check-the-program-before-you-two-start-undressing-and-well-doing/)

[James Cox](https://sms4smile.com/quotes/author/james-cox/)

> [Programmers are always surrounded by complexity; we cannot avoid it… If our basic tool, the language in which we design and code our programs,…](https://sms4smile.com/quotes/tony-hoare/programmers-are-always-surrounded-by-complexity-we-cannot-avoid-it-if/)

[Tony Hoare](https://sms4smile.com/quotes/author/tony-hoare/)

> [One of my most productive days was throwing away 1,000 lines of code.](https://sms4smile.com/quotes/ken-thompson/one-of-my-most-productive-days-was-throwing-away-1-000-lines-of-code/)

[Ken Thompson](https://sms4smile.com/quotes/author/ken-thompson/)

> [Writing code means always having to say you're sorry.](https://sms4smile.com/quotes/paul-ford/writing-code-means-always-having-to-say-you-re-sorry/)

[Paul Ford](https://sms4smile.com/quotes/author/paul-ford/)

> [Limit use of shareware and public domain software to systems without fixed disks. If you do use them on fixed disks, allocate separate subdirectories...…](https://sms4smile.com/quotes/john-mcafee/limit-use-of-shareware-and-public-domain-software-to-systems-without/)

[John McAfee](https://sms4smile.com/quotes/author/john-mcafee/)

> [I'm publicist, patron of nine charities, creative director, food consultant, recipe developer - and mum.](https://sms4smile.com/quotes/jack-monroe/i-m-publicist-patron-of-nine-charities-creative-director-food/)

[Jack Monroe](https://sms4smile.com/quotes/author/jack-monroe/)

> [With VR, we have this same vision, which is create this ultimate platform for sharing your imagination. Our huge community of 300,000 developers creates…](https://sms4smile.com/quotes/david-baszucki/with-vr-we-have-this-same-vision-which-is-create-this-ultimate/)

[David Baszucki](https://sms4smile.com/quotes/author/david-baszucki/)

> [It would be a piece of ingenuousness to accuse the man of today of his lack of moral code. The accusation would leave him…](https://sms4smile.com/quotes/jose-ortega-y-gasset/it-would-be-a-piece-of-ingenuousness-to-accuse-the-man-of-today-of/)

[Jose Ortega y Gasset](https://sms4smile.com/quotes/author/jose-ortega-y-gasset/)

> [A lot of the kids gave a lot of positive feedback about if I ever became a coach, they would love to play in…](https://sms4smile.com/quotes/penny-hardaway/a-lot-of-the-kids-gave-a-lot-of-positive-feedback-about-if-i-ever/)

[Penny Hardaway](https://sms4smile.com/quotes/author/penny-hardaway/)

> [I loved 'Chicago Code;' I watched that a lot. It was great because it really captured the city - I'm from Chicago, too.](https://sms4smile.com/quotes/jessy-schram/i-loved-chicago-code-i-watched-that-a-lot-it-was-great-because-it/)

[Jessy Schram](https://sms4smile.com/quotes/author/jessy-schram/)

> [I kind of pride myself on coming onto things that are well-oiled machines and finding a way to bring what I bring and fit…](https://sms4smile.com/quotes/rob-lowe/i-kind-of-pride-myself-on-coming-onto-things-that-are-well-oiled/)

[Rob Lowe](https://sms4smile.com/quotes/author/rob-lowe/)

> [“By rendering the model in ASN.1, the NCBI created a system that combined objects (DNA sequences, protein sequences, references, sequence features) from a variety…](https://sms4smile.com/quotes/anonymous/by-rendering-the-model-in-asn-1-the-ncbi-created-a-system-that/)

[Anonymous](https://sms4smile.com/quotes/author/anonymous/)

[Browse all 6,477 Programming quotes ](https://sms4smile.com/quotes/about/programming/)

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“When Ruby programmers say that some class “quacks like an Array,” they usually mean that it’s not necessarily an Array nor a descendant of Array, but it responds to most of the same methods as Array and can therefore be used wherever an Array would be used.”",
            "creator": {
                "@type": "Person",
                "name": "Armando Fox"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/armando-fox/when-ruby-programmers-say-that-some-class-quacks-like-an-array-they/",
            "about": {
                "@type": "Thing",
                "name": "Programming"
            },
            "@id": "https://sms4smile.com/quotes/armando-fox/when-ruby-programmers-say-that-some-class-quacks-like-an-array-they/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg",
                "url": "https://sms4smile.com/quotes/i/de0/armando-fox-73504_programming_when-ruby-programmers-say-that-some-clas_1719369.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“When Ruby programmers say that some class “quacks like an Array,” they usually mean that it’s not…” — Armando Fox",
                "creditText": "SMS4Smile Quotes",
                "creator": {
                    "@id": "https://sms4smile.com/quotes/#organization"
                }
            }
        },
        {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://sms4smile.com/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Quotes",
                    "item": "https://sms4smile.com/quotes/"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "Armando Fox",
                    "item": "https://sms4smile.com/quotes/author/armando-fox/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "“When Ruby programmers say that some...",
                    "item": "https://sms4smile.com/quotes/armando-fox/when-ruby-programmers-say-that-some-class-quacks-like-an-array-they/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/armando-fox/when-ruby-programmers-say-that-some-class-quacks-like-an-array-they/#breadcrumb"
        },
        {
            "@type": "WebSite",
            "@id": "https://sms4smile.com/quotes/#website",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "publisher": {
                "@id": "https://sms4smile.com/quotes/#organization"
            }
        },
        {
            "@type": "Organization",
            "@id": "https://sms4smile.com/quotes/#organization",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "logo": {
                "@type": "ImageObject",
                "url": "https://sms4smile.com/quotes/wp-content/themes/sq/assets/icons/icon-512.png",
                "width": 512,
                "height": 512
            }
        }
    ]
}
```
