News for hackers. Stuff that matters.
Re:Inheritance Is Terrible by contravariant on Saturday March 19, 2016 @06:09PM (#11320714)
>If your code reads do_something_to_foo(foo), then very often usually it really ought to be foo.do_something()

Personally I'd make an exception when using extension methods in C#. If you make an extension method which looks (schematically) as follows:

    add_to_cart(this item, Cart cart) {
        cart.add(item);
        return item;
    }
You can write code that looks like:

    item.add_to_cart(cart)
        .check_availability()
        .do_something_else()
        .etc()
Well, this example isn't the best, but you get the general idea.

There are no comments on this comment yet.