Saturday, March 8, 2014

Parts based Programming vs Components based Programming

Dart is designed to support components based web programming.
But the meaning of 'component' looks different for each person.
For me, component is something like coarse grained composability, not fine grained reusability.
'component' would be best represented by 'component' stereo. We can combine any amplifier, preamplifier of different companies. just connecting by wires, it works.
Another example is PC mother board. We can combine any power supply, DRAM, HDD, Compact Disk, graphics board.
On the other hand, these components themselves uses parts, e.g, condensors, transisters(but these days, the amount of such parts are decreasing..).
What polymer seems trying to achieve is to provide such reusable 'part'.
Components should have bigger self consistent functionality, and should not expose the internal.
So the approach to design 'component' based framework and 'part' based framework will be different.

Such component system works because there is a fixed API/standard any component provider must follow. In programming language, that can be defined by interface.(in Dart this was strangely dropped, but we can still use abstract class).
To connect such providers and integrate functional(functorial) body, we can use generic class.
So if we use analogy, class corresponds 'part', and generic class corresponds to 'component'.

No comments:

Post a Comment