|
提示: 作者被禁止或删除, 无法发言
本帖最后由 black_zerg 于 9-7-2014 07:42 编辑
I am not entirely convinced that new is always bad. I haven't implemented complex application without the 'new'. It must be doable,but also the code needs to look good. I only use function class most of the time now, but have been using classic oop design for most of my JavaScript libs. Next time I will avoid new and inheritance in the whole design, see if it will work
ok here is an example, a drawing application. Following OOP you will have Canvas(hold shapes) & Shape class(which has a draw method), then Polygon, then Rectangle, then TextBox. How should I reuse code and separate concerns without inheritance? What is the functional way? |
|