Posts

Showing posts from August, 2013

We need intelligence, not intellect

Quoting “ Why Are Some People So Smart? ” by MG Siegler: If parents use IVF to conceive, then a genetic test—an extension of the screening tests for genetic diseases that are already routinely done on embryos—could let them pick the smartest genome from a batch of, say, 20 embryos. Smartest as in “results in the highest IQ”. We need to distinguish between intellect and intelligence. An intellect enables you to solve problems, intelligence additionally enables you to pick the right ones. For example: building an atom bomb requires intellect, but is it also an intelligent thing to do? The above approach may not only be ethically questionable, it may also not be an intelligent thing to do. To truly fix the messes that we are currently in (environmentally, socially, economically), we need intelligent people, not people with a great intellect. My impression is that the project tries to produce the latter, not the former (which should be even harder to do, because there are even more fac

Works Cited

Image
There is no shortage of the memoir-as- Bildungsroman , the coming-of-age of the writer in the world.   Works Cited:  An Alphabetical Odyssey of Mayhem and Misbehavior ( University of Nebraska Press , $16.95) by Brandon R. Schrand contains all the familiar tropes:   copious drinking and drugging, college hijinks, fraternity debauchery, sexual promiscuity, rebellion against authority, classroom failure and embarrassment, all repeated ad nauseam.   What sets this book apart is some beautiful writing.   That Schrand is gifted and that he survived his best attempts to remain a child in a man’s body are never in question.   Willingly, we go on his journey with him, riding the twists and turns of the story like passengers on a train snaking through the difficult terrain of a challenging country, a symbolism the writer, himself, uses in the book. What really sets this memoir apart is its organizational structure.   Schrand eschews chronological order and instead, compiles his story as a bibl

Protecting objects in JavaScript

This blog post is a quick refresher of how objects can be protected in JavaScript. There are three levels of protection: Preventing extensions is the weakest level, sealing is stronger, freezing is strongest. Preventing extension Object.preventExtensions(obj) makes it impossible to add properties to obj . Example: var obj = { foo: 'a' }; Object.preventExtensions(obj); Now adding a propert fails silently in sloppy mode: > obj.bar = 'b'; > obj.bar undefined And throws an error in strict mode [1] , which we switch to via an IIFE [2] . > (function () { 'use strict'; obj.bar = 'b' }()); TypeError: Can't add property bar, object is not extensible You can still delete properties, though. > delete obj.foo true > obj.foo undefined Checking whether an object is extensible Object.isExtensible(obj) checks whether obj is extensible: > Object.isExtensible(obj) false Sealing

How To Use The New York Times In The Classroom

Image
I'm again using media and journalism in my classes this fall.  Specifically, we have purchased digital access to The New York Times for every student and will be using articles on a daily basis in our course work.  To that end, I wanted to post some ideas about how to use journalism and media in the classroom. Using journalism in the classroom offers an almost unlimited number of teaching possibilities.   Literally, any media platform will work:   daily or weekly newspaper; monthly magazines; cable news networks; blogs and tweets; and comedy or satirical news sites.   Many of these platforms cross over into different genres of reporting, so The New York Times online offers print, photographic, and video content, as well as blogs and reader commentary, all of which combine together to convey the story.   There will often be additional material on the site to enhance or supplement the basic article.   For example, an unedited version of an interview might be offered online, which me

Why all objects are truthy in JavaScript

In JavaScript, all objects are truthy [1] , even new Boolean(false) , empty arrays and empty objects: > Boolean(new Boolean(false)) true > Boolean([]) true > Boolean({}) true That is different from how objects are converted to number and string, where you can control the result by implementing the methods valueOf() and toString() [2] . Why converting to boolean is different The conversion to boolean is different for historic reasons: For ECMAScript 1, it was decided to not allow objects to configure that conversion. The rationale was as follows. The boolean operators || and && preserve the values of their operands. Therefore, one may have to coerce the same object several times. That was considered a performance problem and led to the rejection. As an example, let’s assume that new Boolean(false) coerces to false and use it in an expression: new Boolean(false) && 1 && true That expression is evaluated in two steps:

Southern Bound

Image
I am a big fan of books that surprise me.   John S. Sledge’s book, Southern Bound:  A Gulf Coast Journalist on Books, Writers, and Literary Pilgrimages of the Heart (University of South Carolina Press, $24.95) is just such a book. For seventeen years, Sledge was the book section editor for the Mobile Press-Register .   He also wrote a weekly column for the paper called “Southern Bound.”   However, as Walter Edgar notes in the Foreword, as his book was being prepared for publication, Sledge was relieved of duty when the paper became an online publication.   Adding him to the casualty list of the demise of print journalism means a loss for the citizens of Mobile and the region as well as another nail in the coffin for book coverage.   Luckily, we have this book, a compilation of his best reviews and essays, containing approximately twenty percent of his total output of 800 columns. Book reviews do not have the kind of shelf life of essays or memoirs, but Sledge packs in a lot of detail

Callable entities in ECMAScript 6

Update 2013-11-28: There won’t be generator arrow functions in ECMAScript 6 ( details ). In ECMAScript 5, one creates all callable entities via functions. ECMAScript 6 has more constructs for doing so. This blog post describes them. The status quo: ECMAScript 5 In ECMAScript 5, functions do triple duty: As normal functions: you can directly call functions. As methods: you can assign a function to the property of an object and call it as a method, via that object. As constructors: you can invoke functions as constructors, via the new operator. The three main problems with this approach are: It confuses people. You can use a function the wrong way, e.g. call a constructor or a method as a normal function. Functions used as normal functions shadow the this of surrounding constructors or methods [1] . That’s because this is always dynamic (provided by each function call), but should be lexical in this case, like normal variables that are resolved via surro

The flag /g of JavaScript’s regular expressions

This blog post describes when and how to use regular expressions whose flag /g is set and what can go wrong. (If you want to read a more general introduction to regular expressions, consult [1] .) The flag /g of regular expressions Sometimes, a regular expression should match the same string multiple times. Then the regular expression object needs to be created with the flag /g set (be it via a regular expression literal, be it via the constructor RegExp ). That leads to the property global of the regular expression object being true and to several operations behaving differently. > var regex = /x/g; > regex.global true The property lastIndex is used to keep track where in the string matching should continue, as we shall see in a moment. RegExp.prototype.test(): determining whether there is a match Regular expressions have the method RegExp.prototype.test(str) Without the flag /g , the method test() of regular expressions simply checks whether there is a mat

Real Talk For Real Teachers

Image
There is no shortage of books about education, and most of them are not positive.   The line of critics telling us what is wrong in our schools, with our teachers, and with students today, stretches to infinity.   If someone does manage to sneak through a book extolling something positive that is happening in the classroom, he is shouted down by those holding up schools as models of disorganization and chaos filled with child molesters and do-nothings.   No doubt, American education has been at a crossroads, a critical juncture that may well determine the future of the nation.   However, there is good happening on our school campuses.   And there are excellent teachers doing the job and living the life in the face of almost constant criticism and negativity. One of those good teachers is Rafe Esquith, winner of the National Medal of the Arts and the Kennedy Center/Stephen Sondheim Inspirational Teacher Award among other honors.   Even Queen Elizabeth has taken notice, making Esquith a