Saturday 28 April 2018

Teaching Blockchain

Recently started developing materials to teach and deliver some of the ideas around blockchain to a group of MSc Computing students within a module on internet programming. This post is really is reporting what I did, but I would be very interested to hear from others on their ways of delivering this topic.




1. First teaching approach

Goals I was hoping for, were:

  • For the students to consider what are blockchain and distributed ledger techniques;
  • Getting them to thinking like programmers (which they are) about the techniques rather than the hype - they may in the future be the one who has to persuade someone to either go with a distributed ledger solution or equally not.
  • For the students to see code that builds up a local blockchain (local to their machine) to see the basic principles.
  • To play with code for developing Smart Contracts (in this case Solidity) and think about how it could be expanded upon.

My decision was to initially go with a flipped approach of providing a set of materials on blockchain before the session, expecting the students to use them with some guidance and following it with the 'blockchain game' and user case example activity. The next session focused on introducing a bit of blockchain programming with some programming examples.

Separate to the two sessions focused on here, awareness of blockchain was 'sneaked in'/embedded in a few places within the module. 
  • Often as an example of current practice in internet programming. 
  • A further example, took the form of blockchain project (the #BlockchainEducationalPassport (https://blockchainedupass.uniteideas.spigit.com/Page/Home) project) was used as a case study as part of their assessed work. They didn't need to produce a blockchain but it was more along the lines of:
    • What data would you store for this case study?
    • Now you have the data what could you do with it?


2.The Blockchain Game


2.1 Rules You will be placed into groups by the tutor, please do not use the computer for anything else during the task part of the activity, but as a source of the rules of the activity. Each group will need

  • one sticky note/sheet of paper per group to store the 'blockchain'
  • paper and pen for each member of the group.
Please note groups are of different sizes on purpose - this is part of the exercise. 
Now your group's sticky note divide the note up in the same way as below.





We are now ready to start the game.


Rounds in the game
1. The tutor will provide a new 'block' it will be in this case a single number each round, this is the data. (Note: in an actual blockchain this will be a much more complex bit of data).


2. To slow the system down, increase security - the winner needs to do some work. This is the Proof of Work concept. Each member of the group needs to individually calculate the new Hash value using the following rule:
HASH = Prev + (Data*25)-1255
3. Each group decides on their answer and is trying to be the first to give the correct answer. Only one answer per group at a time. Before starting the game the group will decide on a mechanism for giving the answer - e.g. agree and answer or first to get the correct answer says it.
4. The tutor will decide who wins - the decision is final.


5. The winning team gets the win and every group now writes down the data and the new hash BUT only after the winner has been found. also start a new block with the hash just being calculate written in as the previous hash in the new block.


6. So a blockchain has a new item in the blockchain and every group's blockchain is the same. Now go back to step 1 the games carries on until the tutor ends it.


 



2.2 Reflection activities
Groups that have only one member during the task join together now to be a new group called the 'one and only'. Groups with two members only will join together to be a single larger group called 'two's companies' and the group(s) with four or more members will join together to form a single group called 'hydra'
Step 1 Individually - no discussion at this time do the following (15 minutes)
1. What I have learnt during this activity?
2. Do you think there is some benefit to larger group sizes for this problem?
3. What do you think the role of the hash and proof-of-work is?
4. What do you think would happen if someone tried to alter the data in the middle of the blockchain after other blocks have been added?
Step 2 Group. (15 minutes)
Using the same questions 1 to 4 come up with, after discussion, a single set of answers for the whole group.
Step 3 Sharing. Each group will present their findings. (10 minutes)
When not presenting the other two groups are expected to listen, take notes where appropriate and after the presenting group has finished be prepared to ask questions.
Step 4 (outside of the class): To consider individually or as a group.
(a) Think about your individual answers, group's answer, new insights you gained from the other groups and from sources external to the class; then possibly revise your answers. 
(b) Can you improve the game, for example change it so it might take several iterations to get the right hash (look up how bitcoin does this - no need in the game though for SHA256)



3. User Case Activity
In this activity, the three groups are given three different scenarios; sample examples include a social solution, cryptocurrency or supply chain activity. They were asked to consider a range of issues that a programmer or developer might have to consider for example
- What data would need to be stored within the blockchain for this scenario?
- Who would hold and mine a copy of the blockchain?
- Why would someone hold and mine the blockchain? What is their incentive?
- Why not use a centralised database for the scenario?


4. Reflection and where next
These initial activities were purposely designed to not involve coding. Though the choice of programming language is not always independent of the approach, I believe cutting through to the requirements is a central part of the programming the solution, and this is largely independent of the approach.

The previous section provided been an opportunity to think about blockchain and be critical of it. These students though have mostly come from through a technical computing route, and so some of the teaching programming examples used in the class and the logic behind them will be discussed. These are simple examples; only meant to get some basic ideas across that the students can then build on.



5. Javascript version
This section looks at a producing a blockchain on a local machine - to build up the ideas gradually. Confession time, my starting point was the fantastic videos shown below from Simply Explained -Savjee - really nice introduction - I recommend these as a starting point.






Visual Studio Code was used with JavaScript and running Node.js - a little bit of setting up is needed but certainly on a Mac or Linux machine it wasn't too difficult. So the code was built up and the following produced:
//adapted from the videos of Simple Explained -Savjee
//https://www.youtube.com/channel/UCnxrdFPXJMeHru_b4Q_vTPQ


const SHA256 =require('crypto-js/sha256');


class Block{
constructor (index,timestamp, data, previousHash = ''){
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.previousHash = previousHash;
this.hash = this.calcHash();
this.nonce =0;
}


calcHash(){
return SHA256(this.index+this.previousHash+this.timestamp+JSON.stringify(this.data)+this.nonce).toString();
}


mineBlock(difficulty){
while(this.hash.substring(0,difficulty) != Array(difficulty+1).join("0")){
this.nonce++;
this.hash = this.calcHash();
}
console.log("Block mined hash: "+ this.hash);
}
}


class Blockchain{
constructor(){
this.chain = [this.createGenesisBlock()];
this.difficulty = 4;
}


createGenesisBlock(){
return new Block("0","13/3/2017","Start","0");
}


getLatestBlock(){
return this.chain[this.chain.length-1];
}


addBlock(newBlock){
newBlock.previousHash=this.getLatestBlock().hash;
newBlock.mineBlock(this.difficulty);
this.chain.push(newBlock);
}




isChainValidOne(){
for (let loop=1; loop<this.chain.length; loop++){
const current = this.chain[loop];
const prevOne = this.chain[loop-1];
if((current.hash != current.calcHash())||(current.previousHash != prevOne.hash)){
return false;
}
}
return true;
}
}


let educoin = new Blockchain();
educoin.addBlock(new Block(1,"10/7/2018", {name : "Ali", qual : "PhD", qual1 : "BSc"}));
educoin.addBlock(new Block(2,"10/7/2018", {name : "Scott", qual : "PhD"}));
educoin.addBlock(new Block(3,"10/4/2018", {name : "Scott", qual1 : "Swimming Certificate"}));


console.log(JSON.stringify(educoin,null,4));
console.log("Is the chain valid ? "+educoin.isChainValidOne().toString());

The idea of going down this route was

  •  the students are familiar with JavaScript; so it follows on from what they comfortable with; 
  • promotes the idea that blockchains are not language specific; 
  • the elements of the block and blockchain can be seen - without the language getting 'clever' and hiding how it is done.




6. Solidity
The second stage was build up an example to go onto the Ethereum blockchain. So I decide to show Solidity, which is a programming language for doing this. After experimenting with various options I decided to use the free (always good) online integrated environment from Ethereum called Remix (http://remix.ethereum.org/) and stick with the online version. Remix meant that there wasn't any extra installation, it is pretty self-contained and it comes from Ethereum itself. 

So the code produced is inspired by the #BlockchainEducationalPassport (https://blockchainedupass.uniteideas.spigit.com/Page/Home) project - but much simpler. The code sets up a record for a student (name and qualification) and adds it to a list/array of students.

pragma solidity ^0.4.0;

contract educoin1 {
        struct edRec {
            string name;
            string qual;
        }
        address public student;
        mapping (address => edRec) public Students;
        address[] studentsByAddress;
        
        
        function add(string _student, string _qual) public {
            address thisAddress=msg.sender;
            Students[thisAddress].name = _student;
            Students[thisAddress].qual=_qual;
            studentsByAddress.push(thisAddress);
        }
}

The figures below show a 'record' being added (figure 2) and then looking at waht is stored (figure 3)


Figure 2: Entering the record

Figure 3: Seeing the transactions
Following links to material on Solidity, the students were asked to alter the solution in ways that interest them.




7. Where next
The final part of the session was to look at Distributed Ledger alternatives to Blockchain - but not the programming them. Tangle used in IOTA https://www.iota.org/get-started/what-is-iota was discussed, to give a contrast with the serial nature of blockchain. As IOTA is mainly used in the Internet of Things (IoT), it also formed a nice link to the next part of the module thinking about IoT.

Update: On reflection, it made a good assessment vehicle - it is relatively new so there is a lot for Masters students to explore but there are a lot of great resources out there as well to help. 

I would love to hear how others are teaching this subject; please free to add your approaches in the comments section of the post.



All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

Monday 23 April 2018

wearable devices for motivating patients via gaming

Al-Mahmood, A. and Opoku Agyeman, M. (2018) On wearable devices for motivating patients with upper limb disability via gaming and home rehabilitation. Paper presented to: IEEE International Workshop on Internet of Things: Networking Applications and Technologies (IoTNAT 2018), Barcelona, Spain, 23-26 April 2018

Abstract
Recently, games have become increasingly popular in many different areas such as military, health care, entertainments, education and government due to advancement in technology which have made it easy to interact with games. Specifically, the application of wearable devices, games and Internet-of-Things (IoT) can create a motivating atmosphere to facilitate the rehabilitation process of patients while enabling remote monitoring of their health and progress. In this paper, we focus on recent contributions that aim at enabling the rehabilitation process of patients suffering from upper limb disability as a result of stroke through a combination of gaming, wearable technology and/or IoT.



All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

Thursday 19 April 2018

Is VR teaching as good as traditional methods?

Taken from the original source:

Research questions whether virtual reality teaching is as good as traditional methods


Using virtual reality (VR) technology to teach in universities might not be as conducive to learning as traditional methods, according to a Computing student from the University of Northampton.
Yoana Slavova’s research suggests the human brain can become overwhelmed when exposed to VR, making it hard to recall the information afterwards.
The Master’s student’s paper, which was co-authored with Senior Computing Lecturer, Dr Mu Mu, has caused a stir in the industry, and was presented at IEEE VR 2018,, a leading conference on 3D and virtual reality research held in Germany.
Yoana’s study was centred around a simple, but fundamental question: Does the ‘wow effect’ of VR contribute much, if anything, to students’ learning outcomes in Higher Education.
She said: “While VR is increasingly adopted by primary and secondary schools in the UK to improve pupils’ engagement, it is unclear how the technology would and could impact the learning of hard sciences in universities.
“Our study found that while university students see VR as a great platform to isolate them from real-world distractions, the extra cognitive load brought by VR content has a detrimental impact on how they memorise important quantitative data.”
The report recommends VR is most effective if used in short sessions to complement the conventional delivery of lectures and seminars.

Yoana and Mu Mu supervise students who are using virtual reality headsets
Yoana and Mu Mu
Students using virtual reality headsets

The study was carried out at the University of Northampton and saw more than 50 students from the institution take part in an experiment.
The students were split into two groups and both attended separate short lectures on the history of Stonehenge.
Group A’s lecture was delivered using a PowerPoint slide presentation. Group B were provided with the same content, but delivered via VR headsets. The research then evaluated the knowledge acquisition through tests and interviews.
Dr Mu Mu said: “Our aim is to synergise the strengths of immersive technologies and conventional tools for better learning experience and outcomes. I am very pleased to see Yoana’s research project recognised internationally.”
For more details about the study, see the Virtual Reality overview report.

All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

Monday 9 April 2018

BCS Northampton Event: Robots in home and school – not Sci-Fi.(updated)

Tuesday 17th April 2018
Title: Robots in home and school –  not Sci-Fi.

Speaker: Dr Scott Turner


Abstract
At the moment it is hard to miss concern about robots taking jobs and the need for school-age children to more engaged with computing. In this session, we will look at, from the presenter’s personal perspective, robots in schools and youth groups. As we will have an opportunity to play with building robots from ‘junk’ http://robotsandphysicalcomputing.blogspot.co.uk/2017/10/crumble-based-junk-eggbot.html (through crumbles and PiTops); some simple robots; up to playing with a humanoid robot.




The videos used in the presentations are shown below. The first video is an introduction and welcome from Red the Nao robot.






Next video shows a programmed Cozmo, using Anki's graphical programming language.



Biography


Dr Scott Turner, currently Associate Professor in computing and Immersive Technologies, at the University of Northampton. He has two main research interests. First robots and AI, with work carried out in machine learning to health and industry. As well as Computing Education and Technology Enhanced Learning, actively involved with promoting computing in schools. Dr Turner is a Certified Raspberry Pi Educator; lead two Code Clubs; part of the organising group for a Coding Competition, chair of the University of Northampton’s STEAM steering  group.

The presentation will be held in Room NW205 of The Newton Building at The University of Northampton, Avenue Campus, St Georges Avenue, Northampton, NN2 6JB

Doors will open at 19:00 hrs, The Presentation will commence at 19.30hrs.

The presentation will be held in Room NW205 of The Newton Building at The University of Northampton, Avenue Campus, St Georges Avenue, Northampton, NN2 6JB

Please park in Cark Park 6 (mention the BCS Lecture on the intercom). 

Meet one of the robots



Related Links

University helps inspires next generation to get into computer coding



All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

Saturday 7 April 2018

learning outcomes and experience of VR in education


A comparative study of the learning outcomes and experience of VR in education
Slavova, Y. and Mu, M. 
IEEE Conference on Virtual Reality and 3D User Interfaces (IEEE VR 2018). Germany: IEEE.

Abstract
Virtual Reality (VR) is believed to have a pivotal role in transforming teaching and learning in higher education. The novelty factor and full immersion in a virtual environment can undoubtedly improve students' attention. However, it is still unclear how the use of VR would impact the learning experience and outcomes with respect to knowledge acquisition. We conducted a comparative study on students' performance in a standardised assessment when course content is delivered using VR and conventional lecture slides. Results show that improvement in social interaction and productivity tools in VR are essential for its greater impact in higher education.

Cite: Slavova, Y. and Mu, M. (2018) A comparative study of the learning outcomes and experience of VR in education. In: IEEE Conference on Virtual Reality and 3D User Interfaces (IEEE VR 2018). Germany: IEEE.

For more information contact Dr Mu Mu   or on twitter @DRMMU
Alternatively, go to https://drmu.net/2018/02/08/does-wow-translate-to-an-a-a-comparative-study-of-vr-based-learning-in-higher-education/ 

All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon

Wednesday 4 April 2018

Further Experiments in Teaching Neural Networks

The basis of this idea was inspired by some work that can be found in the paper Varley et al (2005). The idea is to use spreadsheets as a tool for teaching neural networks. These approaches were developed for the teaching of these approaches and the videos were recorded in a class whilst teaching the concept. Both Excel and Google Sheets have been tried in all three of the approaches.

1. Creating a single neuron
The idea was to use a spreadsheet to replicate the neuron. The idea was to get the students to build the neuron step by step, starting with the inputs, then the weights, then the weighted sum and threshold for a simple neuron. Personally, I like the approach for two reasons; firstly the concept that only a single set of weights is used is sneaked in, the second is builds all the stages up gradually and visually.
Video below shows the building of the model and it's use. 



2. Training a single neuron.
This approach extends the ideas from the approach above, quickly building a single neuron, but expands into training a neuron. Cutting and pasting the blocks to show the idea of epochs.

Training is via the delta rule (change in the weight [x] = learning coefficient * input [x] * (what output we wanted - actual output from the neuron). I like the approach because it seems to show the weights being arrived at in a very mechanical way by repeating actions -  machine learning is not magic!

The video below shows the stages.



3. Building a simple Neural Network

Previously only a single neuron was produced. In this approach, the ideas from build a neuron in Excel activity are extended to three neurons connected in the same worksheet. The exercise then connects the outputs from two neurons (which have a common input) as the inputs of a third neuron building an XOR gate (which a single simple neuron can not implement). The video below shows all of the stages.


 




4. Where next?

It would be nice to extend the idea further to have the training of a simple neural network above. If anyone manages this please add the link into the comments.


Bibliography
VARLEY, M; PEAK, M; HEYS, J; COLLINS, G; KONSTANTARAS A,  VALLIANATOS, F; PICTON P (2005) Spreadsheet Software as a Teaching Tool for Concepts in Electronic Engineering, [Online] http://www.wseas.us/e-library/conferences/2005athens/ee/papers/507-162.pdf accessed on: 20/2/2016

Turner, S. J. (2017) Experience of using spreadsheets as a bridge in the understanding of AI techniques. Paper presented to: 13th China Europe Symposium on Software Engineering Education (CEISEE), Athens, Greece, 24-25 May 2017.


All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with

All views and opinions are the author's and do not necessarily reflected those of any organisation they are associated with. Twitter: @scottturneruon