June 6th, 2007

with Cat The Cat

Продолжая читать Страуструпа (пока собирается статистика)

Вот это.

Интересное наблюдене об экономии кода за счет полиморфизма на странице 14:
So, we can use simple arithmetic to see how the STL technique of separating algorithms from containers reduces the amount of source code we have to write and maintain. There are 60*12 (that is, 720) combinations of algorithmand container in the standard but just 60+12 (that is, 72) definitions. The separation reduces the combinatorial explosion to a simple addition. If we consider element types and policy parameters (function objects, see §4.1.4) for algorithms we see an even more impressive gain: Assume that we have N algorithms with M alternative criteria (policies) and X containers with Y element types. Then, the STL approach gives us N+M+X+Y definitions whereas “hand-crafted code” requires N*M*X*Y definitions.
Простое объяснение, почему полиморфизм удобен. Мне нравится. ;)
with Cat The Cat

Он признался!

As a style of programming, “multi-paradigm programming” [121] is underdeveloped. It often provides solutions that are more elegant and outperforms alternatives [28], but we don’t (yet) have a simple and systematic way of combining the programming styles. Even its name gives away its fundamental weakness.

Тот же, там же, стр. 19. ;)