News for hackers. Stuff that matters.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by alan82 on Sunday November 30, 2014 @03:37PM (#8677997)
In sports, training coaches sometimes forbid to use some play element. In OOP classes there should be an assignment to design a system without inheritance. Just to show what is most important in OOP.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by Jare on Sunday November 30, 2014 @05:24PM (#8678412)
I was taught OOP using Modula-2 in 1989, by defining structures and functions that took a pointer to the struct as first parameter. No inheritance goodies! I used that style in C until 1996 when I definitely moved to C++. Probably why I am not terribly dismissive of OOP but very much of things like inheritance trees, the Java OOP style, and the overuse of GoF in architecture, literature and especially programming discussions.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by thewarrior on Sunday November 30, 2014 @11:35PM (#8679515)
How would you design something like :

Person --> Full Time Employee --> Manager

Person --> Contract Employee

Without inheritance assuming that salary calculation is the only thing which differentiates them.

Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by derefr on Sunday November 30, 2014 @11:48PM (#8679549)
Something like...

   Person HAS A IEmploymentRelationship
   ContractEmployment IMPLEMENTS IEmploymentRelationship
   FullTimeEmployment IMPLEMENTS IEmploymentRelationship
   FullTimeEmployment HAS A IDirectReport
   Manager HAS A Person
   Manager IMPLEMENTS IDirectReport
And then salary() is a polymorphic function declared by the IEmploymentRelationship interface, where FullTimeEmployment instances use the manager somehow, and ContractEmployment doesn't.

You can even put some sugar on that by having a salary() function on Person that calls the salary() function on its IEmploymentRelationship—but I wouldn't, for the same reason I wouldn't denormalize a relational database.

Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by thewarrior on Monday December 01, 2014 @12:04AM (#8679592)
Got it. Thank you.
Re:Alan Kay on the Meaning of “Object-Oriented Programming” ... by vince_refiti on Sunday November 30, 2014 @09:57PM (#8679273)
In Ada, I remember reading that you can limit the inheritance depth.