Researchers at the University of Sussex in UK asked pupils at a secondary school to design and programme their own computer game using a new visual programming language that shows pupils the computer programmes they have written in plain English.
Dr. Kate Howland and Dr. Judith Good found that girls in the classroom wrote more complex programmes in their games than the boys and also learnt more about coding compared to the boys.
There are persistent concerns about the under-representation of women in computing - only 17 percent of the UK's computer science graduates in 2012 were female, despite a promising reduction of the gender gap in maths-related subjects at school level, researchers said.
Some believe that girls are put off in their teenage years by the common portrayal of the 'nerdy boy' in TV and film.
This new study suggests that girls can be motivated to explore programming and create rich gameplay experiences by building on their skills in literacy and storytelling.
"Given that girls' attainment in literacy is higher than boys across all stages of the primary and secondary school curriculum, it may be that explicitly tying programming to an activity that they tend to do well in leads to a commensurate gain in their programming skills," Good said.
"In other words, if girls' stories are typically more complex and well developed, then when creating stories in games, their stories will also require more sophisticated programs in order for their games to work," Good added.
The young people, aged 12-13, spent eight weeks developing their own 3D, role-playing games, using software made available with the popular medieval fantasy game Neverwinter Nights 2, which is based on the popular Dungeons & Dragons franchise.
Games like these are built on 'scripts', simple programmes that describe what happens if or when a particular condition is met - e.g., if the player kills the dragon, a message is displayed on screen.
However, many young people with no prior programming experience are daunted by the complexity of the coding languages used to build these scripts.
Howland and Good developed a new programming language called Flip that 'scaffolds' pupils as they script events within their game. It uses a simple interface in which users create scripts by connecting graphical blocks together.
The girls used seven different triggers - almost twice as many as the boys - and were much more successful at creating complex scripts with two or more parts and conditional clauses.
Boys nearly always chose to trigger their scripts on when a character says something, which is the first and easiest trigger to learn.
The study was published in the journal Computers and Education.