Coding and The Chocolate Factory...with Robert Cordina—Coding at Work Series

In Roald Dahl's Charlie and The Chocolate Factory, we meet lots of magical creatures and fantastic devices that are used to create marvellous new chocolate inventions. In the real world, there are real scientists who do this work. They're not quite Willy Wonkas—they're better than him!

This week, we meet one of these scientists. Robert Cordina leads the Computational Chemistry and Process Modelling for the Research and Development department of a global snacking company. You'll certainly find his work (along with many of his colleagues') in your kitchen cupboard!

Robert studied Chemistry and Physics as an undergraduate and then went on to pursue further studies in Chemistry at the University of Malta, Imperial College, Cardiff Metropolitan University, and the University of Strathclyde.

You might be asking: What's coding got to do with chemistry? Let's find out.

Coding in Chemistry

We asked Robert how coding has changed his field of work. He corrected us—change is not the right word:

"My field of work wouldn’t exist without computer programming. Modelling and simulation are all about coding, especially in the specific fields that I work in. Not only would the simulations be impossible to run without programming, it would also be impossible to analyse any resulting data manually."

The clue is in the name: Computational Chemistry.

Indeed, many areas of science have developed computational branches in recent decades, as coding has become more widespread and more powerful.

Learning to Code

We asked Robert when he first learnt to code and what made him want to learn:

"I first learnt to code in GW-BASIC when I was about 9 or 10 years old and I wanted to learn because I had an ATARI machine that I wanted to create games on. I then moved to QBasic at school as part of Computer Science. I always found coding really interesting, as I always found the fact that you can program a machine to do whatever you want it to do fascinating."

Robert now uses Python as the key language in his work. Python has become the main language for scientific programming, not just in computational chemistry.

Quick-Fire Coding Questions

We had a final flurry of quick-fire questions for Robert, too, before we let him get on with working on more chocolates and biscuits!

Which programming languages do you mostly use?

"Python, Bash, gPROMS"

Do you enjoy coding or do you do it because you have to?

"Definitely enjoy it"

What’s your favourite module or function in coding?

"Numba (in Python) – the speedups achieved by using GPUs to carry out large numbers of calculations is incredible!"

What’s your top tip for anyone starting to learn to code?

"Short answer: — Long answer: Use a real-case scenario where you have to produce results, as this will force you to sit down and code. You will most likely not know how to code for what you want to achieve, but someone will have had your same problem and asked it on!"

Final Words

Thank you to Robert for the great insight into how coding is used in chemistry and in helping to create foods and snacks. This example of coding used in the real world represents perfectly how coding is used in many professions. Robert is a chemist and a programmer. Computer programmers aren't just those who work full time to write software. There are many more programmers who use coding as an essential part of their profession.

Yes, websites and apps and games need coders to create them. However, next time you reach out for a chocolate or a biscuit, you should remember that coding was part of the process when making those snacks!

You can find out more about Robert Cordina's work using coding in chemistry on his LinkedIn page.


Sign-up to get notified when new posts are published