Fabulous . . .
. . . and now we are all left wondering how many vespas (spent or not) we need to lay our hands on.
In the opening chapter of his latest book How JavaScript Works (pub. Virgule-Solidus, 2018, c. £24.19, pp 279), Douglas Crockford introduces us to a selection of English linguistic idiosyncrasies that he will inflict on his readers. The most startling of these is his spelling of "one" – yes, yes that Kelly's eye, that …
Even callbacks are easily handled with some consistent interface design practices.
Mr. Crockford makes a fine exemplar of the old saw "Too smart for his own good".
Thanks for wading through the excruciating text to winkle out the parts of interest.
I have to say, while I agree with his comments about callbacks and Promises (which look messy, and there's just no replacing callbacks with promises in existing code without tearing your hair out), he's way out of line about async/await. It's a really useful technique and makes the code much cleaner, easier to read (and write), and less error prone.
The worst problem with async/await is all the books and stackoverflow posts that explain async/await code as though it was happening sequentially. Which it most definitely is not. The number of times people have suggested you can call an async function from the main thread and wait for it to finish is depressing (though the fact that you can't do that is also depressing)
Also, in passing, I hate that JSON cannot be commented. Because there's a lot of tools (eslint, I'm looking at you) that expect their configuration to be in strict json format, and I like to explain why I've taken a decision in my configuration details, thank you very much. So I use yaml, but every time I want to do something, I have to take the eslint example and stick it through a json->yaml converter....
Here's a few
https://www.json.org/ - no possibility of comments in that
https://en.wikipedia.org/wiki/JSON - hmm. still nothing about comments in there
https://tools.ietf.org/html/rfc7159 - nope, no comments in there either
and even this which provides a hacky workround
https://stackoverflow.com/questions/244777/can-comments-be-used-in-json
I can't put in comments without stuffing the data in a nasty way.
Nothing has made me feel quite so stupid and thick-headed as trying to understand Promises. It doesn't help that every explanation starts by linking to a 50-minute PowerPoint presentation on YouTube. I have never successfully learned anything from a PowerPoint presentation and I consider them the least efficient possible way to convey technical information.
I've been doing this job for 20 years and often had DC's name flung at me without ever bothering to find out *why* he's considered the one true authority on JS.
It does worry me when people decide that any one way is the only way, and the fact that he's just one bloke who happens to be smart and happens to have looked under the hood early on makes me wonder about the logic of buying into the cult. Obviously there's a lot of sense in the DC-ish way of doing things, but there are other religions that have the same general rules. IYSWIM.
Is this a review of a real book? Not just one of Verity's excellent rambles?
P.S. Do people still buy books on programming rather than searching t'web?
I used to. I have enough to fill almost 2m of shelf. Anyone want ancient books on Z80, C++, Prolog, Modula-2, Pascal, OpenGL, Windows 95, DOS Interrupts and even older Uni textbooks?
Anyone want ancient books on Z80, C++, Prolog, Modula-2, Pascal...
I've already got most of those, thanks, along with VMS 5 internals documentation and some electronics textbooks from the days when things were mostly analogue. If you can work out how to throw them out, please let me know, I always seem to fail at the last moment...
Shame he didn't co-write it with Wendel Ollie, a PhD candidate at UC Berkeley.[0] If he had, we could call it "The Crockford-Ollie" and be done with it.
With apologies & a tip o't'at to AvE ...
[0] W. Ollie is a construct for illustrative purposes. No actual Wendels have been mocked in the delivery of this opinion piece. Likewise, this should in no way be considered a gibe at the UC system. Don't you just love having to placate the hand-wringers with every attempt at humo(u)r? Answers on a post card.
'This is quite annoying and distracting, but no more so than an economy-class, transatlantic flight in a cramped, middle-aisle seat in front of a poorly disciplined ADD boy-child whose seatback kicks are Poisson-distributed with Lambda around 4.7 per minute.'
ADD and ADHD are medically recognised conditions. The use of them in this context is wrong.
Shame on you and its a sponsored article.... Most of the sponsored ones seem to have no comment option? Maybe you missed this one?
Yes I have a child with ADHD but they are not 'a little shit', 'naughty' or intentionally annoying. They need more care and consideration for their environment and wellbeing not not what my father would describe as 'a good hiding' or a 'slap around the ear'.
Insanity is a medically recognised condition. And occasionally they get on a plane also. I do not want one in the seat behind me.
So you're seeing "sponsored articles", 'shit', 'naughty', 'hiding', 'slap', and all sorts of offense which no one else can see. Umm, were you going to travel anywhere soon? Could you warn us first?
This reminds me of the comments made by my grandparents. I can, to a small degree, forgive my grandparents for having outdated views which are, frankly, outrageous today. Peoples views on mental illness, medical conditions, sexuality, race, disability have changed dramatically over the last 50 years. I hope your views will catch up too.
'This is quite annoying and distracting, but no more so than an economy-class, transatlantic flight in a cramped, middle-aisle seat in front of a poorly disciplined ADD boy-child whose seatback kicks are Poisson-distributed with Lambda around 4.7 per minute.'
Replace "ADD boy-child" with any of the following: Gay, Muslim, Epileptic etc. They are all offensive because they portray the illness/race/sexuality in a negative light, perhaps innocently, but never-the-less, offensive.
You may be old enough to remember how the charity "Spastic Society" was renamed due to people using the word "Spastic" in a negative light.
You may be old enough to remember how the charity "Spastic Society" was renamed due to people using the word "Spastic" in a negative light.
And can't you see what's wrong with that? Spastic is the correct medical term for those suffering with various muscle related illnesses, and yet because the term was used in a derogatory fashion, it's original usage is now frowned upon.
In the same way, black as a description of colour is now considered incorrect, which is just stupid, and spade to describe a digging implement, and slope for a gradual descent, even dyke, to describe a retaining wall is now considered improper.
It is ridiculous that words which have been co-opted for abusive or derogatory use should no longer be acceptable in their original context.
"And can't you see what's wrong with that? Spastic is the correct medical term for those suffering with various muscle related illnesses, and yet because the term was used in a derogatory fashion, it's original usage is now frowned upon."
I agree there is nothing wrong with the words: spastic, dyke, black. It is there use in a derogatory fashion that is the problem. It is similar to marketing, if you repeat these words often enough in a negative or mocking connotation then their use becomes associated this that negative connotation.
The solution is quite simple: do not use religion/race/disability, or in this case, medical conditions as derogatory term. It would have been easy to use "badly behaved" / "annoying" / "offensive" in this circumstance.
In using the medical term in this circumstance you are causing discomfort to those people that have this condition and also those people that have a relative with this condition.
I spent a decade doing microprocessor validation at AMD & IBM. This work included building a floating point emulator. I know far, FAR too much about both the standards and the actual behavior of microprocessors (and their repeated bugs) to let this one go.
Building an integer library out of floating point operations is up there with taking out your own appendix. You better be good (he was an MD), desperate (he was stuck in the Antarctic winter), and with a high tolerance for pain & crazy (he was Russian).
Floating point operations are a LOT slower than integer. If you really want to go the route of building up an MP library, steal from CPAN (it's okay) or better yet https://gmplib.org/ (it's better).
There are three ways to go from float to int. The first is to use floats in the in range, and use the hardware float-to-int to convert. This method has a LOT of bugs historically. It is also generally one of the slowest instructions in an FPU. The second is to use denorms. Of course, denorms are also a rich source of errors, and behind the curtains, denorms are calling the same circuits as the previous convert function, only they do it for every instruction. The last is to ensure that all of the results are bounded so that you can add 3 times a power of 2 to them and keep the same exponent bits. You can then read off the integer part from the bottom bits. Of course, you have to be careful that when you add or subtract, that you rebalance your number after every add and subtract (no multiples for you!). So, again, REALLY slow. And all-original library. As someone who has reason to be confident that if he really had to, he could build such a library, just don't.
This sounds to me like the old argument, long ago advanced by the pipe-smoking and leather elbow patch generation, that nobody should be allowed to use C until he or she has mastered Z80 assembly
Harumph and how very dare you; Youth of today, I don't know. wouldn't know thier LDA from their TAY.
Mines the one with the Ovaltine and kippers in the pocket.
Given the quality of some of the code I've seen some Devs shit over the wall to OPs. Maybe regular beatings with an assembler wouldn't go amiss?