Tuesday, 25 March 2014

#FLMobiGame: Introduction to solving complex problems

Introduction to solving complex problems

So far we’ve looked at solving simple problems using conditional and looping constructs. But what if there is a complex problem where a combination of conditional and looping constructs have to be used? Or, multiple conditions and multiple looping constructs have to be used? In this tutorial we’ll cover how to tackle some of these problems by applying what you have learnt so far in the course.
Consider a grading system with four different grades: A, B, C and D - where A is the highest grade and D the lowest. The system of grades is defined as shown below:
GradeMarks
Amarks > 75
B50 < marks <= 75
C35 < marks <= 50
Dmarks <= 35
The algorithm to determine the grade when a mark is given should go something like this:

  • Line 1: Begin
  • Line 2: Check marks
  • Line 3: If mark is greater than 75 then Grade A
  • Line 4: Otherwise,
  • Line 5: if mark is greater than 50 but less than or equal to 75, then Grade = B
  • Line 6: Otherwise,
  • Line 7: if mark is greater than 35 but less than or equal to 50, then Grade = C
  • Line 8: Otherwise, Grade = D

  • Line 9: End
This algorithm has several conditional statements. First it needs to be checked whether the mark is greater than 75. If the mark is not greater than 75, there are many possibilities. So there are two more conditional checks within the ‘Otherwise’ part of the first conditional statement. Because these conditional statements are inside one another they are described as ‘nested’ conditions.
Implementing this in a Java program using ‘if’ statements would look like this:
int mark;
String Grade;
if ( mark > 75 )
 Grade =  "A";
else {
 if ( (mark <= 75) && (mark > 50) )
 Grade = "B"; /*in the above condition you do not need to check (mark <= 75) as we only get to this point if it is so. We have shown it here for clarification*/
else {
 if ( (mark <= 50) && (mark > 35) )
  Grade = "C"; /*similar to previous condition check we do not need (mark<= 50) here as execution gets here only if that is true*/
 else
  Grade = "D";
 }
}
Now can you improve this program to check whether the value of ‘mark’ is non-negative? Not greater than 100?
To check the non-negativity you will have to add an additional conditionif ( mark >= 0 )
To check whether the mark is less than 100 you will have to add another condition if ( mark < 100 )
But if you want to make sure the mark is non-negative AND less than 100 you can use this condition:
if ( ( mark >= 0 ) && ( mark < 100 ) )

Nested looping

Here’s an example of nested looping: Suppose we have the marks for a class of four students and we want to sort these into ascending order. An algorithm can be used to design a program to do this.
First, you need to identify the steps required to rearrange the marks into ascending order.
The array, representing the marks of the four students, should start out like this:
070
160
226
39
After sorting the elements into ascending order the array should look like this:
09
126
260
370

Pass 1:

070
160
226
39
Step 1: Compare the element at index 0 with element at index 1 (in this example 70 and 60). Then swap them over to sort the two values in ascending order.
060
170
226
39
Step 2: Compare the element at index 1 and index 2. That is 70 and 26. Now switch them around.
060
126
270
39
Step 3: The element at index 2 is compared with element at index 3. That is 70 and 9. Because 70 is greater than 9 you will have to swap them over.
060
126
29
370
At this point the largest value of all has reached its correct position. So in the next pass you don’t need to compare the last element.

Pass 2:

060
126
29
370
Step 1: Compare the element at index 0 with the element at index 1; 60 and 26 and swap them over.
026
160
29
370
Step 2: The next comparison is between the element at index 1 and the element at index 2; 60 and 9. Swapping is done to achieve ascending order.
026
19
260
370
At this point the next largest value (60) has also reached its correct place in the sequence.

Pass 3:

026
19
260
370
Step 1: the elements at index 0 and 1 ( 26 and 9 respectively) are compared and swapped.
09
126
260
370
The marks are now arranged in ascending order, so no more swapping is required.

Implementing nested looping

Two loops (nested loops) can be used to implement this program.
First, these values need to be stored in the program. The marks are whole numbers between 0 and 100, so you can choose from shortint orbyte as the data type. The byte data type requires the least memory and, as it is sufficient to store this range of numbers, it would be the best choice here.
Four separate variables could be used to store this data, but this would be cumbersome. Because this data is of the same type, a single array can be used to store all of the marks. This would also allow this particular program to be easily reused for classes of different sizes.
‘n’ number of elements will be needed in the array where the ‘n’ is equal to the number of students. A byte array called myArray can be used to hold these values:
for (int index1 = 0; index1 < 3 ; index1++) {
  for (int index2 = 0; index2 + index1 < 3 ; index2++){
    if ( myArray[index2] > myArray [index2+1]){
      /*this means we need to swap the two elements*/

        byte tempValue = myArray[index2];
  /*store myArray[index2] in tempValue variable*/

  myArray[index2] = myArray[index2+1];
  /*assign myArray[index2+1] value to myArray[index2]*/

  myArray[index2+1] = tempValue;
  /*now assign myArray[index2]’s original value that was temporarily stored in tempValue to myArray[index2+1]*/

      }/*end of if section*/
    }/*end of for with index2*/
}/*end of for with index1*/

Pass 1:

index1 = 0 (Throughout Pass 1, index1 is equal to ‘0’)
index2 = 0
060
170
226
39
index2 = 1
060
126
270
39
index2 = 2
060
126
29
370

Pass 2:

index1 = 1 (Throughout Pass 2, index1 is equal to 1)
index2 = 0
026
160
29
370
index2 = 1
026
19
260
370

Pass 3:

index1 = 2
index2 = 0
09
126
260
370
The program has finished executing and the marks are now in ascending order. By creating an algorithm first each of the steps that were required to sort the marks into ascending order could be identified and a program could be created that performed these steps.
This sorting problem uses two nested for loops. It also has a conditional statement within a loop. These constructs can be used in a wide range of combinations to solve different types of programming problems.
When you use nested constructs it is a lot easier to make mistakes. When programs are not producing the desired output, you can use a debugger to check through the code to find where it is going wrong.

Wednesday, 19 March 2014

#FLMobiGame - Week 4 - Exploring Massive Open Online Courses

The University of Reading has several exciting free online courses coming up (see here). Also our School (Systems Engineering) is considering couple of online courses and I am a member of the project board supporting the development and delivery of new online courses. I am taken by the idea of a course that will include making a robot!  I have already volunteered to be a tester for the course, who would not want to be a tester for an awesome course like that?

Photo: By Saad Irfan from http://farm5.staticflickr.com/4035/5168814511_2e387e26be_b.jpg


We have some ideas for research surrounding MOOCs, which I thought I'd share with our FLMobiGame participants on my Week 4 mid-week email.

Community Building around a MOOC is a topic that I have been interested in. The small team of educators and mentors in a MOOC (such as FLMobiGame) rely on community support to a large extent in facilitating the course. In FLMobiGame 2nd run we are very lucky to have some 'FLMobiGame run 1 alumni' here helping us. We have also seen some fantastic support from our 2nd run participants in the course. Some of them are experienced in programming while some are beginners. Together as a community we are supporting each other in the course.

We have already done some work exploring what is considered "dropout" from MOOC participant's perspective and our paper Dropout: MOOC Participants' Perspective was presented last month (February 2014) at the 2nd European MOOC Stakeholders Summit in Switzerland. We have identified various scenarios of 'dropouts' from our previous work and we are looking to improve our understanding on this too Here is the link

Another interesting thing that we observed from Reading MOOCs is that the engagement patterns of MOOCs in different disciplines vary widely. For example, the engagement patterns of University of Reading's Beginner's Guide to Writing in English and Begin Programming courses are very different. It would be interesting to explore these differences.

Please feel free to share your thoughts and if you want to support our research please leave a message we will get in touch. :)

Saturday, 15 March 2014

#FLMobiGame: Linking to a Post on FutureLearn Forums


At the moment FutureLearn does not provide functionality to search forums other than the browser search facility. So there are difficulties to locate useful posts in the forums.
As a remedy we have asked our participants to 'like' the post if they found it useful. So that by sorting on likes, useful posts can be found.

I see that in many posts participant's say "I found XXX's post useful" but unfortunately without the ability to search this does not help much. So I thought of doing this blog to show how to provide a 'link' to a useful post in the forums.

(Edit: 1st June 2015)
This is what you can do:

1. Right-click on flag mark  below the post that you want to link to (shown below)
Right-click on flag


2. Now select 'Copy Link Address' from the pop-up menu

3. Paste the link on to the comment you are making
Paste the copied link to your post

4. Now delete the bit at the end of the link that says '/moderation_reports/new'.
Remove '/moderation_reports/new' at the end of the address URL
5. Now post your comment and it will have a link to the post you wanted to link to.

Wednesday, 12 March 2014

#FLMobiGame - Karsten Lundqvist wins Technological Innovation in Teaching Excellence Award

We all are delighted that our colleague, #FLMobiGame lead educator, Karsten Øster Lundqvist won 'Technological Innovation in Teaching Excellence Award' for his effort to flip the classroom in his 2nd year Java Module.

Unlike other teaching awards that are awarded by institutions, this award was offered by the RUSU (Reading University Students Union) and the nominations were made by students.

I managed to capture Karsten with his award at his office.



Tuesday, 4 March 2014

Visiting UNISA Pretoria - Research & Innovation Week

The University of South Africa, one of the leading open distance learning institution, is hosting a Week long event on Research & Innovation. On Thursday, the 6 March 2014, the Institute for Open and Distance Learning is hosting a symposium on "Innovation in ODL Research Teaching and Learning" focusing on the them “Exploring the potential of MOOCs and OER in enhancing teaching and learning in ODL". I've been invited as a keynote speaker at this event and I am delighted to be back in South Africa. I really enjoyed my last visit September 2013 to Cape Town and I hope Pretoria will be even more exciting.

I plan to talk about MOOCs and developing countries - how they can (or can not) meet learner needs in that part of the world. I will be sharing the latest information in MOOC research I gathered in EMOOCs 2014. I will also look at learner personas to discuss how MOOCs will (or will not) be useful to learners from developing countries.

The session takes place at Senate Hall, Muckleneuk Campus, Preller Street, Muckleneuk, Pretoria and my presentation slides are shared.

--
Updated 10th March 2014
News Item about the event can be found here

Unisa’s Research and Innovation week addresses MOOC appeal