4 ms·
Yes that's true. When I was at university we learned about the concept of composition but the reference language for this 'software engineering' course was C++.
by fileeditview 9y ago
Yes that's true. When I was at university we learned about the concept of composition but the reference language for this 'software engineering' course was C++. The whole composition idea felt contrived at that point.
Some time later I learned Lua for fun and almost instantly understood what this whole prototype based programming / composition was about :)
TLDR:
While I learned about composition at university, they failed to really show how it is used and what it is good for..
- barrkel 9y agoJS mixin / Ruby module / C++ mixin style composition are less than excellent, mind - throwing all the methods from multiple locations into a single scope is a recipe for implicit dependencies. There's an assumption that you won't define any methods that the mixins also define, not only today, but in the future; and even more, you assume that a same-named method won't be defined in multiple mixins, not only today, but in the future. IMO it's much better to explicitly reference all mixins, and compose by reference rather than by direct inclusion, unless the composition has strong reliance on the identity of 'this' / 'self' in its implementation.
- clover-lab 9y agoWhich bring us to old school has-a relationship. Nothing wrong with that.