3 ms·
TBH, your example is not too different from openwindow(window); Line aLine = make_line(); addwindowtoline(aLine); A small pet peeve of mine is people
by ufo 13y ago
TBH, your example is not too different from
openwindow(window);
Line aLine = make_line();
addwindowtoline(aLine);
A small pet peeve of mine is people insisting that encapsulation and abstraction are exclusive to object orientation even though abstract data types are also a core concept in prodecural or functional programming.
To make your example "trully OO" you would need to be using dynamic dispatching and polymorphism in those method calls. But are we really going to need multiple Window and Line classes and even if we do, is this really going to be the best way to architecture our code?
- userbinator 13y agoTo take that example even further down the "procedural with OO-ish conventions": Window_open(window); Line aLine; Line_make(aLine); Window_add(window, aLine);
- Goladus 13y agoopen(window); add(window, make_line(...));
- mikro2nd 13y agoYou're right - I didn't attend to developing a really good example. But then I wasn't developing material for a programming course. ;) It was pretty off the cuff.