From: John G Harris on
On Sat, 14 Nov 2009 at 14:09:44, in comp.lang.javascript, David Mark
wrote:
>On Nov 14, 4:33�pm, Eric Bednarz <bedn...(a)fahr-zur-hoelle.org> wrote:
>> David Mark <dmark.cins...(a)gmail.com> writes:
>> > What is a software engineer?
>>
>> In the Netherlands at the time of writing, anything from a computer
>> science graduate to a HTML/CSS code monkey who can copy and paste
>> [insert javascript[insert naming controversy here] library name
>> here]-code.
>
>And at the time of this writing, a "proof" seems to be any bullshit
>pattern you can observe and report with your installed browser(s).
>It's like, if you saw it on the monitor, it must be true. Or more
>like if _anyone_ ever reported it.
>
>It is my contention that browsers (especially modern browsers) are not
>mysterious, illogical creatures to be observed. Neither are the
>people that make them. :)

Seen in a Usenet news group, from an Associate Professor of computing at
a US university :

"Proof enough for me until I see a counter example."

John
--
John Harris
From: Asen Bozhilov on
On 14 îÏÅÍ, 22:38, David Mark <dmark.cins...(a)gmail.com> wrote:
> What is a software engineer? š

At the moment in Bulgaria is just like in Netherlands. Here everybody
can write html/css/JavaScript/php, but nobody wants to understood what
exactly write. In the place where i job i have three Project Managers.
These people not only disagrees web development but they has dummy
question and conclusions like:

"Do you use JQuery? Because we don't want conflicted between our code
and code produced by clients."

"There in JavaScript pointer?"

"Do you resize that picture or you scale to dimension?"

These people don't gives damn about quality of code. The don't want to
learn.. They only want to get our salary, and wants project been
ready before deadline.
That is the reason if i have opportunity, i will be start freelance
practice. I'm not software engineer, but the different between me and
these people is, i want to learn. I want to know how it works things.
And i want to have clear mind to analize code who i write.

You talk about bad design. What about this snippet code:

makeArray: function( array ) {
var ret = [];

if( array != null ){
var i = array.length;
// The window, strings (and functions) also have 'length'
if( i == null || typeof array === "string" || jQuery.isFunction
(array) || array.setInterval )
ret[0] = array;
else
while( i )
ret[--i] = array[i];
}

return ret;
}

