What "what"? That your decision is also based on personal opinion. You
describe some well-known issues related to augmenting of built-ins and
think that such pattern (don touch them! – yeah with exclamation mark
at the end
) – is the only one which is related to the professional
programming in production on ECMAScript. But that's only one of some
patterns and this invariant pattern (don't touch!) – is exactly
invariant and inflexible. Meanwhile, me, understanding what I'm doing
and why – can use all features of the language I write with full
power.
Where did I propagate static language features?
Indirectly as the way you've chosen, though, it's fully in ideology of
dynamic based languages. There're some special patterns for most
useful augmenting and so on – to use on full power the system (the
language) on which you write.
Although, you didn't propagate static features directly and can
augment dynamically own object.
I do not have programming fear. The arguments I have presented are
pretty logical. You've not shown counter for those, here:
For me discussion is not "argument-counter" – in such ways that's just
dispute without finding the truth (which is always should be the only
one), but desire to defend the position. I don't see the big sense in
such discussions, ‘cause as a basis the own understanding, own pattern
is taken by the "The standard" which is wrong. That's only opinion,
only one of the ways which can be used or not – by situation.
You found out for yourself some pattern which is based on some
understandable issues. You then wanna to collect some rules and use
such pattern thinking that now you are free from issues and problems.
But from the other hand, fixing "problems" on one side, you can create
them on the other side. Why some should write
"YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()" Ah? Just because you always want to use some the only one patterns
which is protected from all issues and which is the only way? What's
the price for that? Code which looks overheated, too much detailed.
The problems of a program modifying objects it doesn't own exists
regardless of my opinion. An example of that problem was just
demonstrated by `String.prototype.trim` throwing errors when used as
specified by ES5.
What do you mean "when used as specified by ES5"? I've told you – when
I haven't ES5 implemented – I use own, when ES5 will provide it – I
easily switch to implementation of the ES5 and will use it. So, that's
just demagogy – for what uses `.trim.apply(someThing)" with own
implementation? Sure if I need the way using as specified by ES5, I'll
use ES5's implementation.
The "dependency cycle" was explained in the earlier message, too.
Which is equal, right?
I've heard.
I asked to to show the problem and post your code but you won't; you
refuse and keep saying 'demagogy".
What kind of "problem and code" are you talking about? I repeat, the
most essential thing – is theory and *approach* to that. And from this
point of view there could be several approaches which is best fit to
situation, but not think out inflexible pattern which is always should
be used writing that long lines.
It's possible
Design decisions are not a matter of absolute right and wrong. Design
decisions have consequences.
Sure, and should I repeat that I completely understand all the issues?
Should I? That I know about 3rd-party libs, Object.prototype and so
on? What' the problem? If I know about that and if I understand what
I'm doing – for what reason should I write such "long crap" insteadof
ideological and useful method call on object itself but not the long
"YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()"?
Just explain me why, taking into account that I completely understand
all the issues. And if know that there will be no such situation, for
what reason should I write by that inflexible invariant pattern which
you think out to program in enemy environment, where it is not known,
what libraries load, as why extend etc. - in general, uncontrollable
system, where you should afraid of everything and for that's aim think
out "cool" pattern which helps to avoid that (yeah, I understand that
the price is – not so ideological and useful code).
We've been over the pros and cons and so far, the only pro is that you
like being able to use `"foo".capitalize()`.
I'm telling you, in my opinion that long
The "it's crap" argument is hard to understand. AIUI, "it's crap" means
you don't like it, but that you instead prefer what you call "OOP".
You're using specially the most "strong" parts of my cites to show
that I use some non-logical arguments, right? You can stop trying to
do it, I've already appreciate it
But I meant the following, then all the code is penetrated by lines
such as (I let my self copy-paste one line):
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
If
(YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
&&
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()) {
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitalize
()
} else {
YourOwnNamespace.SomeGreatModules.ThisInternalModule.ModuleForString.capitaliz}
Of cause, it's can be in general with some other objects in the system
and this question can be not related to the augmenting the built-ins,
but I don't see any reason to do this with built-ins if I understand
and know the system which I program.
Well we're discussing abstractions here. Where do you find my arguments
to be incorrect? Or where are my failings in thinking abstractly?
You can leave provocation questions, I don't mind on them. I didn't
say about "incorrect, failings in thinking". I asked mostly to think/
talk about the ideology and the theory. Sure we should show some on
practice, but the main goal – is approach independently the exact
practice examples such as with capitalize(). I repeat, that this name
has been chosen just for abstraction with real example in e.g. ExtJS,
no more, no less. And you continue: "what is capitalize? Why is? Where
is it? Why is it there? Who are they? Why?" – that's I was talking
about – that's concrete deep practice things in this dialog is not so
interesting and not so essential. The approach and ideology are
essential.
Don't touch concrete implementations,
The point of drawing out your example is to show the actual code of
something that you proposed as being the better solution.
I've already told.
For production code, for code which is, or may be integrated with public
API, for code that is intended to work in the next version of an
implementation, avoid modifying objects you don't own.
For production professional code, I'll use the system on all power,
flexible by situation, depends on variants I have – as in code
(looking, ideology elegance), as in performance. You can choose your
own way.
It is usually very easy to avoid modifying objects that you don't own.
In the case of String.prototype.capitalize, it is so easy that there
doesn't even have to be very severe consequences in doing that to make
avoiding it a serious consideration.
It is trivial to create your own capitalize routine, but not replace the
existing.
Why should I replace existing? Do you hear what I'm talking about? I
know and understand what can be, understand all the issues. If I'll
see the issues (if I ever will) I choose the other flexible way
programming in ideology of the language on which I write. You can
choose your own invariant pattern which you think out based on well-
known issues.
What the problem do you see?
In code review, code that modifies objects it does not own should be
mentioned. If design of code can be improved, I want someone to say so,
for my code, at least. I want to know what I did that was odd,
confusing, inflexible, complicated.
If all are taken into account, shouldn't. Why should? Why some should
say me: "A-ha! You're modifying built-ins, your code is not
professional, your code is not for production! A-ha!" Why I don't
understand if I know why did I use so and by what reason.
If you have an argument for why String.prototype.capitalize is a good
thing, I haven't understood that (because I can't understand what you
won't show).
Well, I just can suggest to continue trying to understand that the
system you use can be used on all power depends on situation and
taking into account all the well-known issues.
What's the problem? Did I say that I don't understand some of those
issues? Did I, please answer? Or maybe I really don't understand them?
Or maybe I propagate and spread that: "Augment built-ins everywhere
independent the exact case! I don't wanna listen about issues and I
don't understand them!" Did I, please answer?
I've told repeatedly that I completely understand what's the all about
and why can I choose this that way, that I'm not limited by some
invariant pattern which can protect from all the issues but with some
special price for that – code which seems to me to overheated and odd
for ECMAScript programming.
I see that you operate with terms "you just like it, but my arguments
are about concrete issues", right? What arguments? Didn't I see and
understand all that arguments, please answer? Didn't I tell you that I
see the prob in *formulation*? That your chosen pattern is just only
of some variants which can be also professional and exec in production
environment. That you haven't even rights to write "don't use/touch!"
So for that I suggested: "Be careful…" which is more fairly. Will you
mind?
/ds