1. 5
  1.  

  2. 4

    I think he’s being a bit overaggressive here in labeling things antipatterns. Class variables and multi-object files in particular have niche use cases, but that doesn’t make them bad.

    The safe navigation operator, as well, is designed to directly replace if x then x.y which is the pattern he’s really concerned with. But we don’t always control the definition of objects we interact with.

    1. 2

      Mostly uncontroversial, but I find the safe nav bit to be a bit unrealistic.

      1. Ruby uses nil all the time as a meaningful value (e.g. Enumerable#find).
      2. The Law of Demeter breaks down a lot in real-life code (especially in Rails). If you want to avoid safe nav, expect to write a lot of wrappers.
      1. 1

        Some of these are obvious, some are possible footguns but not antipatterns (class variables), and some are just good features of the language and not antipatterns at all (safe navigation and numbered block params, at least specifically _1)