Main content

Einstein & Newton: The brains behind the future of BBC Bitesize

James Constable

Acting Engineering Manager, Knowledge & Learning

Over the last year, the Bitesize teams in Glasgow and Salford have been hard at work designing and shaping the Bitesize Mobile App for iOS and Android. Acting Engineering Manager James Constable outlines the aims behind the app and the challenges faced by his team.

Bitesize reaches 78% of GCSE-aged students in the UK, with 4 in 5 saying that it helped them to feel more prepared for their exams (1). It provides easy access to thousands of study guides and revision materials. In the past Bitesize has offered a one size fits all approach to accessing that content via its website, but when designing the Bitesize App we sought to make it easier for students to find what they need by only showing the content that is relevant to their studies.

The Challenges

Implementing these requirements offered some particular challenges to the team. The Bitesize Website talks to a varied collection of services to get information about the curriculum and the content associated with it. This includes our content management system, the BBC video metadata API, a triple-store that contains the curriculum ontology, the BBC Quiz engine ACME as well as our own propriety services that render equations and provide access to binary assets.

Having the App talk directly to all of these services would have increased complexity massively, and require us to reimplement the business logic for Bitesize in not only PHP (which the Bitesize Website is built using) but also Objective-C (for iOS) and Java (for Android).

With the additional desire to make this experience personalised for the user we knew it was time to build a service that would provide a solid foundation to build our Apps on and abstract those complications into a single place.

The Solution

Our solution was to build out a new data service layer for both versions of the App to talk to that would abstract away that complex business logic, or the need to talk to multiple different sources to retrieve and combine data.

Following a microservice architecture, we elected to split the data service layer in two - one for all of the content needs, and another to provide the layer of personalisation - and we called those services Einstein and Newton. The Bitesize Web Services team in Glasgow then set about implementing this strategy.

Each of the data services was designed as a RESTful API that followed a set of API Design Principles we defined. We wanted them to be generic and extensible so we could build new features atop of them and ensure (as much as possible) that the effort to implement those features was minimised across our platforms.

Technical Details

Over the last 18 months we’ve been moving our application and data services away from the BBC’s Forge infrastructure and towards cloud hosting services. Cloud hosting provides us with the flexibility to use modern technologies that we can develop quicker, deploy quicker and - most importantly - get value to BBC audiences quicker.

Our team had previous experience of transitioning applications to cloud hosting, using a relatively new platform - Node.JS. We elected to do that again for Einstein and Newton. Node.JS allowed us to lean on the JavaScript expertise that was already abundant in our team and the asynchronous, non-blocking paradigms it provides were perfect for a service that had to be in contact with many other BBC services for each request.

The traffic patterns around the Bitesize app are such that it isn’t always under heavy load. There are distinct peaks around exam time, and troughs around the summer holidays. Hosting the service on the AWS cloud means that we can reduce the infrastructure to save money during these quiet periods, but quickly scale up as demand increases.

A little help from our friends

While building Einstein and Newton we leant on a number of services provided by other teams in the BBC to help provide some of the infrastructure we needed.

The MyBBC platform provided us with an easy to integrate way of handling user authentication and storing user preferences in their ID and UAS services.

Our colleagues in Sport provide a system called Morph that provides us with a simple and effective way of pulling data from our database services, combining it and effectively caching that data.

The Platform Services team provide a ready to use API management tool that allowed us to implement key based profiling of our data services, allowing us to effectively monitor their use and understand the their performance.

Effectively combining these existing services meant that we were able to build out our service layer quickly - combining a lot of great work the BBC has already done, with our own team’s expertise in the UK curriculum and educational data models.

Ensuring quality

Right at the start of the project our Engineering team got together to discuss how we would go about testing these services. Traditionally the Bitesize team follows TDD and BDD principles when writing new features. This is backed up by a manual QA process where those features are double-checked to ensure that they implement the required functionality and meet the agreed specification.

APIs offer a unique challenge for testing. There isn’t a nice, visible interface to compare to a UX specification - the data is exposed as JSON structures that are primarily strings of text.

We decided that we didn’t want to submit our Test team to manually inspecting JSON structures and instead elected to have our developers and testers pair together to write integration tests for each feature that get run whenever we deploy a new version of the API.

We coupled this with an API spec written in API Blueprint. This open standard allowed us to communicate the API requirements and quickly provide mock services to the team building the native clients.

Automation all the way

One of the big changes we made was to go from manually releasing our code between integration, test and live environments to a fully automated deployment process.

Using Jenkins, an open source Continuous Integration platform, we were able to set up a pipeline that runs our unit tests, and performs static analysis on any changes to the code. If these checks pass then we automatically promote the code to the next environment and run a suite of integration tests. This ensures that what is deployed continues to meet the requirements of clients interacting with the API.

We also run the integration tests every night against each environment. Notifications of these appear in our Slack channel, allowing us to see immediately every morning whether any problems have occurred since the last deployment.

The Next Steps

As the App evolves we’ll add more features and expand the capabilities of these APIs. We’ll also be updating the Bitesize Website to bring the new features that the App provides to our web users - reusing the platform provided by Einstein and Newton to simplify that process.

(1) Based on research conducted by EdComs Research who specialise in research with teachers, learners of all ages, parents and education stakeholders.

More Posts