Monday 8 July 2019

Thoughts on Learning Computer Science Online

Flashback to the moment before I started applying for university placements through UCAS, about four years ago, I once voiced out my intentions of pursuing a Computer Science (CS) degree. As you'd expect, my proposal to my parents, specifically to my father, didn't work out well, as I ended up with a bachelor's degree in Economics from a renowned university in the UK for that department, University of Warwick.

When I started my degree, each student in our course had to choose one or two optional modules which can be from amongst the options in Economics or from other departments such as the Business School, Language, or Computer Science. I ended up choosing Arabic as I had the goal of improving my fluency in that language, especially in Speaking. Other than that, at that time, Economics wasn't really a subject I'm very passionate about. Even when I was doing the IB Diploma Programme, I wasn't very good at the subject. I even had a moment when I cried in front of my teacher because I was frustrated with my 'weak' understanding and performance in the subject. I was rather afraid that I'd do badly for my Economics core modules that I needed something I'm confident I can score well in to pull up my grades if needed. Until the end of my degree, I let go of my wishes to learn CS until...

I realised that I still have some money left in my UK bank account. Even though I have been living in Malaysia for months, I still have access to my UK Debit Card. I took this opportunity to pay for an online course, something that I can do while I'm job-hunting, something that may enhance my skill sets for the job (though I'm doubting to what extent this is useful). I paid in GBP, so it didn't feel like I was paying much, though if I convert it to MYR, then I'd be bawling my eyes out looking at it.

The course that I'm referring to is Harvard's CS50, Introduction to Computer Science. The online platform I'm using for learning is edX. I've known this website for years, even before I started my degree, when an IB friend of mine introduced it to me. I did enroll in some courses in Literature, Mathematics, Project Management and Health Economics before, but I didn't stick around too long in these course because, over time, I lost the motivation to continue. Furthermore, some courses like the one I took in Literature and Health Economics involved posting opinions on forums and commenting on coursemates' posts, which I'm not really keen on doing, especially, when you're late in joining the course, and you just don't have a fresh idea of your own after reading other people's ideas.

But this course is different. I didn't have to think about my own opinions. I only had to do homework. The homework is basically problem sets, each with different tasks, designed for the learner to apply ideas and functions taught during lectures. I'm not saying that this course doesn't encourage people to think critically, it does, believe me, but in a different way. Not those open-ended discussions on 'why the author used this word to express this and this', or those theoretical discussions on 'whether you think the healthcare insurance system is functioning well or not'. This course encourages me to do something, and I really enjoy it even though it makes me wanna cry at times. You'll see why as you read more.

On the first lecture, the lecturer introduced the main framework of CS. It is mainly focused on algorithms. Put in a simple way, algorithms are defined as the steps you'd take to solve a problem or the steps you'd execute to do something. For example, how do you make a peanut butter and jelly sandwich? What ingredients do you need for it? What instructions should you tell someone if you want them to make a PB&J sandwich? What are the logical orders that the steps should be arranged in to make the sandwich without messing up?

On the first lecture, too, we were assigned to make a programme using MIT's SCRATCH. These programmes should comply with specifications outlined in the problem set, for example, it must have a variable and a loop. Some people made games out of the programme. Mine was very simple (probably too simple) but still fulfilled all the necessary criteria. For the following ones, we use C. Now you must be curious as to how I was graded, right? Simple, we just followed the steps written in the course website (find instructions specifically on that problem set you're working on) to submit our work for grading. The system will then check whether your work complies with the specifications given. It gives green-coloured feedback if you fulfill a criterion, yellow feedback if there are some issues, and a red one if your programme is not working as how it should. As of this point, I've had many instances when I got a lot of red feedbacks. It really makes me sad to know that something is wrong with my codes, but I've also been ensuring that I get full green feedbacks before I move on to the next problem sets.

All the submissions I've done as of now
Up to date, I've done 5 problem sets. Some problem sets only have one assignment, while the rest have at least two different assignments to work on. Accumulating all the work I've done and all the files I've uploaded for submission, it looks like I've done a lot, but I haven't even crossed the half-way line yet. Looks like my CS50 journey is still a long way to go. Still means that I'm going to be having more moments of talking to myself whenever my programme is buggy, drawing graphical representations of my programme until I have a solid idea on the steps I need the computer to do for it to work properly, and more reading forums on StackExchange.

Normally, when I want to start on a problem set, I'd watch the lecture first, followed by the 'Shorts'. The Shorts are actually additional videos that explain ideas and functions in a more deeper approach. They also introduce some advanced syntaxes that may be helpful to solve the problem sets. However, for me, I sometimes think that some materials in Shorts are suitable for those who are more comfortable in learning more complex programming styles. For me, I'd rather stick to the easier syntaxes and functions, as long as I understand how they work and it gets my programme running. But most of the time, I don't know which Shorts would be useful for me, until I literally do the problem sets, so I'd end up watching everything anyways.

(From an economics perspective, CS does have that cost-minimisation criterion when constructing an algorithm i.e. make a programme that minimises running time/time needed to execute a programme, but because I'm a layman programmer, I don't really put much focus on this aspect. I'm entirely happy with a functioning programme even if it's not the fastest one around)

To work on the problem sets, the course provides walkthroughs for each assignment. The instructor in charge will offer a sample of pseudocodes. They are lines of instructions or word-formatted codes that should help the students develop their own codes to run the programme. Remember that PB&J sandwich situation earlier? Well, an example of pseudocode for making the sandwich would be:
  1. Open the bread's wrapper and the PB&J jar lid.
  2. Using a butter knife or a spreader, for each slice of bread:
    1. Scoop out some PB&J and place it on the bread
    2. Spread the PB&J evenly so that it covers the bread's surface
  3. Take two slices of bread that are already spread with the condiments and stack them together. Repeat until we used all our desired amount of bread.
  4. Cut the stack into half, whichever way you like.
