1
0
Fork 0
mirror of https://github.com/fmap/muflax65ngodyewp.onion synced 2024-06-18 09:16:48 +02:00

consciousness explained done, plus some minor changes

This commit is contained in:
muflax 2010-05-13 12:14:40 +02:00
parent 81ac4c60f3
commit c8a2abda60
5 changed files with 424 additions and 65 deletions

View file

@ -16,16 +16,15 @@ All major changes on the site
work without unnecessarily strong opinions and emotions).
I rewrote and greatly extended my thoughts on Dennett's [Consciousness
Explained].
Explained]. Yes, I'm finally done with the book.
I also decided to put some parts of my spoiler file online, once they have
proven to be useful. First are experiments with [Speed Reading], some general
hacks for [Good Sleep],.
proven to be useful. First are experiments with [Speed Reading] and some
general hacks for [Good Sleep].
On-site comments are gone, but I'm still very much open to anything over mail.
Sorry for the broken links. At least the RSS feed is still there. ;)
[Consciousness Explained]: /reflections/con_exp.html
[Determinism]: /reflections/determinism.html
[Poetry]: /poetry/

View file

@ -24,7 +24,6 @@ cool stuff I found out to myself? Information ought to be free, after all.
- some hacks for [Good Sleep]
- my experience and criticism of [Polyphasic Sleep]
[Reflections]
=============

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -2,14 +2,13 @@
This is a little series of thoughts on the book "Consciousness Explained" by
Daniel Dennett. I was having a lot of problems the first time through and gave
up in a rage, but enough people I respect recommend the book.
So to find out if it's just me and my personal bias, I started to read it again,
giving Dennett more credit than before. I comment on most of the book, but might
skip parts I simply agree with and have nothing to say about. I planned to have
at least a detailed criticism the second time through, but actually was
influenced so much by it that it quite literally changed my life and whole way
of thinking, trying to sort it all out and somehow refute Dennett.
up in a rage, but enough people I respect recommended the book. So to find out
if it's just me and my personal bias, I started to read it again, giving Dennett
more credit than before. I comment on most of the book, but might skip parts I
simply agree with and have nothing to say about. I planned to have at least a
detailed criticism the second time through, but actually was influenced so much
by it that it quite literally changed my life and whole way of thinking, trying
to sort it all out and somehow refute Dennett.
Hallucinations
==============
@ -330,12 +329,6 @@ about music and tones, but never mentions seeing music, which I do,
to a degree. Different tones *look* different to me, but they don't
*sound* very different - and least not in any meaningful way.[^vis]
[^vis]: You can even hack your brain here and change what part of it handles
what. You can shift, through practice (and not very much, really - a few weeks
may be enough to get very cool results) or drugs, your thoughts from being _an
inner voice_ to _pure text_ to _images_ and so on, and mix-and-match wildly. I
wrote some about that in my experiment on [speed reading].
Now, this in itself is not a problem - different parts of the brain doing the
parsing and so on, which (for a multitude of reasons) is very different among
individuals. I just find it weird that Dennett seems to assume that, in general,
@ -377,24 +370,29 @@ Die Entdeckung der Langsamkeit
> them to feel a little bit bad about their throwing it across the room, maybe
> go and retrieve it and think well, hang on, yes, this irritated me but maybe I
> don't have the right to be irritated.
> -Daniel Dennett, about [Breaking the Spell]
>
> -- Daniel Dennett, about [Breaking the Spell]
Although Dennett meant a different book, he still pretty much sums up how I feel
"Consciousness Explained". If I weren't reading PDFs and library books, I
literally would have thrown them against the wall. Multiple times, in fact.
about "Consciousness Explained". If I actually owned his book, I literally would
have thrown it against the wall. Multiple times, in fact.
But the more I came to think about it and analyzed *why* I disagreed so much
with him, the more I realized that I really had very poor reasons to do so. No
matter how weak I thought his arguments were, I couldn't just reject them
without good arguments of my own, and I found out I didn't have any!
I spent a good 4 months or so reading through lots of literature, trying to
develop a better understanding of the topic. Some of my earlier criticism I now
even reject. No matter how much of his work I might find myself agreeing with
in the future, I already am glad I stuck with the book. Dennett raised all hell
in my brain and demonstrated to me quite clearly that I have been in heavy
rationalization mode for some time now. I will have to deconstruct and tear
apart a lot more until I reach internal consistency again, so let's go on!
To get a better idea of the context Dennett operates in, I needed to first know
all current models of consciousness, which lead to a *tremendous* amount of
reading. I spent a good 4 months or so going through many books per week, trying
to develop a better understanding of the topic, and mostly, to understand my own
motivations and beliefs.
No matter how much of his work I might find myself agreeing with in the future,
I already am glad I stuck with the book. Dennett raised all hell in my brain and
demonstrated to me quite clearly that I have been in heavy rationalization mode
for some time now. I will have to deconstruct and tear apart a lot more until I
reach internal consistency again, so let's go on!
Multiple Drafts and Central Meaning
-----------------------------------
@ -429,42 +427,261 @@ the belief in the self is the very first thing on the way to nirvana a Buddhist
has to overcome. It can take many forms, but the basic experience of selfless
existence is one thing really *every* mystic or guru or saint has ever said or
written something about that I just thought it to be common knowledge. How could
you *not* know this? Did you also not know that the sun rises in the east?
you *not* know this? Did you also not know that the sun rises in the
east?[^meaning]
But then, really, it shouldn't have surprised me. This mainstream ignorance was
exactly what drove me away from many scientists (but not science) and
intellectuals. Many times did I experience how a group of generally smart people
would read a text about or by someone who had a mystic experience, and it
doesn't matter whether the mystic content is just incidental or the only point,
and they would completely *miss it*. I didn't even believe this for years
because it is so obvious to me. They may read the Gospel of John, or talk about
the ideas of St. Augustine, or discuss the purpose of monasteries, and they
either never bring up the mystic content or dismiss it as poetic language. How
someone can read the Gospel of John as a *political* text is beyond me. I would
just listen, confused, how they'd discuss some of Jesus' teaching, say about the
kingdom of god for example, and bring forth all kinds of interpretations; that it
is a political vision (maybe a new state for the oppressed people, or an early
form of communism), or that it is cult rhetoric, or a moral teaching, or a
literary metaphor to drive home a certain point in his parables, and so on, all
taking seriously at least as *possible* interpretations which would now have to
be justified or criticised. It never seemed to occur to them at all that Jesus
*meant exactly what he said*, that he was really speaking of the kingdom of god,
something he had experienced himself and was now reporting on, not something he
had invented in any way or wanted to establish, even though he warns multiple
times explicitly that "though seeing, they do not see; though hearing, they do
not hear or understand". He, and I, took the experience of these things as a
given. *Of course* they exist, I had seen the kingdom, that's what got me
interested in learning more about it in the first place. Surely you all have,
too? Wait, no? You are puzzled what he could have possible meant? What?!
Pandemonium
------------
Dennett harshly reminds me of this myopia, most profoundly demonstrated by
philosophers. They have never even seen the terrain, yet they try to draw a map
anyway. No wonder Dennett has to take apart so many ideas I didn't even consider
worth mentioning. I now feel sympathy for Dennett.
The crucial part in Dennett's draft, I think, is the chaotic and decentral
nature of it. There isn't "one" mind or "one" meaner that does all the meaning,
but many small, independent circuits, often only temporary units that realign
themselves constantly, that cooperate, but also compete with each other for
dominion in the brain. The ultimate results are just the winner of that battle
and may shift or even disagree all the time.
This is an astonishing fact, without which *no* action of the brain can ever be
properly understood. Still, it took Dennett, what?, 250 pages to get there?
*Really?* This is my main criticism of the book; it just meanders on and on
without getting its real message across. And the excuse that it takes that long
to explain doesn't fly with me. The problem is not so much the message, not the
science. Discordian literature, for example, has no problem explaining this
point right away. Robert Anton Wilson even starts "Prometheus Rising" right with
it because you can't understand anything without it. The first lesson in any
mystic tradition was always breaking the self. As long as you believe in the
unity of self, you can never learn, or in other words, as long as something
*looks* like a black box to you, it will always *be* a black box to you. Only
magic can help you then.
The problem really lies with the reader. Dennett understands how stubborn and
difficult to modify the human mind is, so he sugarcoats his message as much as
he can, trying to distract the reader long enough that he can get them to agree
with each part step by step, until the difficult conclusion will seem obvious.
This may even be a good tactic, but I feel utterly disgusted by it. You are
effectively trying to upgrade a broken system not by fixing it, but by slowly,
tenuously, working around its bugs. The *proper* solution would be to get rid of
the system altogether! Destroy their superstitions, make all their assumptions
crash and contradict each other, lead them into a state of pure chaos from which
nothing old can ever emerge again! Operation Mindfuck!
[^ego]: This is often called "ego death" in hallucinogen culture, but also being
But we don't do this. Buddhism understood this perfectly. *First* you must make
the student enlightened, *then* you can teach them about their mind and
meta-physics and so on. The Buddha never discussed any teaching with a beginner,
simply because it would be impossible. Only *after* you have a prepared mind can
you understand the problem properly. But nothing of this sort happens in modern
science. No neuroscientist is required to learn meditation, or take courses on
philosophy, or given a spiritual challenge: "You are going to take DMT, and
until you can properly deal with it, your research will be considered worthless.
When you stop screaming and sobbing like a baby and can sit calmly through it,
we'll read your paper. Otherwise, you haven't even *seen* the real mind, so what
could you tell us about it?"[^dmt]
And this shows, again and again. Because of this we get clusterfucks like the
Beyond Belief conference, on which I can really only quote Scott Atran[^atran]:
> I certainly don't see in this audience the slightest indication that people
> here are emotionally, intellectually equipped to deal with the facts of
> changing human knowledge in the context of unchanging human needs, that
> haven't changed much since the Pleistocene. And I *don't* see that there's any
> evidence that science is being used to try to understand the people you are
> trying to convince to join you. So, for example, the statements we've heard
> here about Islam, in this audience, are worse than any comic book statements
> that I've heard about it and make the classic comic books look like the
> Encyclopedia Britannica. Statements about who the Jihadis are, who a suicide
> bomber is, what a religious experience is; except for one person, you haven't
> the slightest idea, you haven't produced one single fact, you haven't produced
> one single bit of knowledge, not a single bit. Every case provided here is an
> N of 1, our own intuition, except for Rama[^rama], who had an N of 2 (one
> brain patient). Luckily, we had *some* diversity. And from there,
> generalizations are made about religion, about what to do about religion,
> about how science is to engage or not engage religion, about what is rubbish
> and what is not. It strikes me that if you ever wanted to be serious and you
> want to engage the public to make it a moral, peaceful and compassionate
> world, you've gotta get real. You've got to get some data. You've got to get
> some knowledge. And you can't trust your own intuitions about how the world
> is. Be scientists! There is no indication whatsoever that anything we've heard
> shows any evidence of scientific inquiry.
Evasion
=======
But enough of praise. The last might have given you the impression that I was
convinced by Dennett, that his approach seemed reasonable to me. And in fact,
for a while, I was. Fortunately, along came another chapter, the one about
"philosophical problems of consciousness", in which Dennett tries to answer some
criticism of his model. Most of it is just fine, including the zombie[^zombie]
part, but the part on *seeming*... oh, *seeming*...
Dennett reviews his progress so far and pretends to address one obvious
criticism: that he still hasn't explained qualia. And he is very much aware of
it, but he just plain refuses to answer, just throwing a few smoke-bombs
instead, hoping the reader forgets all about it! It's like, "Why are there still
qualia?" -> "To understand qualia, we must understand phenomenology." -> "To
understand phenomenology, we must understand selves." -> "Hey I got them really
cool stories about them multiple selves! Let me show you them!" -> "Any
questions?". Like, what?! I feel I just got mugged by that stupid... ALL GLORY
TO THE HYPNOTOAD.
Dennett still completely depends on a big leap of faith. He can not explain the
*particular* features of consciousness. His draft, or functionalism in general,
may be capable of explaining the observable outside behaviour, but not the
resulting subjective experience. Or in other words, functionalism may figure out
what particular point in Design Space we inhibit and how we got there, but not
*why* Design Space looks the way it does. To give an example, functionalism and
evolution explains just fine why the difference between ripe and unripe apples
is reflected in their different perceived color, but not why *red* looks like
*red* and not like *green* instead. He can only explain the *differentiation*,
but not the absolute position!
I'm sure Dennett would answer that this is a meaningless question to ask and
that's exactly what's infuriating me so much about the book. To me, that is a
perfectly obvious and most important question to ask! The problem is essentially
that Dennett seems to believe that giving a full description is *enough*. It
*isn't*. This is most clearly demonstrated, in my opinion, by [Langton's Ant].
Basically, Langton's Ant is a little ant on an infinite 2-dimensional grid.
Every step, it will look at the color of the field it is on: if it is white, it
colors it black and turns left, or if it is black, it colors it white and turns
right. Afterwards, it moves one field straight ahead and then repeats itself.
There, I just gave you a *full description* of the universe of Langton's Ant. I
left nothing out, all the rules are in there. If you want, you can build your
own, genuine Ant from that, without anything missing. But then you observe the
ant and the following happens:
![Langton's Ant builds a highway](LangtonsAnt.png)
Once the highway is started, the ant will build nothing else anymore. This
*seems* to be true for all possible starting grids, and it has been proven that
the ant will always expand beyond any finite grid, but will it always build a
highway? *Nobody knows*.
Do you see now that very interesting and important facts about the ant are still
left out, even though we have a perfect functional analysis of it? There's
clearly more to it, more yet to learn!
If that's the best functionalism can do, then the Titanic just met its
iceberg.[^functionalism]
Conclusion
==========
In the end, Dennett makes many good points. He successfully points out the false
Cartesian theatre many people are still trapped in and presents a reasonable
draft as a way out. Most of the confusion and ignorance is the fault of the poor
state of current science and lies not with Dennett. He, ultimately, succeeds in
pointing it out and dismantling it, showing what a proper theory of
consciousness must look like, what it all must explain and what parts we can not
just ignore.
Nonetheless, he still lacks one thing the most, and he himself reminds us of
this:
> 'Why, Dan", ask the people in Artificial Intelligence, "do you waste your time
> conferring with those neuroscientists? They wave their hands about
> 'information processing' and worry about where it happens, and which
> neurotransmitters are involved, and all those boring facts, but they haven't a
> clue about the computational requirements of higher cognitive functions."
> "Why", ask the neuroscientists, "do you waste your time on the fantasies of
> Artificial Intelligence? They just invent whatever machinery they want, and
> say unpardonably ignorant things about the brain." The cognitive
> psychologists, meanwhile, are accused of concocting models with neither
> biological plausibility nor proven computational powers; the anthropologists
> wouldn't know a model if they saw one, and the philosophers, as we all know,
> just take in each other's laundry, warning about confusions they themselves
> have created, in an arena bereft of both data and empirically testable
> theories. With so many idiots working on the problem, no wonder consciousness
> is still a mystery.
>
> All these charges are true, and more besides, but I have yet to encounter any
> idiots. Mostly the theorists I have drawn from strike me as very smart people
> - even brilliant people, with the arrogance and impatience that often comes
> with brilliance - but with limited perspectives and agendas, trying to make
> progress on hard problems by taking whatever shortcuts they can see, while
> deploring other people's shortcuts. No one can keep all the problems and
> details clear, including me, and everyone has to mumble, guess, and handwave
> about large parts of the problem.
One thing I'm entirely missing are the exploits. Where are all the useful things
his first draft allows me to do? We *still* don't understand quantum theory, but
we sure can build technology based on it, so we can't be totally wrong. Where's
the collection of useful mind hacks, which must exist, if Dennett's meme theory
is correct? What cool things can I do, knowing that my mind is a chaotic
pandemonium?
The first sign of enlightenment in Buddhism, the so-called stream entry, is
officially categorized by, among other things, the disappearance of doubt in the
teachings - you still don't understand them, but you have seen such great
results, that there must be something to it. The Buddha must know *something*.
All the good things aside, Dennett extrapolates epically, going from one minor
phenomenon to a full description of the brain, explaining nothing along the way,
hoping some hand-waving and bold assertions can compensate for it. This is the
same major failing so common in psychology and economy; you do a study with a
dozen students in a lab and from that interfere the behaviour of nations.
Furthermore, Dennett actually leaves out crucial parts. This is not necessarily
a problem of his draft (and I think it can be fixed), but he ignores so much of
consciousness, all the really weird and extraordinary features, that he can
hardly call it all "explained". His hubris is over 9000!
"Consciousness Explained" is badly written, fails to live up to its ideals,
points out more the failing of its competition than come with any strengths of
its own, and so just like Linux, is **highly recommended**. It's what it does to
your mind that counts, not what it actually is.
[^functionalism]:
This chapter makes it look like I have lost all hope in functionalism, but
that's probably a bit to pessimistic just now. Functionalism has lead to
great discoveries and contains many valuable insights, particularly for AI
research, so I'm still sure that it's a worthwhile endeavour for some time
to come, but I do have severe doubts that it will succeed in the end to
explain consciousness. I see no indication so far that it is even powerful
enough to do that, but we'll have to see. There's no reason to abandon
something that still produces results.
[^dmt]:
This is quite close to what many Ayahuasca groups do. Everyone is required
to drink it at least once a week, and for quite a while, they are probably
going to die and go right through hell again and again, until their soul has
become pure and they can begin to learn. This is a rather harsh treatment,
but it works exceptionally well.
[^meaning]:
But then, really, it shouldn't have surprised me. This mainstream ignorance
was exactly what drove me away from many scientists (but not science) and
intellectuals. Many times did I experience how a group of generally smart
people would read a text about or by someone who had a mystic experience,
and it doesn't matter whether the mystic content is just incidental or the
only point, and they would completely *miss it*. I didn't even believe this
for years because it is so obvious to me. They may read the Gospel of John,
or talk about the ideas of St. Augustine, or discuss the purpose of
monasteries, and they either never bring up the mystic content or dismiss it
as poetic language. How someone can read the Gospel of John as a *political*
text is beyond me. I would just listen, confused, how they'd discuss some of
Jesus' teaching, say about the kingdom of god for example, and bring forth
all kinds of interpretations; that it is a political vision (maybe a new
state for the oppressed people, or an early form of communism), or that it
is cult rhetoric, or a moral teaching, or a literary metaphor to drive home
a certain point in his parables, and so on, all taking seriously at least as
*possible* interpretations which would now have to be justified or
criticised. It never seemed to occur to them at all that Jesus *meant
exactly what he said*, that he was really speaking of the kingdom of god,
something he had experienced himself and was now reporting on, not something
he had invented in any way or wanted to establish, even though he warns
multiple times explicitly that "though seeing, they do not see; though
hearing, they do not hear or understand". He, and I, took the experience of
these things as a given. *Of course* they exist, I had seen the kingdom,
that's what got me interested in learning more about it in the first place.
Surely you all have, too? Wait, no? You are puzzled what he could have
possible meant? What?!
Dennett harshly reminds me of this myopia, most profoundly demonstrated by
philosophers. They have never even seen the terrain, yet they try to draw a
map anyway. No wonder Dennett has to take apart so many ideas I didn't even
consider worth mentioning. I now feel sympathy for Dennett.
[^ego]:
This is often called "ego death" in hallucinogen culture, but also being
"born again" in Christian tradition and many other things. It is in my
opinion the defining experience behind all mysticism and the first and most
important requirement for any spiritual progress. The best indicator is
@ -472,7 +689,7 @@ worth mentioning. I now feel sympathy for Dennett.
characteristic that mystics seem to be entirely without worry about death,
or much worry in general.
[^md]: Dennett has written good another explanation of the multiple drafts model
[^md]: Dennett has written another good explanation of the multiple drafts model
for [Scholarpedia] including some updates and corrections. I'm not going to
reiterate it here.
@ -532,11 +749,82 @@ worth mentioning. I now feel sympathy for Dennett.
models all cases (and predicts further cases), but offers no explanation
whatsoever, except that this kind of phenomenon just happens, according to
certain rules.
Dennett commits a (rather brutal) error here. He defines a "cause" somewhat
like the following (which I fully agree with): A cause is a set of
"features" of a world, such that they are both sufficient (i.e., if the
features are present, then in *every* possible world the effect will occur)
and necessary (i.e., there is *no* possible world, such that the effect
occurs, but the cause not). He then rightfully concludes, aha!, there is no
cause for World War 1 because you certainly can't find such a single cause
that it would always result in the war. But the proper conclusion to draw in
that case is *not* that there are effects without causes, but that in fact
you are dealing with an *improper* effect, an invalid object. "World War 1"
is not a proper thing to call an effect. Instead, you would have to break it
down *a lot*. You can investigate what the cause for the murder of Archduke
Franz Ferdinand was, for example, and build your pseudo-effect up from that:
"World War 1" is the sum of effects "Murder of Archduke Franz Ferdinand" and
so on, each of which has a proper cause. (If necessary, you may have to go
down to the subatomic level, of course, where you will find a guaranteed
proper effect) Or, you go on to create a more abstract framework and
investigate what the cause for a major diplomatic catastrophe of that
magnitude is, without including any specifics.
He confuses deterministic causes and narrative causes. He insists on
defending that we are narratively free - we can convince ourselves that we
are "free enough", even in a deterministic world and can choose our actions
accordingly. It may even be in our best interest to do so, as Dennett notes:
fatalists often perform far worse. But that is not what causal determinism
is *about*. You can't just toss aside a question and declare that your
make-believe is a proper answer just because you don't *like* the
implications. If I wrote a book about how *there clearly is a god*, citing
evidence that believing in it makes me more evolutionary successful, Dennett
would *rightfully* dismiss it because belief and belief-in-belief are
clearly different questions!
Dennett commits a (rather brutal) category error here. He confuses
deterministic causes and narrative causes. He insists on defending that we
are narratively free - we guss what possible world we are in and can choose
our actions accordingly. But that is not what causal determinism is *about*.
"Freedom evolves" is a very nice demonstration of the massive bias present
in most recent atheists; they clearly don't show the same rigour or attitude
with regard to any *other* question outside of religion. For them, the
conclusion came first and the arguments only later. Except Christopher
Hitchens, though, I don't see anyone of them admit that.
[tripzine]: http://www.tripzine.com/listing.php?smlid=268
[Breaking the Spell]: http://www.philosophypress.co.uk/?p=1001
[speed reading]: /experiments/speedreading.html
[Langton's Ant]: http://en.wikipedia.org/wiki/Langton's_ant
[^zombie]:
I'd have to say that I don't know how I stand on the p-zombie issue.
Or rather, I *am* sure that *most* people are p-zombies. I'm not sure if
*all* are, including me.
In fact, I consider it a real possibility that most people *are* less
conscious than mystics are, leading to Dennett actually having less features
that need explaining. But I wouldn't yet commit fully to this idea, nor
would I know whether this is simply a problem of degree, that the mystics
simply have better soul-reception with which to receive more programs, if
you want, or if there is a real qualitative difference, a distinct property
people like Dennett just plain don't have.
However, my main problem with p-zombies would be that both standard camps
aren't radical *enough* for me. If p-zombies are conceivable, why are you
such cowards to not openly speculate that some people, maybe everyone but
you, is one? If they are not, why are you hesitating to say that a bat, a
thermostat and Mickey Mouse are conscious? Absolutely no balls.
[^rama]: Vilayanur S. Ramachandran. Very awesome.
[^atran]: Unfortunately, I haven't been able to actually read anything by Scott
Atran, but he's very high on my todo. His comments were the highlight of
both BB 1 and 2.
[^vis]:
You can even hack your brain here and change what part of it handles what.
You can shift, through practice (and not very much, really - a few weeks may
be enough to get very cool results) or drugs, your thoughts from being _an
inner voice_ to _pure text_ to _images_ and so on, and mix-and-match wildly.
I wrote some about that in my experiment on [speed reading].

View file

@ -0,0 +1,73 @@
% Find the Bug
The book "[Find the Bug](http://www.findthebug.com)" by Adam Barr, to quote the
author, "[...] contains 50 programs, in one of five languages (C, Java, Python,
Perl, and x86 assembly language). Each program contains a single, hard-to-detect
but realistic bug—no tricky *gotchas*.". The idea is to train your ability to
find bugs. The examples claim to be something you might be asked to do in a job
interview. "Write me an algorithm to do $x!" and you move up to a whiteboard,
write a few dozen lines in a language of your choosing (thus the 5 languages in
the book) and now you must be able to defend it or critize it (depending on
whether you are the interviewer or not). You don't have test cases, you can't
compile it, you only have your brain.
This is a really neat idea *in principle*, but unfortunetaly, the execution is
rather lacking. The enforced simplicity (every programm has to fit on one page)
ignores many realistic kinds of bugs. None of the examples require much
background knowledge, which at first looks like a good idea, but again is rather
unrealistic. If I'm writing a level generator for a game and my random number
generator has a bug, then I'll probably only see it in some cases and finding it
may require a bit of statistical knowledge. Just because I dislike statistics
doesn't mean I get to ignore them.
Especially bad is the fact that there are no performance optimizations. The code
is always as clean and simple as it can be to solve the problem, but that's not
what real code looks like. In some cases, this is alright, but there are plenty
of low-level function like memory allocation, string parsing or sorting and
those normally have the hell optimized out of them. A "clever trick" is exactly
the kind of thing that is widespread, evil and buggy.
Also, the examples sometimes aren't really typical. The Python and Perl code in
particular looks nothing like normal code. The Python code is way too low-level,
uses no list comprehension and barely anything of the extensive library. In
short, it's rather unpythonic and looks a lot more like quickly converted C
code. The Perl code has multiple comments and meaningful variable names,
something no self-respecting Perl hacker would ever use. :\>
It's a bit hard to avoid because you can't throw around all the neat little
features everyone familiar with the language would use while still assuming that
the reader has at best a passing knowledge themselves. It would have been a lot
better to either stick with a common and small language (like C) or use pseudo
code instead. Most bugs aren't language specific anyway, so this wouldn't have
hurt the book. Finally, some of the example code is just... strange. There is
one Java example that wants to find out whether a year is a leap year or not.
The relevant logic is this:
~~~ {.java}
// A leap year is a multiple of 4, unless it is
// a multiple of 100, unless it is a multiple of
// 400.
//
// We calculate the three values, then make a
// 3-bit binary value out of them and look it up
// in results.
//
final boolean results[] =
{ false, false, false, false,
true, false, false, true };
if (results[
((((yearAsLong % 4) == 0) ? 1 : 0) << 2) +
((((yearAsLong % 100) == 0) ? 1 : 0) << 1) +
((((yearAsLong % 400) == 0) ? 1 : 0) << 0)]) {
throw new LeapYearException();
} else {
throw new NotLeapYearException();
}
~~~
If I ever meet anyone who uses something like this, then all my promises of
non-violence will be void. However, it *is* a rather typical example of the
twisted and mad code a Java programmer would write, so kudos to the author. It's
still an abomination, though. Anyway, a lot of wasted potential. \*sigh\*