[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-04 Thread Aaron Martone
@Peter: Thank you for the clarification. I sometimes get very caught up on "best practices" and the nitty gritty of the semantics in order to help myself follow a routine when learning new tech; it's like focusing a laser. In one way, it's great, because once I have that mindset, I'm adhered to

[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Peter Rust
Aaron, As an aside: you seem to have a strong drive for conceptual purity and solid object-oriented design patterns and correctness. While these are not completely dismissed in the Node community, I think you will find them much less emphasized than in the Java and C# communities. Design patter

Re: [nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Zlatko Đurić
Ok, so there are a few things I would advise. 1. KISS. Simple functions or several of them per module, without complex inheritance chains. 2. Closures (the term describing the sharing scope that you are referring to). Keep it simple. Yes, separation of concerns is great, but what is your ultimate

[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Aaron Martone
I did not want to use the util module because that prevents me from comprehending the concept rather than understanding what is being done. I want to learn the proper wording and coding rather than have something else do it for me first. My apologies if I do not use the right words and come acr

[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread zladuric
Your words and code differ a bit, but this is not a problem. But the most beautiful thing, you don't attempt to do anywhere what you say you want. You say you want ServerController to inherit from Server and to do it, uyou require it in the module. Then later on you instantiate the server and a

[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Bryan Donovan
Your example works for me. On Sunday, March 1, 2015 at 8:15:09 PM UTC-8, Aaron Martone wrote: > > Sorry in advance, I've been at this problem for 6 days now and have failed > at every single turn on what I need to do. I simply cannot afford to waste > more time, so I'm asking for help. > > My di

[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Peter Rust
Aaron, When I dropped the above into 3 text files and ran them (with Node 0.10), I got an error about ENV being undefined, so I changed it to "process.ENV" and then got the expected output. I put the two calls to "test()" at the end of server.app.js: var Server = require('./Server'); // the 'S

[nodejs] Re: Cannot comprehend module-based inheritance and composition

2015-03-03 Thread Floby
Hello, Inheritance in javascript does not work with classes as you've already discovered. It works with prototypes and constructors. You may find the util.inherits [1] method useful as it mimics classical simple inheritance. your code would then look something like that : ServerController.js: