

Learn Node.js The Troll Way - Ashuu
http://nathanleclaire.com/blog/2013/02/06/learn-node-dot-js-the-troll-way/

======
secoif
> "I decided to bring a gun to a knife fight and add methods to String’s
> prototype."

Don't do this. Extending native prototypes in node is terrible practice since
it ruins the thing node gets very right: code encapsulation. Not good advice
at all.

~~~
rpedela
Is it "always" correct to extend the String prototype? No.

Is it "always" correct to NOT extend the String prototype? No.

Like all things it depends. If you are writing a library for others to use
then you shouldn't be extending globals for the reasons you have given. And if
you do, you need a good reason and make it very clear to the user. If you are
writing an application or a closed-source library, then it is usually safe to
extend globals because you are in complete control. Like others have said in
the String case, it makes its a lot easier to read the functions that do
string manipulation.

The only absolute rule in software engineering is that there are no absolute
rules.

~~~
secoif
Agreed, but it'd be different if this was aimed at seasoned developers, but
it's aimed at beginners, as such, it's irresponsible.

------
ufo

        if ( $(index).html().match(/^".*"$/) ) {
            return true;
        } else {
            return false;
        }
    

Gah!

