Saturday 27 December 2014

Brian Goetz on Java

This is a really fascinating presentation by Brian Goetz about why Java is as it is, and what is planned for the future. Interesting points include that Java is much more dynamic than usually thought, and the years of effort put into getting the introduction of functional code and lambdas just right.

http://www.infoq.com/presentations/java-history-present-future?utm_source=infoq&utm_medium=videos_homepage&utm_campaign=videos_row2

Tuesday 23 December 2014

How the Higgs field gives particles mass - it's simple!!

There are many common explanations of how the Higgs effect gives particles mass, and virtually all of them are either misleading or wrong.

One well-known explanation likens the Higgs effect to having space like a room full of people in a party, and when a massive particle enters that space it's like a famous person - everyone clusters around that person making it hard for that famous person to cross the room, so that fame gives people a form of inertia.  This is wrong.

Other explanations imply that the Higgs effect somehow slows particles down like a marble falling through honey as against falling through air.  This is also wrong.

How the Higgs effect gives particles mass is very easy to understand, and it doesn't involve any stickiness or clustering or slowing down.

To understand we have to use Einstein's equation  e = mc2 - mass is related to energy: the more energy, the more mass.

Now, imagine you have a bar magnet, one end North, the other end South.  If you allow it to move freely, it will end up aligned with the Earth's magnetic field, the stable lowest-energy state.  The bar magnet will have a mass, which will include the energy of the interaction with the Earth's magnetic field.  Now, turn the magnet 180 degrees and hold it there.  The magnet is now in a higher energy state, with its field opposite to that of the Earth's.  This higher energy means that the bar magnet will have more mass: it will weigh more and it will have more inertia and a higher (but very, very tiny) gravitation field.  Changing the energy of interaction of the bar magnet with the Earth's magnetic field changes the mass of the bar magnet.

Magnetic fields, like many other fields, are directional.  They are described by vectors.  At each point in space there is a direction to the field and a strength of the field.  But not all fields are directional.  For example, it's possible to plot out a field of temperature in any system of matter, such as the atmosphere or the oceans.  Temperature only has an intensity, not a direction (although temperature can change with direction, that change is not a property of each point; it's only meaningful over a distance).  Temperature is an example of a 'scalar' field, one which only has intensity.

The Higgs effect arises because space is filled with another scalar field - the Higgs field.  The Higgs field is like an electric or magnetic charge, but it has no direction - particles can't turn in any way like the bar magnet in the magnetic field, to reduce the interaction.  Certain particles - electrons, quarks, neutrinos - have an energy of interaction with the universal Higgs field and it's that energy that gives them mass.  It's that mass that means they have a resistance to change in velocity - inertia.

The "Higgs Boson" itself doesn't give particles mass.  It's a particle what was predicted to appear if the universal Higgs field was given a certain kind of kick.  The Large Hadron Collider succeeded in giving enough kicks of the right kind to the universal Higgs field to allow the existence of the Higgs Boson to be convincingly shown.

Thursday 27 November 2014

GamerGate 1 - Down with SJWs and that sort of thing

My twitter feed is packed with GamerGate tweets.  I'm not what some would call a 'hard core' gamer, but I have played PC games for decades and I can understand some of the issues, and being a wishy-washy liberal I can see arguments on both sides, but what I almost never see are good, evidence-based and rational arguments on both sides.  The GamerGate situation is very similar to that of Atheism+ over the past few years, and 'Social Justice Warriors' have been central to both.  GamerGate seems less one-sided than the Atheism+ situation, where (in my view) the Atheist+ers were on the wrong side, and I have criticisms of both pro- and anti-GamerGate supporters.  The next post will deal with the pro-GamerGate arguments of Christina Hoff Sommers.  This post is about the style of argument of anti-GamerGaters, particularly Anita Sarkeesian.

This tweet inspired this blog post:
Whatever side of the GamerGate you are on, I hope you agree that this kind of assertion is seriously flawed, and it illustrates one of the main problems with feminists like @femfreq (Sarkeesian) - this is a hugely question-begging claim with no supporting data supplied. There are 'if's missing here - 'if' depictions are sexist, and 'if' those depictions are harmful. Personally, I have no problem accepting that depiction of women in some games are sexist. But there is a considerable amount of evidence showing that games don't have significant influence on adult behaviour; for example the link between games and violence just isn't there. If this is the case, why should sexism in games be assumed to lead to sexist behaviour? 

So many games are set in fantasy worlds where things are bad, to give a sense of danger and excitement, not reality. Some games show women with big breasts; others show a plumber leaping tens of feet into the air.  You can't just assert that games which show a different reality can be harmful, even if that reality shows sexism, because minds are just too complex for such question-begging assertions.  Some people play games of inequality in their sexual lives, and there is no evidence that such shared fantasies do any harm at all.

I'd love to see better, evidence and thought-based campaigning for equality, not evidence-free assertions,

Tuesday 14 October 2014

Sarkeesian and statistics

I have had a lot of training in statistics as part of my degrees. A tedious amount. It helped me to understand about when it is or is not valid to draw conclusions. This brings me to the subject of people like Anna Sarkeesian receiving threats of violence and death. Such threats are disgusting and must be terrifying, but what do they actually mean? What is the problem that these threats highlight? Unless some data is provided, it's just not possible to come to any general conclusions, bad though the situation is. It's not possible to say "women are hated on the internet", or "gamers are misogynistic bullies". These statements might be true, but you can't get to their truth from the receiving of threats unless some hard statistics are provided.

What the threats do show is that the Internet often allows instant access to anyone. There's no security barrier - cranks, nutjobs and bullies can walk right up to you on social media and email. But what does this mean? It means that visible people on-line get crazy and vicious people sending them crazy things. There is no doubt that this situation can make the on-line experience bad for some people, but the problem can't be said to be the nature of people on-line.
Unless you expect all of any group of a million people to be utterly sane and reasonable, then the nature of the Internet is that if you are visible you are going to come across frightening nutters. This may have no more meaning than the fact that nutters exist.

Friday 10 October 2014

Ideas and Mother-Lodes: Should we care about holy books and doctrines?

I'm sure just about everyone knows about the Affleck vs Maher and Harris battle recently.  A particular phrase Sam Harris used stirred things up: "Islam is the mother-lode of bad ideas".  I'm not going to agree or disagree with that phrase, instead I'm putting forward the suggestion that it might be an interesting and perhaps useful strategy to sometimes leave religion out of discussions of the consequences of religion, paradoxical though this may seem.

What do we really want most of all in the world?  Peace, equality, fairness, freedom.  That's a reasonable list, I think.  Does removing religion appear in that list?  Should it?  (A believer might ask the same about removing atheism!)  If you believe that some aspects of religion get in the way of those ideals, it might seem like a good idea to attack religion, and yet religion has considerable privileges and protection within our cultures.  Religion is precious to many people, and so there is understandable defensiveness when religious beliefs are challenged.

So, how about not challenging certain religious beliefs - not by ignoring those beliefs, but by putting aside the fact that those beliefs are religious in origin?

Suppose someone says that a woman's opinion is legally worth half that of a man's opinion, and they say that it is because of religious law.   How about responding that you aren't going to talk about religious law, you are going to talk about principles of equality?  Nothing strident, simply a statement like this: "Sorry, but I'm not going to discuss supernatural beliefs".  

You see, if you allow religion to come into things, you are allowing a barrier to be put up, a source of immediate conversation-stoppers.  So:

Don't talk about Christianity, talk about science and evolution.

Don't talk about Islam, talk about the equality of women.

Don't talk about Islam, talk about the importance of legal equality for same-sex couples.

Don't talk about Christianity, talk about the importance of stem cell research.

And, controversially, don't talk about Islam being full of bad ideas, just talk about the bad ideas.  If someone wants to mention Islam.... "Sorry, but..." etc. This is absolutely not a criticism of Sam Harris - it's only a suggestion for a parallel strategy for dealing with bad ideas.  

