Re: Object composition challenge

2012-03-17 Thread David Bruant
Le 17/03/2012 00:50, Jonas Höglund a écrit : On Sat, 17 Mar 2012 00:18:48 +0100, David Bruant bruan...@gmail.com wrote: A Person knows one secret and has methods like .eat(), .walk()... There is no method in the Person interface to reveal the secret either directly or indirectly. A

Re: Object composition challenge

2012-03-17 Thread David Bruant
Le 17/03/2012 00:36, John J Barton a écrit : On Fri, Mar 16, 2012 at 4:18 PM, David Bruant bruan...@gmail.com wrote: ... This is a piece of cake with Java's protected. It is much convoluted in JavaScript. I think this kind of problem being hard to solve in JavaScript is the reason why so many

Re: Object composition challenge

2012-03-17 Thread John J Barton
On Sat, Mar 17, 2012 at 11:37 AM, David Bruant bruan...@gmail.com wrote: Le 17/03/2012 00:36, John J Barton a écrit : On Fri, Mar 16, 2012 at 4:18 PM, David Bruant bruan...@gmail.com wrote: ... This is a piece of cake with Java's protected. It is much convoluted in JavaScript. I think this

Object composition challenge (was: Using Object Literals as Classes)

2012-03-16 Thread David Bruant
Challenge at the bottom Le 16/03/2012 23:34, John J Barton a écrit : On Fri, Mar 16, 2012 at 3:04 PM, David Bruant bruan...@gmail.com wrote: Unfortunately, methods on prototype require to have properties that are public. If you avoid prototype methods, all your attributes and private methods

Re: Object composition challenge (was: Using Object Literals as Classes)

2012-03-16 Thread John J Barton
On Fri, Mar 16, 2012 at 4:18 PM, David Bruant bruan...@gmail.com wrote: ... This is a piece of cake with Java's protected. It is much convoluted in JavaScript. I think this kind of problem being hard to solve in JavaScript is the reason why so many frameworks like Node.js make the choice to

Re: Object composition challenge (was: Using Object Literals as Classes)

2012-03-16 Thread Jonas Höglund
On Sat, 17 Mar 2012 00:18:48 +0100, David Bruant bruan...@gmail.com wrote: A Person knows one secret and has methods like .eat(), .walk()... There is no method in the Person interface to reveal the secret either directly or indirectly. A ComputerSavvyPerson is a Person, but has an additional