← Back to context

Comment by devjab

1 year ago

I’m curious as how it lets you rely less on documentation. If you don’t know what you’re looking for then how will you know you chose the right thing?

The classic example of getting this wrong is probably C# developers using IEnumerable when they should’ve used IQueryable.

> The classic example of getting this wrong is probably C# developers using IEnumerable when they should’ve used IQueryable.

Or literally any function from the standard library in C++, which will likely have undefined behaviour if you look at it wrong and didn't read the docs.

Can you elaborate on this? I'm one of C# developers who operate predominately in the Unity3d slums. This isn't familiar to me.

The closest thing coming to mind to me is mixing up IEnumerable and IEnumerator when trying to define a coroutine.

  • IQuerable Inherits IEnumerable and extends it with functionality to lessen the memory loaded when querying a collection (typically when reading from a database). Using IEnumerable can increase memory usage significantly compared to IQuerable.

    Not every C# developer knows the difference, in my region of the world it’s an infamous mistake and is often the first thing you look for when tasked with improving bottlenecks in C# backends. On the flip-side, using IQuerable isn’t very efficient if what you wanted was to work on in memory collections.

    There is an equally infamous somewhat related issue in Python with list vs generators. Especially common when non Python developers work with Python.

    • Ah this explains why I'm not familiar with misusing IQueryables. My domain is predominately in memory.

      Thank you for the explanation.