Who knows?  By not allowing the defensiveness that can appear when religion is mentioned, we might change more minds, and if someone believes in evolution and yet thinks they are still a Biblical literalist, do we care?

Sunday 5 October 2014

Evidence for belief

I'm sure you have come across the insistence that religious people don't have evidence for their beliefs; that their beliefs are faith-based.

I don't think that is generally correct, or at least it's useful to consider that it might not be.  Speaking from personal experience and from what others have said, it seems to me that quite a lot of believers think that they are rather good evidence for what they believe.  Here are some examples:

1. The Bible.  The Bible is a book that has been carefully handed down through the millennia, and considered an highly important (to say the least) source of facts about reality and moral guidelines.  That this book remains highly regarded by many is evidence for something, and for believers it can be evidence of it being a source of truth, at least in parts.

2. The universe is here.  When I was a believer the existence of creation seemed to be good evidence for some creative force, which I considered to be "God", although in a mostly deistic sense.

3. Our moral feelings.  Where does our desire for goodness come from?  Clearly, from the goodness of some creator.  The existence of these feelings must mean something, and that something could well be "God".

4. Reports of miracles.  There are plenty of these reports.  How do we explain them?  It makes sense to invoke a deity.

Now, I hope I don't need to make it clear that I don't agree with any of the above examples.  But, what I disagree with is the reliability of this evidence as indicators of religious truths.   But, I can't deny that these are evidence - just not for the beliefs of believers.

As for faith, I had none and I didn't know anyone who considered their beliefs as faith.  Our beliefs were based on what we saw of the universe around us and what it felt like to be a human.  We didn't struggle to believe, there wasn't a daily battle with the dark forces of reason.




Thursday 18 September 2014

On-line threats and harassment are terrible, but are they representative?

On-line bullying and harassment are are serious problem.  It can make being on-line a difficult experience for some people, and this has been the case recently for women involved in gaming.  The same goes for threats via e-mail:  shocking and totally unacceptable.

I'm not questioning at all how awful these attacks are, but what I am questioning is what these attacks mean.

Let's consider someone who has made what turns out to be a controversial statement, a statement which, in a better world, would not be controversial.  They then get some frightening threats by e-mail.  Do these threats mean that this person is being attacked by some community?  That depends.  It depends if these threats are a significant proportion of that community.

Let's say there are ten threats.  They are terrible threats, perhaps even threats that require that the police get involved.  If those ten threats come from members of a group of a few hundred members, then it's safe to say that those threats are a significant part of that group, and it's certainly something that group needs to deal with.

But what if the group consists of a thousand members?  Ten thousand?  A hundred thousand?

There has to be a number at which the responsibility of the whole group for the actions of ten of its members is insignificant.  At that number it makes no sense to describe the actions of those ten as being truly representative of that group.

Let's give a name to the group - how about 'flamers?'

Someone makes a statement, and gets disgusting and frightening attacks from 10 flamers.  Surveys shown that there are 200,000 flamers.  

How should we respond to that someone saying "I am being attacked by the flamer community?", or "the flamer community needs to deal with their hateful members?", "there is a serious problem with on-line flamers?"

Let me be clear.  I am certainly not saying we should in any way dismiss the frightening experience of being attacked on-line, and I am not in any way excusing the attackers. What I am saying is that it's simply a mistake to use the existence of those attackers to come to conclusions about a whole community.  It's factually incorrect.

Just because someone has been the victim of harassment, we should not accept incorrect conclusions from them about tens or hundreds of thousands of people.  For one thing, we could end up dealing with problems that don't really exist as against dealing with real and serious problems of abuse and bullying.

The Internet is a Superconductor of Stupidity.  The mad and the bad get instant and easy access to those they want to attack on-line.  That access can make their voices seem loud, but we should also listen to the peaceful silence of the majority, and that means we need to realise how big that silence is, how many are peaceful.

 

Tuesday 16 September 2014

There's nothing wrong with being gay (a gentle disagreement with Stephen Fry)

Stephen Fry is a good fellow.  He has done wonders for the acceptance of homosexuality and his brave openness about his depressive illness is also admirable.

But, being the gadfly that I am, I find myself somewhat disagreeing with Fry regarding some of his past statements about homosexuality.  I hope it that explaining these disagreements will prove informative.

A few years ago Stephen Fry suggested that religious people should not worry about being forced to hold religious ceremonies for same-sex couples.  Fry said that, after all, religious institutions aren't forced to marry people who were previously divorced.  "That's a very good analogy" said Fry.

No, I really don't think it is a very good analogy.  Putting aside the question of compulsion on the matter of religious weddings, it's really not on to compare any marriages between couples of the same sex with marriages involving divorcees.  Now, I know what Fry is trying to say, but this example does allow for the labelling of same-sex marriages as somehow morally or socially inferior.  It shouldn't, because there is no need to consider marriages involving divorcees as inferior, but it's not helpful to mention all same-sex marriages in that context.  The appropriate comparison is, of course, with same-sex marriages involving divorcees!

I just can't go along with any concession, even for the sake of argument or analogy, on the matter of the moral and social status of the marriages of same-sex couples.  No ground should be given!  We should, in my view, politely but firmly insist on full equality, and the sooner that religious people have full marriage equality the better, and that means religious weddings.

Now I shall wander onto matters of some delicacy.  Some may wish to stop reading at this point, especially, as they say, if you are "at work".  It's about sex.

In a documentary ("Out there") on the status of homosexuality and the lives of gay people around the world Fry encountered a pretty frightening Ugandan preacher who was furiously against homosexuality.  This preacher at one point was ranting on about the awfulness of anal sex.  Fry responded by saying that he (Fry) had never performed that sexual act.  This rather startled the preacher.  It also rather startled me.

What Fry does in bed (or anywhere else) is, of course, none of my business, and Fry is perfectly correct to describe the variety of homosexual experience.  But I could not help thinking that Fry's position [sic] seemed as if he was saying that he didn't do that dirty thing, that, in a way, Fry was one of the "clean" gays who didn't mess about with bottoms.

I am absolutely not saying that was Fry's intention.  But I was left uncomfortable with Fry's statement being open to that interpretation.

I am gay.  I am actively gay.  I have sex.  I have anal sex.  I think it's rather good, actually.  I don't think we should ever be even the slightest bit defensive about our blissful buggery.  There should be no shame, just the etiquette as any conversation about sex.  In fact, let's be more open about it.  If a straight couple mention a session of bouncy fun, let's mention that gay couples can bounce as well as anyone.

So, my disagreement with Stephen Fry is really not that strong; it's only a matter of emphasis.  However, my position on same-sex marriage and same-sex sex is extremely simple: We are, in every way, as Good As You.

An apology to Richard and Sam

On twitter, I said I completely agreed with an article written by Dan Arel on New Atheism.

That was a mistake.  As so often I had read the article too quickly and had not taken in the full impact of what Dan had said in several places.

I don't agree with the attacks on Richard Dawkins and Sam Harris in that article.  What I do agree with is the theme of the possible redundancy of the term "new atheist", along with the fair point that many of those who are "new atheists" at least sometimes speak for themselves, and not as part of any coherent group.  (This is a good thing because we certainly don't need "new atheist doctrines").

So, I apologise to Richard and Sam for my lack of care, and for giving the impression that I agree with the criticisms.


Sunday 14 September 2014

Why David Tennant was the worst Doctor this century

Don't get me wrong - David Tennant gave a great performance.  He was funny, energetic, emotional, and very attractive.  He had great companions, perhaps the best being Donna; a surprisingly good performance by the comedian Catherine Tate.  He had superb villains to deal with, including the introduction of the Weeping Angels, and an utterly mad Master.

But for me the question is who was the character that Tennant was playing, and I just can't see it as being the Doctor.

The Doctor is an ancient alien from a race nearly as old as time.  His race doesn't share human concerns, and live complex lives, regenerating into new bodies with new personalities.  His mind isn't anything like a human mind - his brain is much more powerful and he has telepathic abilities.  His mind also is connected to time and space in a way utterly different from that of a human (as described in "The Parting of the Ways").

The Doctor is basically good - he rebelled against the Time Lords because he would not stand back and watch the suffering of other species.  He decided to intervene, to help others.  But his ways aren't always clear to humans.  The Doctor is the friend who we need but we never really understand.

David Tennant played the part of a human called "Doctor".  There was little of the alien about him.  He loved, he laughed, he suffered and he triumphed as a human would. Worst of all, he seemed to forget that he was a Time Lord when his body finally met it end, with a childish "I don't want to go!".  (Compare that to the wonderfully dignified endings of Tom Baker's Doctor or Matt Smith's).

Christopher Eccleston's Doctor was strange enough - an excess of vivaciousness hiding the deep scars of the Time War.  Matt Smith's Doctor was manic, very much like the wonderful Patrick Troughton's interpretation of the character.  Peter Capaldi's Doctor is the most alien of any; mercurial, eccentric, and having difficulty understanding humans at all, but the core of the Doctor is still there, as it should be.

So, this is my position:  David Tennant's Doctor was a great character, but it wasn't the Doctor.


If you are accused...

If you are accused angrily of sexism and misogyny, and you think the accusation is unreasonable, this is what I suggest you avoid at all costs:  replying to your accusers.

The reason is that it can be the case that your accusers are skilled with use of language and spin, and any attempt you make to rebut them will be misquoted and distorted, providing them with even more ammunition.

How do I know this?  Because I have been there - not because of accusations against me, but against friends.  My attempt to defend these friends were futile, and possibly even made things worse.

The response I would suggest is to review what you have said based on the opinions of friends you respect.  If you find merit to the criticisms, then admit you were wrong and make corrections, but those corrections should meet the approval of yourself and those whose opinion you trust, not your accusers.

Nothing you do will satisfy some of those who rail against you.  So don't try.

Saturday 13 September 2014

While waiting for Sam Harris' book - how I meditate (by an utter beginner)

I'm waiting for Sam Harris' latest book: "Waking Up", on non-religious spirituality, but I have been a convert to the idea of meditation for years, since some therapy in 2010, even though I definitely don't practice it often enough.  Buying Sam's book is a way of encouraging myself.

When I do meditate, it can be only for a few minutes at a time, and yet it is extremely calming and very pleasant.  I thought I would explain what I do, as it's simple (at least to describe).

First I find a situation where I can remain still.  It doesn't have to be quiet, just so that no-one will interrupt me.  Then, I find something visual to focus on.  Often I will look out of a window at some tree blowing in the wind, but anything will do that isn't likely to disappear from view.

Then, I keep my visual attention on that object while gently working to quieten my thoughts.  I will find my mind wandering, and when I do, I bring it back to what I am seeing, and put aside what I was thinking about.  This has to be done calmly - there should be no anger or frustration at finding thoughts arising and attention wandering - just keep putting aside thoughts and bringing the attention back to what you are seeing.  You should not try and think about what you are seeing, just keep working to keep your mind as empty as possible.

It make take several minutes for your mind to quieten, or it may not happen.  It doesn't matter if it doesn't happen - the point of this is to train your brain to be able to find calmness.  It's the process of putting aside thoughts that is (I believe) therapeutic.

When you mind truly does quieten you may experience what I do - a feeling of utter peace and a loss of the track of time.  There is no feeling of urgency to do anything, only calmness, free of any emotion.

There is no mysticism involved, not even a mention of the word 'spirituality'.  It's all about learning how to turn off distracting, compulsive and urgent thoughts.  I believe this is helpful for sufferers of OCD and obsessive thinkers, like me.

Anyway, good luck!  I'm pretty much a beginner.  I'll report back what I find useful in Sam's book.

Wednesday 3 September 2014

The morality of simulated minds

A re-post from a few years ago, on the subject of the morality of simulated minds.
"The Blue Brain Blues"
A materialist does not believe in magic. A materialist does not believe that anything more than the interactions of forces and particles in the physical world is needed to explain that world and everything in it. Not many people are materialists; the majority of those alive, and who have lived, believe that there are extra aspects to the world, usually termed “spiritual” or “supernatural”. But we who don't subscribe to the idea of those extras are increasing in number.
However, I am not going to argue here the truth or otherwise of the materialist view. What I want to show is that it has consequences. Serious moral consequences, and in an area of research and technology that will be of increasing importance to humanity. The moral consequences may be surprising, and yet I will suggest that they follow inevitably from the materialist position. And, for reasons I will explain later, they may - and I feel should – change the way that certain scientists and technologists approach their work.
I'm going to start by asking one of the most difficult scientific questions: what does the brain do? We can come up with all kinds of everyday answers: it produces consciousness, it results in the mind, it allows us to have experiences, it retains memories, it gives us the ability to imagine, to dream. Those are all true, but I want to consider things at a more fundamental level. One way of looking at this question is to say that the brain is a way of helping our genes to survive. But that view does not focus on the specific nature of the brain. We can start to get an idea by looking at what it is made of. It is made of neurons and supporting tissue. Neurons are cells that respond to and process electrochemical signals. They can change their internal state and how they link to other cells in response to signals. We are able to replicate some of their behaviour in simulations called “neural networks”, which seem to be able to process signals and change state in ways similar to their biological equivalent. But how similar? And how similar does the behaviour of the artificial system need to be in order for us to consider what it does as equivalent to the biological system, and not just a coarse model?
But back to neurons. What they seem to be doing is processing and storing information. We analyse the world, and we can recall aspects of it. Our brains are far from perfect, but then evolution rarely requires or produces perfection. Even so, our brains are capable of amazing feats of computation and memory, as often highlighted in the capabilities of certain gifted people. What is crucial for my argument here is that the materialist viewpoint is that there is nothing extra to what the brain is doing other than this processing of information. As the brain obeys the laws of physics, there is no extra physical aspect to what is going on. Consciousness is not some sort of add-on to what is happening in the brain. It is not some sort of “energy” given off by neurons. It does not involve some magic from another realm. The brain consists of molecules and electrochemical interactions behaving in a way that can process and store information. And that is it. So, a materialist will have to come to the conclusion that conscious awareness, our subjective experience of the world, is what you get when certain types of information processing and storage happens. (Subjective experience may not “feel” like just information processing, but then what should it feel like? But that isn't the point anyway – I'm talking about the consequences of the materialist view of the world, not what it feels like to be an aware being in the world.) So, let's get back to neural networks. Specifically, artificial neural networks. Let's assume we get to a situation where we can produce small artificial neural networks that seem to process and store information in the same way as their biological equivalents. That would be scientifically exciting, as it would suggest that we understand all of the important functional aspects of the biological system. That's one of the main aims of simulation research in all areas of science – to see what aspects of the simulated system are necessary to reproduce in order to get realistic behaviour in the simulation. Sometimes this can be very successful, as in molecular modelling, and sometimes it can be less successful, showing that the physical system is hard or impossible to reduce to a simplified model (as in weather prediction). But let's assume success with the neural networks. Let's assume we do get close-to-identical behaviour to that of the small biological system. What to do next?
Well, at least one research group has a big idea. To build models based on the reverse-engineering of entire mammalian brains. It's called the Blue Brain Project: http://bluebrain.epfl.ch/
And here the ethical alarms should start to ring loudly for the materialist. Let's summarise where we are in this argument, and in the hypothetical situation, so we can see why:
  1. A materialist believes that our minds, including our awareness and sensations, are what happens when certain types of information processing occurs.
  2. (Hypothetically) we have artificial systems that we believe process information in a way that is pretty much identical to their biological equivalents.
  3. A research group (that assumes that they can achieve, or have achieved, stage 2) wants to construct an artificial system that processes information just like a biological mammalian brain.
In the past we have not treated animals well in science. But there are now protocols, at least in Western countries, that severely restrict what can be done in the name of research, with the intention of removing or minimising suffering. Mammals in particular are believed to be able to experience pain and suffering. Even a small animal is expected to be treated with care, and experimentation is regulated.
But what of their silicon equivalents? What happens when an information processing system that is functionally equivalent to the mammalian brain can be started up in a few milliseconds, and any desired neural input generated? Given the exponential rise in computing power, and if we assume the hypothetical success of neural network systems, that is a feasible situation with decades. Even if the Blue Brain project runs out of steam, other groups are likely to have a go at this.
Surely, to a materialist, this is not a morally acceptable situation to be left unregulated. Because the materialist would come to the conclusion that the artificial silicon and software systems have an equal ability to experience pain and suffering.
I'd like to clear a few things up at this point. The argument is not about artificial intelligence designed from the bottom-up with an understanding of the parts involved. The argument does not require that we have an explanation of how the brain produces experiences, or what particular pathways are involved. All it requires is the combination of a materialist view of the world with the ability (and intention) of some to accurately reproduce the information processing of neural systems by reverse-engineering (which is the aim of the Blue Brain project).
This might sound esoteric; a purely hypothetical argument of little practical interest. But it is far from that. The reason is that science and reason have to work based on what evidence we have, and to an extent morality should be based on the precautionary principle. We have no evidence for a non-materialistic view of what the brain does. It may not feel like we are “nothing but” the processing of information by certain types of cell, but we have no evidence that this is not the case, no matter how strongly we may believe it as individuals. Therefore, until research shows otherwise, we have to assume that a successful Blue Brain-type simulation of a mammalian brain would have subjective experiences, and could suffer. We have to start to consider if it is ethical to simulate mammalian brains before we have a good understanding of what neural activity results in sensations. Indeed, as governments are currently attempting to cut back on the number of animals used in research (a policy that is likely to continue), we have to consider whether it is morally acceptable to simulate mammalian brains at all. It's not surprising that there have been many significant philosophical and scientific discussions about the nature of consciousness, and whether or not the machine equivalents of biological systems would have subjective experiences. It is a matter of great debate. But the consequences of opposing views aren't equal. If “machine brains” have minds, then the amount of potential suffering that could be caused is almost limitless.
I have barely started to cover this vast subject. But, I think a debate on the moral implications of neural simulations has to start, and considering the exponentially increasing power of systems on which simulations can be run, this debate has to start soon.

Saturday 23 August 2014

Mounts Improbable and Valleys Probable

Many years ago I watched a wonderful lecture by someone called Richard Dawkins. This lecture was one of a series given by Richard that years, and was hosted by the Royal Institution. The RI maintain a long tradition of such lectures, shown each Christmas, in order to encourage young people to experience the wonder of science. Richard's lectures were quite definitely some of the best that had been given, and remain so to this day.
The particular lecture that caught my imagination was on the subject of 'Mount Improbable', the supposed improbability barrier to the evolution of extremely complex structures such as eyes. Richard showed how the great height of improbability that would be a sudden appearance of an eye in a lineage that had nothing resembling an eye before isn't the way evolution works. Peaks of improbability can be climbed in small steps, through individual mutations followed by selection. The eye doesn't have to (and didn't) appear in one generation.
This was a useful way of describing how evolution works, but I wasn't completely satisfied. What I could not see from the 'Mount Improbable' metaphor was why evolution would bother to climb up the the mountain at all. Looked at from the point of view of biology, the tiny steps up the mountain lead to arrangements of genes (which we call 'organisms') being better able to survive than alternative arrangements. But even so, what is actually going on, overall, in terms of probability rather than biology? What actually is the force that drives evolution up the slopes of Mount Improbable?
I have both a degree and post-doctoral work in biochemistry and published work on thermodynamics (although this was some time ago, and I have forgotten quite a lot of it). But, surely, I thought, there must be a thermodynamic way of looking at all this. So I'm going to present such a way of looking.  It's going to be wrong in many ways, but I hope it can give some idea of what is probably going on with the journey up Mount Improbable.  
Life needs energy to maintain itself and to grow and reproduce. But energy alone isn't enough. Life can't grown on heat energy, for example. Just as important as energy is the form in which the energy is supplied. The energy has to be ordered; it has to contain some kind of structure, and life feeds off that order. Plants use the energy of sunlight, energy which peaks at certain wavelengths. Plants use those wavelengths of light to drive reactions which split water into hydrogen and oxygen, providing chemical energy that is used to form carbon compounds from CO2 allowing the plant to maintain itself and build new cells.

There are other sources of ordered energy that can fuel life; there are single-celled organisms deep in the rocks of the Earth's crust that grow incredibly slowly using hydrogen released by reactions between iron and water.  A large fraction of the mass of all life on Earth probably consists of these cells.  In these different environments on Earth, and probably in many other kinds of environment throughout the Universe, life maintains itself and grows where there are flows of energy and order.

If we only consider the organisms and their complexity we don't see the whole picture.  There is a much broader view that can help us understand why life's complexity can appear and increase.  That view includes what life leaves behind.  Living organisms make a mess. Their biochemical reactions and their physical actions throw waste products and heat into the environment, and as a result life produces disorder.  Life increases entropy.   The structure of plants produced by tapping the low entropy of sunlight is broken down by decay and digestion.  A cow turns grass into cow, but also into cow-pats, methane and heat.  The key thing here is that life produces more disorder than there would be without life.  Life is a catalyst for raising entropy.

So, Mount Improbable isn't the full picture.  At the same time as life progresses up the mountain, life erodes deep valleys of entropy, of probability.  Overall, taking into account both the improbable mountains and the probable valleys, life lowers the landscape.  Given the probability landscape before life and the landscape with evolving complex life, the landscape with life is thermodynamically favourable.  It's something that will spontaneously happen.  Life, including highly evolved life, is probable, perhaps even inevitable.

There is more.  We can ask where does the order in the energy used by organisms such as plants come from?  It comes from stars; directly when it comes to photosynthesis, and indirectly in the form of chemical energy from reactions with elements that have been formed in long-dead stars and spread throughout space by supernovae.

Where do stars come from?  They come from the collapse of vast gas clouds because of gravity.  Gravity amplifies the effects of slight irregularities in these clouds, and huge volumes of gas and dust gather into hot spheres that ignite to become stars like our Sun.

Ironically, Mount Improbable is climbed because of the cosmic power of gravity.

Friday 13 June 2014

Starting up JavaFX in Scala

Scala is great, and JavaFX is a pretty amazing user interface system.  So, I want to combine them.  This is a short note about how to get things going quickly.

A JavaFX start-up class needs to have a main() method just like any other start-up class, and also needs to inherit from Application, so code like this can be written:

class Start extends Application {
    public static void main(String[] args) {
        Application.launch(args);
    }

    public void start(Stage stage) {
        ....
    }
}

The application starts up an instance of the class and passes the main window (the 'Stage') to the start method.

Trying to copy this in Scala results in this:

object Start {
    def main(args: Array[String]) : Unit = {
        Application.launch(args:_*)
    }
}

class Start extends Application {
    override def start(stage: Stage) = {
        ....
    }
}

(args:_* means take the array 'args' and set the elements as individual varargs parameters)

This code won't work.  There are two reasons:  There isn't the connection between the Start object and the Start class in Scala that corresponds to that between static methods and a class in Java.  Secondly, there already is an Application class in the Scala defaults.

We can deal with the first problem by explicitly mentioning the class that the application needs to start up, and the second problem can be fixed by Scala import renaming:

import javafx.application.{Application => FXApplication}

object Start {
    def main(args: Array[String]) : Unit = {
        Application.launch(classOf[Start],args:_*)
    }
}

class Start {
    override def start(stage: Stage) = {
        ....
    }
}

That does it!

In my next programming post I'll show how to get FXML binding working with Scala.


Thursday 12 June 2014

Java 8 - getting rid of the use of nulls

Java 8 will result in a slow revolution in the way Java is programmed.  There are so many new features that have been brought in from functional programming and from other languages.  One of the most powerful in terms of reducing program errors is the Optional class.  This isn't quite Scala's "Optional" but it's still incredibly useful.

Optional is a container for a value and can be considered to be a specialised one-element collection.  The use of generics and type inference in Java 8 means that it can be used pretty much universally as the return value of a method or function that in past Java coding would return either an object or null.

The problem with 'null' is that it's meaningless.  It has no type - it isn't an instance of anything useful: a null value could have come from anywhere.  Optional is typed, so can be used to indicate a typed nothingness!

Here is a method that returns an optional Customer:

public Optional<Customer> findCustomerByName(String name);

Typically in Java to date, it would have been reasonable to return a null value to indicate a search failure.  No longer.  Now code like this can be written:

Optional<Customer> customer = findCustomerByName("Zara");

if(customer.isPresent())
    System.out.println(customer.get()); // get() extracts the value contained in the Optional

This is nice.  The meaning here is explicit, which would not be the case for "customer != null".

But we have only got started.  Using Java 8 lambdas, we can also write this:

customer.ifPresent( cust -> System.out.println(cust));

The value is taken out of the optional and is available within the lambda.

With Java 8 method references, this can be abbreviated further:

customer.ifPresent(System.out::println);

Other methods available with Optional include:

Customer whoToUse = customer.orElse(someoneElse);

use the contained customer if present, otherwise use someoneElse.

Customer cust = customer.orElseThrow(IllegalArgumentException::new);

Throw an exception if the Optional doesn't contain anything.

These are extremely concise compared to what had to be previously written in Java, and the meaning is much clearer.

So, replace setting nulls with Optional.empty() and replace all checking of nulls with the clearer and safer Optional methods - you have nothing to use but NullPointerExceptions!


Sunday 8 June 2014

Essay: The Scales of Eternity

The Scales of Eternity

We are told we live in a universe that is running down, that the time of light and complexity will inevitably end. But that has always been true and perhaps always will be, from the earliest times until the stars are a just brief afterglow of the Big Bang.

At the start, no clocks were possible, but our imaginary clock ticks every 10-44 seconds

This is a time of heat and light, the universe is full of rich activity. Time is strange, before and after intermingled. Then, a clock could tick and time's direction settles. Waves of space and time echo back and forth, particles of all sizes appear, disappear and collide, there is one force binding matter and energy into a unity. Cooling starts, the forces start to separate and then: explosion of space, faster and faster it goes, driven by the separation energy, on and on it goes, the negative gravity stretching space far faster than light, doubling and re-doubling each volume over and over again. After a long, long time, the explosion stops. The last quantum ripples remain, and the energy of the slowing inflation fills everywhere with hot particles. It's cold: not the slightest fraction of the starting heat. Things are slow, the universe is running down. Only a few particles are made now, and they drift slowly across space, occasionally meeting their opposites and annihilating. Space is almost empty.

Clock tick time is from a millionth of a second to a second. There is such heat: this is the time of plasmas, the first of quarks and the force-carrier gluons. The universe is a hot sea of 'colours', strangeness, charm, top, bottom, up, down, the quantum labels of the quarks and their forces. Exponentially, things cool as the universe slowly expands, until the photon types split: light with no mass carries electromagnetic waves without limit. Light with mass has limited time to move and carries the weakest force, felt by neutrinos. Growing and cooling, the first plasma clears as the quarks condense like drops in a mist into protons and neutons, the baryons. Large are the baryons, barely there, a triplet of quarks held by the strong force, which strangely weakens at close range, but look closely at a quark – it may be a string, a vibrating strand. Imagine that strand as a metre in length... how big is a proton? It's a galaxy.

Clock ticks slow from seconds to millennia

Now we see the elements start to form, protons and neutrons pulled together by the residue of the force between quarks. Time passes, years, decades, centuries, hundreds of thousands of years. Electrons condense into orbits around the baryon clusters. The second plasma clears and atoms form. Gases condense, settling into stars, galaxies, clusters of galaxies. For a very brief time the stars burn, explode, condense, burn, explode, condense. On a rock around one star complexity is fueled by the light and life as we know it appears. One species spreads to space. The cycle of the suns is done. The star dwarves give off a red glow for a trillion years, and the galaxies spin like chains of rubies. Then darkness.

Clock ticks slow from a billion years to a trillion years and beyond

The black holes spin. Perhaps civilizations farm black holes for fuel, the twisting space around them providing energy beyond imagining. The sky is filled with quasars, beaming energy across the light-millennia. This could be the true era of life, not the brief flicker of the fusing stars. Trillions of trillions of years.

Even the black holes decay. There is nothing left. Dark and cold re-scaled by powers of powers of ten. There is nothing but the vacuum, everywhere and forever. Except... in orbits tens of billions of light years wide, electrons circle positrons, forming positronium.
Clock ticks become too long to imagine

Positronium atoms dance across the universe, forming - what? At each scale there is furious activity, both chaos and order. As these fade to nearly nothing, a change of perspective takes us back to a reality of action and energy. Will the universe ever really run down to nothing? Perhaps not, when time seems close to eternal at each scale there is always more, and who knows what there might be when the universe is experienced on a scale so long that the time of black holes is to that time what a Planck tick is to ours?


Our universe is falling apart - we are made of the cold ashes of an earlier furnace - but as it falls, there is much that can happen, there are new wonders. We are creatures of fragile complexity in a world that is always on the edge of nothingness.

Monday 12 May 2014

Java 8 is functional, and fun

When I heard that Java was getting 'lambdas' or, as I prefer to think of them, sort-of-closures, as I was an enthusiastic Smalltalk programmer many years ago, I wasn't that excited.  Being Java, I thought that these lambdas would be dull but reliable, which is what I have come to expect of Java.  I had no complaints, because Java is all about solid, reliable, readable code.  I was mistaken - Java lambdas are extremely powerful and huge fun.

What I really love about Java 8 lambdas is the ability to have them implicitly constructed by method references.  That sounds obscure, but it's one of the most powerful and expressive features of Java 8.

I'll show how this works by showing some Smalltalk code.  This code might be from some sort of user interface, and maps key presses to code.

codeMap := Map new.
codeMap at: $A put: #doThis.
codeMap at: $B put: #doThat.

$A and $B are character constants.  #doThis and #doThat are symbols, which in this code hold the name of methods. So, the following code will work:


onKeyPressed: key

keyHandler perform: (codeMap get: key)

The symbolic method name is looked up using the character supplied and the object 'keyHandler' is passed that method name to run.

It's a very concise way of mapping characters to functions, without the need for hard-coded and verbose 'if' or 'switch' statements.

This was impossible in Java.  Until Java 8.  Now, it's very easy.  Here is an example:

public class KeyHandler {

// Map of  Character to a function which has a single parameter - a KeyHandler Instance

public final static Map<Character,Consumer<KeyHandler>> codeMap = new HashMap<>();

// Put method references into the map
static {
   codeMap.put('A',KeyHandler::doThis);
   codeMap.put('B',KeyHandler::doThat);
}


// The map can be used like this
public void respondToKey(char key) {
    Consumer<KeyHandler> function = codeMap.get(key);
    if (function != null) {
        function.accept(this);
    }
}

private void doThis() {}
private void doThat() {}
}

What's going on here is that Java 8 lambda syntax means that the map construction could have been done like this:

codeMap.put('A', (KeyHandler handler) -> {handler.doThis();});
codeMap.put('B', (KeyHandler handler) -> {handler.doThat();});

The type of 'handler' can be inferred because of the type of codeMap, and single statement lambdas don't need brackets:

codeMap.put('A', (handler) -> handler.doThis());
codeMap.put('B', ( handler) -> handler.doThat());

brackets aren't needed for lambdas with one argument:

codeMap.put('A', handler -> handler.doThis());
codeMap.put('B', handler -> handler.doThat());

These lambdas are treated implementations of the interface Consumer<KeyHandler>.  In Java 7 this code could be written using inner anonymous classes:

codeMap.put('A',new Consumer<KeyHandler>() {
   public void accept(KeyHandler handler) {
       handler.doThis();
   }
});

And so on.  There is the slight matter of the 'Consumer' interface not being available in Java 7, but that doesn't matter for this example.

Java 8 lambdas are much more concise, and, it turns out, can be run-time optimised to be typically much more efficient than inner classes, both in terms of memory and speed.

We are nearly there with explaining the use of method references.  In Java 8 a method reference can be used instead of a lambda if the method is, if renamed, the same as the single method in the interface that the lambda is an instance of.   Well, almost.  Assume it is the case for now.  Suppose we had a method that wanted a Runnable as a parameter:

public void doThing(Runnable runnable) { runnable.run(); }

The KeyHandler methods doThis and doThat have no arguments and no return value, and so they are the same as the Runnable method run().  And so, in Java 8, references to these methods can be used as 'Runnable' instances.

KeyHandler handler = new KeyHandler();
doThing(handler::doThis);

Any method that has no arguments and no return value can be used as a Runnable instance in Java 8.

There is one final step to explain what is going on in the KeyHandler class.  Java 8 can have method references even when there is no instance of the class implementing the method.  There is an obvious case of when this is needed:  static methods.  Static methods aren't run by instances.  Here is an example:

public class Thing {
    public static void printSomething() {
        System.out.println("Hello");
    }
}

The method Thing.printSomething() has no arguments and returns nothing, so it can be used as a Runnable:

doThing(Thing::printSomething);

This will print "Hello".

Now let's give Thing an instance method:

public class Thing {
    public static void printSomething() {
        System.out.println("Hello");
    }
    public void printSomethingElse() {
        System.out.println("Goodbye");
    }
}

What does "Thing::printSomethingElse"  mean?  It's an instance method, but no instance is given.  It has no arguments and returns nothing, so it looks like a Runnable.  It isn't.  There is a hidden argument in this method reference.  That hidden argument is the instance that will run the method.

Thing:printSomething else, is, in fact a possible implementation of Consumable<Thing> (or any other interface with a single method that takes a Thing as parameter and returns nothing).

This is how this method reference can be used:

First, we define a new method:

public void doThing(Thing instance,Consumable<Thing> function) {
    function.apply(instance); 
}

Now we use it:

Thing instance = new Thing();
doThing(instance,Thing::printSomethingElse);

This will print "Goodbye".

Finally, we can see what the method references are all about in the KeyHandler class.  They indicate what instance methods are to be used, and also that an actual instance must be supplied.  That's why they are effectively Consumable instances and not Runnable instances even though the methods they refer to have no arguments and return nothing.

So, I finally get to code my Smalltalk idiom in Java!
 

Tuesday 6 May 2014

Why not Scala?

Scala is a very powerful and relatively new language that runs on the Java runtime - the "Java Virtual Machine" (JVM).  It's getting a lot of positive publicity, and it seems that it is gaining acceptance.  However, I'm really cautious about using it in any major project that is expected to be run and maintained for years.  Why?  There are many reasons, here are a few:

1. Complexity.

Scala is BIG language.  It combines object-orientation with functional styles and seems to include almost every possible thing that a programming language can do.  Some (far from all) the programming idioms currently in Scala (2.11.0) are:

declarative matching
case conditions
case classes
value classes
'for' comprehensions
xml embedding
dynamic method calls
generics
type range syntax
implicit methods
implicit classes
parameter placeholders
method references
special 'apply' method
currying
tuples
destructuring binds
traits
relative imports
package objects
named arguments
partially applied functions
lazy values
type aliasing
'operator' overloading

I have been programming and keeping up as best I can with programming for over 30 years, and, to be honest, I'm not sure what a few of these mean.

I do like many of these features: Implicit methods are a neat way to add functionality to existing classes by invisibly transforming such classes into new classes with new functions:

// Here is a silly example

class MyString {
def hello {
    println("hello")
}

implicit def toMyString(s: String) = new MyString

// Now "abcd".hello will print "hello" - effectively a new method .hello has been added to all strings where 'toMyString' is in scope.

However, this ability to tweak what code can do in hidden ways can lead to source that is extremely hard to follow.  Also, what can be done by a developer will end up being done by someone in a development team if that team is of any but the smallest size.  I know from experience.

2. What does Scala code do?

Here is an example of normal Scala code:

val x = myFunction()

What is going on here?  All we can see is a function call.  What kind of thing is 'x'?  What can it do?  The problem here is that Scala can infer types based on whatever is assigned to a value or variable.  You could write:

val x: String = myFunction()

Assuming, of course, myFunction returned a String, but this isn't necessary, and inference of type is standard practice.  But, if someone changes the return type of myFunction() at the point of its definition, you may have no idea that this has happened until a program has been run.  Look at the following code:

def getMyValue() = 1

val result = getMyValue() + getMyValue()
println(result)

When run, this will print "2"

Now, change the function:

def getMyValue() = "1"

When run, this will print "11"

Type inference is an example of where I think Java is doing things the right way.  Java insists on the type of a variable being described when the variable is defined:

String x = myFunction()

Any change in the result type of the function will be immediately caught at this point in the code by the compiler.  Java 8 allows for type inference to be used to reduce the amount of code needed to describe lambdas. 

Java 7:

Runnable code = new Runnable() { public void run() { System.out.println("run!"); }};

Java 8:

Runnable code = () -> System.out.println("run!");

That the lambda (the bit after "=") represents a Runnable, and the code should be seen as the body of a "run" method is inferred from the type of the variable "code". 

Java has the contract between function developer and function user explicit at the point of use.  This leads to clearer code.

3. Scala changes.

You can run positively ancient compiled Java code on the most modern Java VM.  a Java GUI program written from the early days of Java will still compile, and still run.  Java code doesn't die.

Scala is younger, and already a significant part of the language and libraries - the Actor system for parallel code - has been deprecated and replaced by a newer library, resulting in the need for migration work.  The new library (Akka) is a great system, but developers of significant and long-term projects really don't want to have to face this kind of change to keep up-to-date with bug-fixes and new features.  At least I don't!  Java's slow adoption of new idioms can be a real advantage for this kind of development, where stability is vital.

4. Who uses Scala?

In spite of it's frequent discussion, the actual use of Scala seems to be very small.  The TIOBE site monitors the volume of information on many Internet sites about different languages.  As expected, Java and C dominate.  Over recent years JavaScript and Objective C have grown hugely.  Scala is down below the decimal point of a percentage, somewhere between Fortran and Prolog. This does not directly indicate the quality of Scala, but it does show that getting Scala developers for a major project can be difficult and expensive.

It could be justifiably said that I'm not helping Scala with this attitude.  But I have to face the fact that software development for large and long-term projects isn't about taking a charitable approach to development languages and tools.  It's about delivering stability, reliability, and long-term maintainability.  It's about being justifiably dull!

Saturday 3 May 2014

Why Java?

I have been a programmer most of my life.  I fell in love with programming as a young teenager.  I learned BASIC, because, then, everyone learned BASIC.  I progressed through Fortran, Algol, COBOL, and various assemblers... but that was decades ago.  Now I program mainly in Java, with occasional use of Scala. 

Java has a reputation of being clumsy, boring and out-of-date.  That's wrong.  Java has changed the way programming is done, and for the better.  Java has been around a long time, and it's worth looking back to how most programming was done at the time Java appeared.

The most widely used development languages were C and C++, and they were used for all kinds of development projects, from the writing of hardware drivers to office software and databases.  It's possible to program clearly and robustly in C and C++, but it's also very easy to end up making disastrous errors.  The reason why errors are so easy is because C/C++ provides a recipe for pretty much direct use of hardware.  What seems to the programmer to be abstractions are in really nothing more than conveniences of syntax - making raw use of resources look structured.  An example is C arrays:

int store [100];

This looks like an array of 100 integers, but it's not really.  It's simply an area of memory that your program now knows about.  It C it's perfectly acceptable to refer to the 200th element of 'store', and even to write data into it.  C compilers can be set to check for this kind of thing, but that's not part of the language.  Compare this with Pascal

var store: Array 1..100 of Integer;

The compiler and program know what this is: an array of integers.  Try and access store[101] and you will get an error. 

Pascal is C with seatbelts.  It can be much safer because restrictions on what can be done can be designed into the language, and many dangerous operations can be checked at compile time, even though they will also result in safe reporting of a mistake when the program is running (although, to be fair, such checks can be turned off to improve program speed).

C/C++ has been a disaster for software safety and security.  It's use is the primary reason why we suffer from computer viruses and security holes. 

Another real problem with C/C++ is portability.  Compiled programs are almost always limited to one type of computer, and one operating system.  Write a C program for Windows and you aren't going to be able to run it by default on MacOS/X or Linux.   This is a real problem, as there are countless legacy systems written in C/C++ that cannot be moved to modern platforms as it would be too expensive to re-write them.

There were many portable and safe languages around at the time Java was invented - LISP and Smalltalk, for example - but these didn't make an impact on C/C++ development because they were so different in style.  Java copied C/C++ syntax so was relatively easy for developers to pick up. 

Java provided safety, in that it had a carefully managed and garbage-collected memory management, and there were many layers of security built-in, so that use of resources on a machine had to be carefully approved for code that was delivered over the network.  This hasn't always worked, but it's always been far safer than the C/C++ approach. 

But, best of all, Java was extremely portable.  Today, I routinely develop and test Java applications on Windows for deployment on Linux and Solaris, and there are no platform-specific problems.  This has made transition to modern 64-bit machines effortless - I haven't had to do anything but download 64-bit versions of the Java runtime.

When I have worked in a programming team, Java has been extremely useful because of the clarity of the syntax: code is not subject to the obfuscation that can be achieved in C/C++ through the use of macros and operator overloading.  Java syntax may look simplistic, but its explicitness is valuable.

Finally, Java has managed to combine safety with very high performance.  The 'hotspot' automated run-time compiling and tuning technology means that none of the traditional ways of manually optimising code are necessary, and instead developers can concentrate on clarity and functionality. 

Java's compatibility includes the ability to continue to run ancient (in IT terms) code on modern Java runtimes.  Java is one of the safest languages to use if you expect to be supporting an application for a decade or two, without the need to recompile all your applications.

 Java 8 allows for functional programming, increasing the power of Java to make use of parallel processing, with all the automation and safety that is typical of the Java language.

Java may not be the most elegant language, but it's status one of the most widely used (if not the most widely used) language is richly deserved.


Sunday 13 April 2014

Criticising Islam - do you need to read the Koran?

I'm in an interesting situation.  Two people I respect and admire have dramatically opposing views on the subject of Islam.  My friend Qasim Rachid is a spokesperson for the Ahmadiyya Muslim Community, a large international group of Muslims with humane and secular beliefs.  Then there is Richard Dawkins, who needs no introduction.

They came into conflict last year over whether or not it's reasonable to criticise Islam without having read the Koran.  To summarise, Richard said "yes" (in a typically controversial way), but Qasim said "no".

Both are right.  Let me try and explain why I think this.

The difficulty here is that a religion and the associated culture aren't a single thing; far from it.  A religious culture can be divided into at least three things:

1. The holy books, or doctrines, or scriptures.  These have usually been written some time ago and are generally considered to be the place to look to settle disputes about beliefs or commandments.

2. The culture.  This consists of activities and traditions that have become associated with a religion, such as ceremonies, types of food, codes of dress and so on.

3. The believers.

None of these in isolation define a religion.  A religion is a combination of what certain books say, what believers believe, and what believers do.  These factors can come together in very complex ways.

For example, the doctrines of the Catholic Church are very clear - contraception is forbidden: This is in no doubt.  Yet, in the USA, the overwhelming majority of Catholics are happy to use contraception.  So, the question "What is the Catholic view of contraception?" doesn't have a simple answer, because it depends whose views you are talking about.

So, is it reasonable to criticise Islam without reading the Koran?  That depends entirely on which Islam you are talking about.  If it's Islam 1, the holy books, then it isn't reasonable, because you have no evidence on which to base any criticism.  But, if it's Islam 3, the believers, then it can be reasonable, because the believers can be clear about what Islam means to them, and then you can criticise their Islam.

Religion type 3, the believers' religion, is what actually matters most, because that determines the impact of a religion in society.  In some (but by no means all) Western societies Catholicism's approach to contraception is relatively harmless, as no-one takes much notice.  In those societies Catholicism's approach to contraception isn't something that needs to be urgently addressed.

So, does it make sense to talk about a true version of a religion?  I doubt it, because of this composite nature of religion.  What it is like to be a member of a religion can vary considerably depending on where and when you are a member.  This is why I have a problem with those who insist that moderate or liberal versions of religions 'aren't true' in some way, and uses that to dismiss moderates.  It just doesn't make sense.

This seems to me to raise the question of how relevant it might be to take into account the contents of the books of a religion when discussing the social effects of that religion.

If my believer friends will forgive me for this, I'm going to use an analogy to try and help explain what I mean.  There are rules of the road, which, in the UK, are combined in the "Highway Code".  These explain what a driver is expected to know to be a good and safe driver.  They are the "doctrines" of driving.  Ask almost anyone who drives if they are a good and safe driver, and they will say "yes".  Ask them if they believe in the doctrines of the road, and they follow those doctrines and they will say "yes", but if you watch people drive generally, you will get a different picture.  Just consider the number of people who drive over legal speed limits in the UK - it's vast.  It's likely that the traffic police take this into account, and only prosecute really fast drivers on motorways (not that I am recommending breaking the law!).  And yet, few if any of those people who drive fast will consider themselves lawbreakers.  To them, the speed limit might be "interpreted" as meaning "don't drive too fast".

Two people can say that they follow the law, and they believe in the law, and in their minds they are both right, and yet their behaviour might be very different. If you want to find out what it means to be a driver in the UK, you have to watch the behaviour of drivers.  You won't get what it means to be a driver by reading the Highway Code, at least not by only doing that.

If you want to see what it means to be a believer, you have to watch the behaviour of believers.  You won't get what it means to be a believer by reading only the holy books.  Furthermore, you can't say who is a "true believer" based on those books any more than you can say who is a "true driver" by pointing at the Highway Code.  It doesn't help to point at the words in a holy book and insist that all believers believe that any more than you could point at a speed limit and say that all drivers believe in that.  All you can do is get evidence - observe.

Surely the point of criticising religion politically is to decrease suffering and oppression, and these are reduced when moderate versions of religions replace fundamentalist versions.  This is why I welcome engagement and co-operation with moderate and humane versions of religions, such as Ahmadiyya Islam, because it's vastly better than fundamentalist Islam; and has distinctly positive aspects such as the active promotion of secularism and freedom of belief (including none).

I am a certain atheist - I disagree with the view of reality of Islam, no matter what version, but when it comes to making the world a better place, I have no hesitation in praising the efforts of people such as Qasim Rachid, who is trying to reduce prejudice, suffering and oppression.  To reject his Muslim identity (as Sam Harris seems to have done), to talk about false and true believers, seems to me to be churlish and counter-productive.

However, I also agree, to an extent, with Richard Dawkins - it isn't vital to read the books of a religion to criticise the behaviour of believers.  But I would add this:  reasonable criticism should surely be based on all the evidence, at least all the evidence that is easily available, and both the Bible and Koran are easily available.

Why I support Chris Stedman

(Chris doesn't know I'm writing this - I hope he doesn't mind, and that I get facts right).

I have read something recently criticising Chris Stedman's work, and suggesting it's some sort of giving in to religion.  I really value what Chris does, and I certainly don't see it as giving in.

Chris Stedman is an out gay atheist who works as a humanist chaplain, and on various 'interfaith' projects, which involve people of different faiths (and none) combining their efforts to help mutual understanding and encourage respectful dialogue.

Some see Chris' stance as 'accommodationist': implying that he is conceding factual or moral ground to religious beliefs.  At least according to my understanding, this is not only wrong, but would be counter-productive to Chris' efforts, because what he is trying to do is to help acceptable and understanding of atheists, not the dilution of atheist beliefs.  There is a parallel situation that might help explain this: Chris' efforts also help acceptance of homosexuality, because he is an out gay man, and that acceptance would not be helped at all if Chris said that he "wasn't really very gay".

Talking to and co-operating and befriending religious people doesn't have to be about giving up beliefs or even pretending you have.  It's about not judging others based on labels.  It's about allowing humanity to be more important that doctrine.  In the end, it's about what we want society to be like.  Do we want anger and hate, or do we want civilized argument between people who will actually listen to each other?

Monday 17 March 2014

The Discovery of Gravitational Waves from the Origin of the Universe

Today's discovery of gravitational waves from the origin of the universe is the most important discovery in science since that of DNA.  I'll try explain why.  But first, I have to admit that I am not an expert physicist.  If you want the technical background go to someone who really knows what is going on, such as Sean Carroll - http://www.preposterousuniverse.com/blog/2014/03/16/gravitational-waves-in-the-cosmic-microwave-background/ I hope Sean writes a book on this, as his ability to explain such complex ideas is exceptional.  However, I'll try and give some idea.

Gravity curves space and time, as revealed by Einstein's work on General Relativity.  The reason why gravity pulls and diverts objects is because of this curvature.  Newton said that unless acted on by a force objects will move in straight lines.  Objects in a gravitational field move in the equivalent of straight lines in curvy space - these lines are called 'geodesics'.  Think of the surface of the Earth - the most direct route between two points at different longitudes away from the equator is not a straight line, but a curve called a 'great circle'.  'Great circles' are geodesics.  Following these 'curvy straight lines' is why objects are diverted by gravity.

As well as describing this curvature of space, Einstein also showed that changes in gravity travel at the speed of light, not instantly.  If the Sun vanished, it would take 8 minutes for the Earth to start to leave orbit, for example.

If you have curvature and that curvature can change, and the change has a speed limit, then you can get waves.  Suppose the gravity of the Sun could be turned on and off.  If this happened then pulses of gravity would travel out from the Sun's position.  If you have two objects orbiting each other, the constant change in position of the sources of gravity results in waves.

We know that gravitational waves exist because waves carry away energy and we can predict how quickly this will happen.  When the objects orbiting each other are very dense indeed, like neutron stars, then they will lose a lot of gravitational energy as waves, and their orbits will decay, and we have seen this happen.

Gravitational waves in the cosmic microwave background are such an amazing discovery because the cosmic microwave background is a microscope.  The microwave background is the light released when the universe first became transparent, when electrons stopped flying around and joined up with atomic nuclei.  This happened about 379,000 years after the origin of the universe.  The microwave background is extremely smooth, which is strange because the expansion of the universe is so fast that widely separated areas of the background can never have come into contact, to smooth out any differences.  So why is it so smooth?  One answer is inflation - the idea that the region of the universe that we can see started off extremely small and so was in contact, and then expanded incredibly fast, smoothing out any differences.  This expansion was so great that tiny quantum fluctuations became big enough to create the unevenness needed to allow gravity to collect gas together to build galaxies. Subtle fluctuations in the microwave background reveal what went on at a quantum scale.   So, gravitational wave effects in the microwave background show us ripples in gravity at a quantum scale, and the only way we can think of that these ripples have become big enough for us to see is if the ripples were blown up enormously because of inflation.

The cosmic microwaves take us back to hundreds of thousands of years after the origin.  We can see no further back because before that the universe wasn't transparent to light.  But, just about everything is transparent to gravity and gravitational waves.  When we see the gravitational waves we are looking back to the instant when our universe began, perhaps around the Planck time: 10-44 seconds - probably the shortest time that makes sense in our universe.  This not only confirms the idea of inflation, but it should allow us to get some idea of what happened at the very beginning of the timeline of our universe.

Thursday 6 March 2014

The case for religious same-sex marriage

I'm not one of those who say that religion cannot do good.  In the UK there is a history of churches working to help the poor and oppressed, forming and supporting communities that were of benefit to those included.  But now mainstream faiths are stuck in a reactionary rut when it comes to equality, and their resistance to moral progress results in real suffering, suffering that can and should be avoided.

The matter of equality I am talking about here is homosexuality: sexual attraction and love between two consenting adults of the same sex.

Love and sexuality is a core part of the lives of most people.  Their romantic and sexual relationships help define who they are and form an important way that they bond with others in society.   Rejection of the validity of same-sex relationships is a strong factor in excluding people from participating in the rituals and institutions that, for most people, help them to be accepted as full and equal members of society.

The refusal to allow same-sex religious marriage denies many people the right to fully engage with their religious beliefs.  Some may share the belief that the appropriate place for sexual activity is between loving couples within marriage, but the denial of marriage for such people forces them to choose between celibacy and what they consider to be sinful fornication - a choice that heterosexuals don't have to make.  And so, homosexual believers are not only labelled as sexually disabled by their religions but also told that the only sexual relationships they could ever have is sinful.

Just imagine what this can do to youngsters.  Those entering the confusing time of puberty and with their first feelings of love and desire are being told by their religious culture that they are lesser people, that they haven't grown up fully in the way that God wants, that their loves can never be blessed, that their sexuality is forever sinful.  This can do great psychological harm both directly and indirectly, because being labelled as inferior by their culture makes such youngsters easy targets for bullies.  Bullying of homosexual youngsters happens on an epidemic scale in the UK, and associated with that bully are both depression and suicides.  Religions should not be providing the basis for bullying and misery of youngsters.  They should be preaching virtues, the virtues of love and equality, and they should be preaching against prejudice with all their power.

Religions can claim the inferiority of same-sex relationships in many ways.  One of those is naturalness, and yet homosexuality is widespread in nature, just like heterosexuality.  But then so is killing and suffering.  Naturalness should never be a criterion for what is good, and moral.  Another way is based on Bible texts, but that has no solid foundation as modern Christianity rejects much that is in the Bible as outdated and irrelevant.  Yet another way is to point out that homosexuality cannot give rise to children, and yet there are no fertility tests necessary for heterosexual weddings, and many couples are married when their is no possibility of children being produced.  Same-sex couples are said by some to be inappropriate situations for children to be raised, even if acquired by adoption.  The evidence is against this, but, anyway, the question of adoption is not relevant to the question of marriage.

Christians should consider the words of Jesus: "Let the little children come to me, and do not hinder them, for the kingdom of God belongs to such as these."  Don't hold back youngsters from Jesus (or Mohammed, or the Buddha) because of who they will love and desire.  Let them know that they are fully loved in all respects, and the Church will, if they want it, provide the same foundation for their loving sexual relationships as it does for those who love the opposite sex.  

In the play "8", a dramatisation of the fight for equality against California's Proposition 8, a mother points out that little girls don't dream of civil partnerships.  They don't - they dream of marriage, with all its ceremony and its acceptance.  Let their dreams not be in vain.  Let couples who love each other share fully in your culture whatever that culture may be.  

Wednesday 5 March 2014

Praising Panti - rejecting all LGBT bigotry.

How did I not know about the wonderful Panti Bliss? His/her attack against prejudice that has got so many in Ireland worked up is something I fully agree with, and has made me realise I am being too tolerant. 

Rejection of same sex marriage is, of course, not on the same scale as violence and imprisonment of LGBT people, but it's still both wrong and harmful - it's still homophobia.

If a preacher refused to marry a mixed-race couple there would be no hesitation in calling that preacher racist, and not just some tradition-respecting eccentric.

Religious rejection of same-sex marriage is homophobic, and it does tremendous harm because it institutionalises prejudice. Imagine being queer and raised in even a mildly religious family belonging to a faith that says that your future loves are fundamentally unequal, and can never be celebrated in the same way as the loves of others. This is a form of bullying in the supposed name of morality.

I have religious friends who aren't comfortable with religious same-sex weddings. I ask those friends how they can maintain that position considering the message of moral inferiority they are sending to youngsters - telling those youngsters that their community rejects them, that they were born morally flawed.

To those friends: I know you are better than that. Please help support equality for all.