Skip to content

Investigate competition which came to existence in the last decade #66

@Athari

Description

@Athari
  • illuminate/collections

    • +
      • part of the major framework Laravel maintained by a big team, super popular
      • powerful LazyCollection class with lazy evaluation
      • integration with their ORM
      • horrible API of the PHP fractal of bad design tier, arguably even more nonsensical than built-in array functions
      • SQL-ish methods are likely way less performant than FP methods
      • footguns with random non-pure methods
    • links
  • loophp/collection

    • +
      • FP-first library with currying
      • constructing pure operation chain without source
      • seems well-designed with all good practices known to man followed (except perf optimizations ever)
      • tons of examples in the docs
      • 5 levels of indirection likely cause worse performance and are pain to debug
  • doctrine/collections

      • thin wrapper over array functions with some SQL-ish comparer builder
      • no lazy evaluation (the only lazy thing they have is lazy initialization)
      • pure garbage, never use
  • ramsey/collection

    • +
      • Port of Java collections with maps, queues and stuff
      • doesn't include Java streams for lazy evaluation
      • largely thin Enterprise-bullshit-tier wrappers with little added value besides 20 abstract classes and 30 interfaces
      • pure garbage, never use
  • nikic/iter

    • +
      • array functions, but for iterators, which plugs the hole in the PHP API
      • the worst function argument order in existence (iterable-last)
      • little to no attempts to improve API or functionality of array functions
      • very few tests (not that there's much to test, but still)
      • unless devs of PHP implement partial function application for the pipe operator, largely useless
  • jeremeamia/iter8

    • +
      • nikic/iter done right better
      • infected with the virus of Laravel API design
      • zero fucking tests of the main functionality
      • the same issue of being useless without support in PHP language
  • markrogoyski/itertools-php

    • +
      • using Python's itertools as the source of inspiration, but basically another iter
      • includes a Stream class which allows chaining methods and is basically LINQ
      • various kitchen sinks like rockPaperScissors and filterFalse
      • always straightforward implementation, no attempts at optimizing
    • links
  • cakephp/cakephp/collection

    • +
      • part of a big framework, with all bonuses coming from that
      • implemented using manual iterators like ancient YaLinqo 1.0, so poor performance
      • not very feature-rich and doesn't care about keys in iterators much

(WIP)


If a library is actually usable as LINQ-to-objects, consider:

  • Performance comparison
  • Feature comparison and other details in ReadMe
  • Implementing missing methods in YaLinqo

Preliminary conclusions

  • Laravel/Illuminate
    • An extensive article on why its design is atrocious is probably a good idea.
    • Integrate with it as it's very likely to be the default for many devs. Winning in popularity contest is impossible, pulling devs looking for something less horrible is the only way.
  • loophp
    • Performance comparison is a must. It should be the weakest side of an otherwise very powerful and clean library. Haskel-bros will always prefer loophp, so competition in performance is the only way.
    • Has tons of dev dependencies. Investigate what's useful there, probably static analysis stuff and the like.
  • iter/iter8/itertools
    • Don't seem to be super popular, but they do have a solid userbase.
    • Implement more of their methods, especially those existing in many libs, to ease migration.
    • Performance comparison is recommended. YaLinqo isn't much faster, but it does have way more optimized paths.
    • Just being better is probably enough, the only major difference between YaLinqo and iter* is existence of standalone static methods, which is unlikely to be a killer feature (before devs of PHP get to implementing PFA RFC, that is), so not worth changing the architecture.
  • cakephp
    • Performance comparison is recommended, though probably not worth the effort. Nobody actually choosing a collection library will use it.
  • ramsey
    • Considering 400x download numbers on Packagist and about the same activity in the issue tracker, compared to YaLinqo, the only reason for the boosted numbers is likely super-popular (and actually useful) ramsey's uuid, which includes it to save 10 lines of code.
    • Ignore its existence. Nobody except Java-bros is using it directly, and there's no way to pull these people over.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions