It is hardly surprising that many teachers find it hard to appreciate the value of smartphone technology when every day they have to battle to keep the attention of pupils constantly distracted by texts or Facebook.

The smartphone is a wonderful piece of technology, and an immutable part of modern life, but in the classroom it can also be the enemy of learning and discipline. It can be a weapon too, used by bullies to spread malicious gossip and target victims, but none of this means the mobile should be dismissed as a troublesome piece of technology with no place in schools. That is unrealistic – in the right context there is no reason why a smartphone cannot be a valuable tool in the classroom.

This would appear to be the thinking behind a new initiative to teach pupils how to make their own smartphone apps. The hope is that, in designing the apps, the pupils will learn the kind of skills needed for the computing industry and go on to help drive success and innovation in the sector.

Scotland has already demonstrated great skill and promise in this area, not least in computer games technology courses at Abertay University in Dundee, but there have been rumblings for some time that our failure to teach programming in a dynamic and engaging way in schools is threatening our future in the industry. Google chief executive Eric Schmidt has said as much and we would be foolish to ignore him.

Teaching apps in the classroom could play a part in addressing this problem. If computer technology is to be made engaging and interesting for pupils – and it needs to be – then it has to be taught properly. The subject should be related as much as it can to the pupils' lives, and every parent knows how important mobiles are in those lives.

Indeed, engaging pupils in this way is one of the aims of the new Curriculum for Excellence and it is a welcome one. There is little point in teaching facts about computing that can be regurgitated on exam day and then simply forgotten. The aim should be to teach skills that can excite and engage but can also be useful in wider society.

Whether the teaching of smartphone apps will achieve any of this will not be known for some time, but the need for it is clear. Countries such as China and Brazil have embraced the teaching of computer technology and Scotland must be careful not to be left behind.

This doesn't mean a free-for-all on mobiles in schools – there is still a balance to be struck between a learning tool and a source of trouble. But part of the aim of the Curriculum for Excellence is to establish a healthy link between schools and the real world.

The smartphone has revolutionised the real world and it should have a role to play in the learning environment in preparing pupils to get on in that world.