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 across as confusing. 
One of the prime reasons why so many websites have failed to teach me these 
concepts is actually the language barrier of them referencing concepts by 
their names and being under the assumption that I am intimately familiar 
with the concept. So please correct me where I am wrong.

Following on what you've said zladuric:

I wanted to create an object that handled server-related functionality. And 
in hoping to keep with a "separation of concerns" mindset, felt an instance 
of a Server() object would need to have a Controller associated to it in 
order to perform the commands. In my mind, I felt the ServerController() 
should be within the Server() object (like on its this.ctrl property) so 
that when I instantiate the Server() into variable 'server', I could call 
things like:

var server = new Server();
server.ctrl.doAction();

And I was thinking because the ServerController() was inside the Server() 
object, if I passed in or init'd the Server() object with the environment 
variable, the ServerController could (through a properly setup prototype, 
gain access to its parent object, and resolve any 'this.env' reference.

I fully agree that it is best to conceptually determine how to 2 are 
related to one another; but I'm relatively new to knowing what patterns are 
out there (there has been a lot of stink about many JS-related resources 
teaching outdated methodologies, and I just want to make sure I'm not 
learning or invoking those types of practices).

Ultimately, I'd like to understand the why of the implementation. At first, 
I had thought "If ServerController is inside Server, this is an act of 
Composition, no? Like saying Car() is composed of an Engine(), the Server() 
is composed of a ServerController(). And then I was hoping the composed 
object would be able to look at its parent environment for "shared" common 
information between them so that I didn't have to init it or redefine it at 
the lower levels.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/9ba3e6c4-c8d7-4efa-af09-7b05be637fe7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to