(This is assuming that your PB&J spread is a literal PB&J spread, and not the one where you bought all the elements of PB&J separately)

Understanding the steps is one thing. At least it helps you to have some ideas on what you are working on. But this is obviously not enough. Even with pseudocodes, I sometimes can't imagine what I am telling the computer to do, so taking on the advice from one of the CS50 staff members, I'd normally write down and sketch the process on a piece of paper. For example, when I was working on the problem set on MUSIC, I had to learn the musical notes of the piano and complete a programme that plays a music sheet. I had to sketch out the piano tiles to decide whether I should be moving up a key or down if I wanted a certain note to be played. Another example was when I was doing the recent problem set on SPELLCHECKER. I wanted to load the dictionary using a specific data structure (a trie), and so I had to draw how a trie works in order to fully understand what possible questions I should let the computer ask at each node of the trie.

Notes on MUSIC Problem Set

Notes on SPELLCHECKER Problem Set
There would always be a time when I thought that my codes were perfect, but when I execute the programme, it won't just work. That was frustrating and made my head blank. Heavy sighs accompany my blank head and sometimes, I'd lie on the floor, thinking "What went wrong?". Fortunately, the site that we use for programming (developed by the instructors) are user-friendly, so it has user-friendly functions that could help layman programmers like me find where my codes went wrong by just typing a few words.

Example of the codes I've written (my codes are normally long because I write lots and lots of notes in it)
Some of the concepts that I worked on were quite challenging for me. In particular, I found the topics on Memory Spaces and Strings a little hard to grasp. I'd always have to read up more on it from online lecture notes or watch videos by other authors. When doing the problem sets, I'd have difficulties in understanding what is required of me. I'd have to look at examples first, to get an idea of what I needed to do. I feel like I cheated by doing this (hehehe~) but is it considered cheating if I still face problems even after looking at examples? I am pretty sure I did the same thing for the Econometrics group assignments I did during my second year of uni.

Will I continue until I finish this course? Yup, bring it on, CS50!!!

Friday 24 May 2019

Miss Sherlock reminds me on 'How to be a Friend'

I just finished watching one of HBO Asia's series, Miss Sherlock. I don't know to what extent the series adapts from the original work by Arthur Conan Doyle, or what twists this series takes compared to the multiple other Sherlock Holmes adaptions that preceded this one apart from making both Sherlock and Watson female characters (duhhh). This is the first Sherlock series that I have watched seriously, not just watching clips or certain scenes by chance.

Although the character Sherlock stuns me with her eccentricity and intelligence, the major take away I got from this series is mainly on the idea of friendship. Throughout almost the entire series, Sherlock denies her friendship with Wato. I do not know what is the main reason behind it, but I think the fact that she has been a loner due to her unpleasant character ever since forever plays a huge factor in why she's probably overwhelmed with having Wato around her. She just doesn't realise that she has unconsciously accepted Wato as a friend at some point of the series.

In the beginning, their personalities and point of views just clash at almost everything; from matters regarding investigations to something trivial such as fashion sense. Slowly, as the series progresses, Sherlock slowly opens her barriers against Wato. She begins to allow Wato to contribute ideas (and takes them into consideration) during investigations, gives Wato some space to catch up with the details of the investigations, and when having a meal, Sherlock also picks some food and places them into Wato's plate. Sherlock also shows signs of concern, in particular regarding Wato's love interests.

When Wato was held captive and electrocuted to the point that it can kill her, Sherlock panics. At that time, it appears as if she has control over Wato's fate (because she needed to crack a password to prevent the baddies from torturing Wato), however, Sherlock knows that it all eventually boils down to whether the police force can arrive at the crime scene on time or not to stop Wato's death. Later in the series, when Sherlock learns that Wato's trauma counselor is the real mastermind behind the cases they were investigating on, sensing that Wato might be in danger, Sherlock tries to contact Wato to warn her (and fails). Wato was already under the influence and brainwashed by the counselor, brainwashed into making her perceive Sherlock as the evil one. Sherlock continues her investigation to locate Wato and the base where the counselor 'trains' her followers, however, until one point, she feels burdened and longs for Wato's company. With all these emotional turmoils, yet Sherlock still doesn't admit the Wato is her friend. Not gonna spoil what made her change her mind though haha.

The thing about Sherlock that she denies her friendship with Wato reminds me of my own self. When I was at university, I had that impression that I was going through everything alone. I did not want to acknowledge that I have friends who are very close to me; individuals who I rely on during times of good and bad, and they too, rely on me. It is clearly a give and take relationship, not one-sided, and I consider them to be good friends, except... I did a stupid move by telling them that they're just my friends, instead of good, close friends. To make things worse, I did it twice, not learning from my first mistake. They were quite frank with me. They voiced out their disappointment to me when they heard that I just look up to them as a friend. I eventually realised my mistakes and made up to it. Until now, we're in good terms and are still keeping in contact with one another.

So when I saw Sherlock, I saw myself in her. The lady who was acting all tough and "I can do by my own without anyone". But that is not always right. It's good to be independent, but know that even for people who always bottle up all their problems inside, there'll be the point that they too, need to rely on someone they treasure as friends. Or else, they'll just be a depressed loser, who is at the extreme of giving up at anything they're working on to achieve.

And that's how Miss Sherlock reminds me oo how to be a friend, a good close friend at that.