Fluent interface in Delphi

后端 未结 5 980
既然无缘
既然无缘 2021-01-30 17:25

What are the pros and cons in using fluent interfaces in Delphi?

Fluent interfaces are supposed to increase the readability, but I\'m a bit skeptical to have one

5条回答
  •  轮回少年
    2021-01-30 18:11

    I would question the benefit of using "fluent interfaces".

    From what I see, the point is to allow you to avoid having to declare a variable. So the same benefit the dreaded With statement brings, with a different set of problems (see other answers)

    Honestly I never understood the motivation to use the With statement, and I don't understand the motivation to use fluent interfaces either. I mean is it that hard to define a variable ? All this mumbo jumbo just to allow laziness.

    I would argue that rather than increase readability it, which at first glance it seems to do by having to type/read less, it actually obfuscates it.

    So again, I ask why would you want to use fluent interfaces in the first place ?

    It was coined by Martin Fowler so it must be cool ? Nah I ain't buying it.

提交回复
热议问题