That is totally wrong. Author create black list with `object' who
haves `length' property but these `object' it self's is not Array. In
future if author discover `object' who have `length' property but is
not array like object, will be come back to that code. This means
`makeArray' is hard to support, and error prone in different
environments.

Richard Cornford in one entry says:
> If you can give a clear definition
> of what 'being a function' is then you are probably in a position to
> either design and effective - isFunction - method

Do you thing author of makeArray thing about that words? If i replace
in Richard Cornford sentence word 'function' with 'array', what will
be answer?

Regards.
From: The Natural Philosopher on
John G Harris wrote:
> On Sat, 14 Nov 2009 at 22:33:57, in comp.lang.javascript, Eric Bednarz
> wrote:
>> David Mark <dmark.cinsoft(a)gmail.com> writes:
>>
>>> What is a software engineer?
>> In the Netherlands at the time of writing, anything from a computer
>> science graduate to a HTML/CSS code monkey who can copy and paste
>> [insert javascript[insert naming controversy here] library name
>> here]-code.
>
> ... who is trying to convince management he deserves a higher salary.
>
> Real engineers are people who desperately want to be promoted to
> management in order to get away from this nasty technical stuff. You can
> shout at a person and say that it's all their fault; if you start
> shouting at transistors they'll fetch the men in white coats.
>
> John
No real engineers are 'people who can do for sixpence, what any damned
fool can do for a quid'. According to Neville Shute, anyway.

Real engineers hate management more than anything, because once having
done it for sixpence, they think that fourpence halfpenny is merely
another week away...
From: David Mark on
On Nov 15, 12:14 pm, Asen Bozhilov <asen.bozhi...(a)gmail.com> wrote:
> On 14 îÏÅÍ, 22:38, David Mark <dmark.cins...(a)gmail.com> wrote:
>
> > What is a software engineer? Å¡
>
> At the moment in Bulgaria is just like in Netherlands. Here everybody
> can write html/css/JavaScript/php, but nobody wants to understood what
> exactly write.

Yes, clipboard jockeys with no time to learn anything. And they
wonder why they are constantly rewriting the same code, year after
year. That's why there is this myth that cross-browser scripting is
"impossible" without using a (constantly rewritten) library that "just
works". Because those library guys really get it. ;)

> In the place where i job i have three Project Managers.
> These people not only disagrees web development but they has dummy
> question and conclusions like:
>
> "Do you use JQuery? Because we don't want conflicted between our code
> and code produced by clients."
>
> "There in JavaScript pointer?"
>
> "Do you resize that picture or you scale to dimension?"
>
> These people don't gives damn about quality of code. The don't want to
> learn..  They only want to get our salary, and wants project been
> ready before deadline.

Because they have no idea what is being done, they cannot estimate
anything about it. So when their estimation proves incorrect, it's
the programmers' fault (and if only they would have used jQuery as it
"just works" and the author is such a JS luminary). And, of course,
if there is a precedent set by code monkeys, that's the estimate in
their mind. They just don't realize that the wasted time comes later
(and in spades). Or maybe they don't care? Seems like a good way to
lose clients to me. ;)


> That is the reason if i have opportunity, i will be start freelance
> practice.

I can tell you it is very rewarding and there is lots of money to be
made cleaning up after "awesome hackers" (and teaching those who
really wish to learn) and the mess-makers aren't going away. :)

> I'm not software engineer, but the different between me and
> these people is, i want to learn. I want to know how it works things.

That's the only sane approach to programming (particularly browser
scripting). Coding by observation leads to scripts that must be
rewritten every year, nonsense code like typeof xyz == 'array', etc.

> And i want to have clear mind to analize code who i write.

That's a good thing to have.

>
> You talk about bad design. What about this snippet code:
>
> makeArray: function( array ) {
>     var ret = [];
>
>     if( array != null ){
>         var i = array.length;

>         // The window, strings (and functions) also have 'length'

I get the feeling this is a first effort (and never revisited).

>         if( i == null || typeof array === "string" || jQuery.isFunction
> (array) || array.setInterval )
>             ret[0] = array;
>         else
>             while( i )
>                 ret[--i] = array[i];
>     }
>
>     return ret;
>
> }

Yes, I remember this now (from jQuery). The isFunction function is
infamous for its futility. I know I cleaned this mess up for them
years ago, so this must be an old copy.

>
> That is totally wrong. Author create black list with `object' who
> haves `length' property but these `object' it self's is not Array. In
> future if author discover `object' who have `length' property but is
> not array like object, will be come back to that code. This means
> `makeArray' is hard to support, and error prone in different
> environments.

It's complete bullshit. Erase it (and any code like it) from your
mind.

>
> Richard Cornford in one entry says:
>
> > If you can give a clear definition
> > of what 'being a function' is then you are probably in a position to
> > either design and effective - isFunction - method
>
> Do you thing author of makeArray thing about that words? If i replace
> in Richard Cornford sentence word 'function' with 'array', what will
> be answer?

This discussion was held about two years ago and even Resig dropped in
to show off his cluelessness. It's good for a laugh. But if you
actually ever built anything with jQuery, it will make you cry in
frustration (and do they ever) and try to wish it away. Like it's my
fault they have to revisit all of their old code (should have been
paying attention two years ago). :(
From: David Mark on
On Nov 15, 10:34 am, "Richard Cornford" <Rich...(a)litotes.demon.co.uk>
wrote:

[...]

>
> It turns out that the apparent fix for the item methods on IE 8 is
> dependent on the 'mode' triggered by the DOCTYPE. I.E.:-
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>   "http://www.w3.org/TR/html4/loose.dtd">
> <html>
>     <head>
>         <title></title>
>     </head>
>     <body>
> <pre>
> <script type="text/javascript">
>
> var x = window.Image.create();
>
> document.write(
>     '(typeof x) -> '+
>       (typeof x)+'\n'+
>     '(\'\' + c) -> '+
>       ('' + x)
> )
>
> document.write(
>     '\n\n(typeof window.Image.create) -> '+
>       (typeof window.Image.create)+'\n'+
>     '(window.Image.create instanceof String) -> '+
>       (window.Image.create instanceof String)+'\n'+
>     '(Object(window.Image.create) instanceof String) -> '+
>       (Object(window.Image.create) instanceof String)+'\n'+
>     '(typeof Object(window.Image.create)) -> '+
>        (typeof Object(window.Image.create))+'\n'+
>     '(Object(window.Image.create) == window.Image.create) -> '+
>       (Object(window.Image.create) == window.Image.create)+'\n'+
>     '(Object(window.Image.create) === window.Image.create) -> '+
>       (Object(window.Image.create) === window.Image.create)+'\n'+
>     '\'[object HTMLImageElement]\' === window.Image.create) -> '+
>       ('[object HTMLImageElement]' === window.Image.create)
> )
>
> document.write(
>     '\n\n(typeof document.forms.item) -> '+
>       (typeof document.forms.item)+'\n'+
>     '(document.forms.item instanceof String) -> '+
>       (document.forms.item instanceof String)+'\n'+
>     '(Object(document.forms.item) instanceof String) -> '+
>       (Object(document.forms.item) instanceof String)+'\n'+
>     '(typeof Object(document.forms.item)) -> '+
>        (typeof Object(document.forms.item))+'\n'+
>     '(Object(document.forms.item) == document.forms.item) -> '+
>       (Object(document.forms.item) == document.forms.item)+'\n'+
>     '(Object(document.forms.item) === document.forms.item) -> '+
>       (Object(document.forms.item) === document.forms.item)+'\n'+
>     '\'[object]\' === document.forms.item) -> '+
>       ('[object]' === document.forms.item)
> )
>
>  </script>
> </pre>
>     </body>
> </html>
>
> - outputs:-
>
> (typeof x) -> object
> ('' + x) -> [object HTMLImageElement]
>
> (typeof window.Image.create) -> string
> (window.Image.create instanceof String) -> false
> (Object(window.Image.create) instanceof String) -> true
> (typeof Object(window.Image.create)) -> object
> (Object(window.Image.create) == window.Image.create) -> true
> (Object(window.Image.create) === window.Image.create) -> false
> '[object HTMLImageElement]' === window.Image.create) -> true
>
> (typeof document.forms.item) -> object
> (document.forms.item instanceof String) -> false
> (Object(document.forms.item) instanceof String) -> false
> (typeof Object(document.forms.item)) -> object
> (Object(document.forms.item) == document.forms.item) -> true
> (Object(document.forms.item) === document.forms.item) -> true
> '[object]' === document.forms.item) -> false
>
> - but if you remove the DOCTYPE the final section for -
> document.forms.item - changes to:-
>
> (typeof document.forms.item) -> string
> (document.forms.item instanceof String) -> false
> (Object(document.forms.item) instanceof String) -> true
> (typeof Object(document.forms.item)) -> object
> (Object(document.forms.item) == document.forms.item) -> true
> (Object(document.forms.item) === document.forms.item) -> false
> '[object]' === document.forms.item) -> true
>
> That is, apparently in 'quirks' mode the - item - method reverts to its
> previous nature. (There is an apparent inference test for IE 8
> 'standards' mode in there).
>

Sure, IE preserves the old bizarre behavior in quirks mode. Same way
they preserved the old attributes nonsense in compatibility mode. End
result is a CSS selector query engine that magically changes behavior
per a rather large button on the user's toolbar. Think that raises
red flags? Nah, I'm just showing off my knowledge (of the IE8 toolbar
apparently). ;)