Monday 25 November 2013

A2 Results Analysis

After receiving the results of our second assignment I must say that both me and my partner were quite pleased with the results. We scored 43/44, a near perfect grade, however when I looked to the part that lost us that single mark I was somewhat dissatisfied with the feedback given.

The comment left by the marker was simply that one part of the code was too complicated, I was hoping for it to tell us how we could have made it better. I thought about it for a while but I guess I just wasn't clever enough to figure out how to make the code any less complicated. I really want to know how the code should look like. The lost mark was attributed to "Match Simple Star".

If anyone had gotten perfect on that part, it would be greatly appreciated if you could share your solution to that part! I would love to see how it was supposed to be done.

Monday 18 November 2013

Peek - a - boo

Today we learned how to hide internal variables set restrictions on what the value of an instance variable could be.

It's happening again, I now have an uncontrollable urge to back through all my code and privatize variables and such. I've kept different drafts of the programs I've written and it's really rewarding to go through them to see how they've evolved. It really does feel like I'm learning and improving my work.

Wednesday 13 November 2013

Term Test 2 Aftermath

I was slightly late for my term test today, the TTC was having issues and the wait was just dreadful.

While surfing other Slogs I found that the most highly occurring problem that people were having were related to recursion. Ah... recursion such a complicated concept to grasp yet so elegant in execution. There was something inside me that just seemed to say that there will be lots of recursion on the test, so that's what I spent most of my time trying to perfect.

As I sat down, a bit embarrassed by my tardiness, I took a quick look at the test. I couldn't believe the questions I was seeing. After around 15 minutes I had finished the test and checked it over twice. Unsure what else to add I decided to just hand it in.

As soon as I left the room I started up my laptop to check if the functions I wrote actually did what they were suppose to do. That's the beauty of comp-sci tests, you can check your answers without waiting for solutions to be posted and sure enough it seemed like my functions were doing fine.

I stood up to strike a victory pose before leaving the exam center, humming a tune.


Oh! Also I got my calculator layout done and all the buttons work as well!
.........well
...... except the "=" button........
...I'll have to work on that one :)


Tuesday 5 November 2013

Catch the Code

After learning about Big-O and the run time of code, I decided to go back and try to "catch" all my old code. That is, I went back all the way to exercise 1 to see if the code I wrote could be caught and beat in run time by a more efficient method. After adjusting some of my exercises to improve their run time it became apparent to me that I hadn't really given a second thought about the run time before I learned about it. After this little practice with efficient coding, I must say it felt to to see my programs cleaned up.

But what about the other end?

I felt curious to see just how bad I could make the run time of a program become. After trying a few times, I found that to hit a run time of O(n!) was actually pretty hard. Who knew that ruining the run time of a program could be harder than to do it the most efficient way?

Sunday 27 October 2013

The second assignment.. CLEARED

So I got home on Friday, relieved that midterms are done, I go and check the course calender and there it was.. the link to our second assignment was posted. All thoughts of relaxing for the weekend soon evaporated from my brain as I dove into the problem head first.

To my relief the second assignment seemed extremely easy, like REALLY easy. I mean come on, 4 steps? Two of which are writing your name and submitting it? After some quick prototypes of the code had been made that evening, I went to sleep and once again code filled my dreams. It was almost as if the problems seemed to solve themselves. The first thing I did when I awoke Saturday morning was boot up my computer. I began to type rigorously lest the solutions born in my dreams faded away. Time just seemed to blow away, by 11am I had finished the entire first part of the assignment.

Brunch Break.

Now for the second part of the assignment.. type type type...........

.....
...........
......................

Finally at 11pm I realized I had just starved myself in order to finish the second part of the assignment.

Instant Noodles, Yum.

3am, twitching, sagging eyes.. still working.......

5am, fast asleep in front of my computer

...............

8am, I awake. I take a quick look at my screen and realized that I had finished the entire assignment. I close my eyes, Zzzzz..... back to sleep I go......

Friday 18 October 2013

Midterm, problems I had, solutions I should take

The midterm.. it was definitely something different.

Problem: First of all a major problem for me during the midterm was getting used to not being able to press backspace if I made a mistake. This resulted in a rather messy paper from me as many lines of code were crossed out in pen.

Solution: In preparing for the final exam(assuming it's like the midterm) I feel like instead of coding on a machine it would be better for me to practice 'coding' on paper. In doing this I hope to increase my consistency in getting it right the first time.

-----

Problem: Following recursive functions is hard, this became painfully apparent at the very first question on the midterm. It just required me to follow the function way too many times, this resulted in my brain exploding.

Solution: I can't really think of any easy solution to this problem, maybe just practice with recursion more perhaps? If anyone has any ideas on what I should do to fix this, input is always valued.

Saturday 12 October 2013

O-O-Programming + Re(Re(Re(cursion)))

From what I have learned so far, object orientated programming is focused around the creation of 'objects' and the manipulation of these 'objects'. When creating objects, programmers try to focus on combining a useful way to store their desired data while at the same time ensuring that when needed, that data can be easily accessed. Objects also serve as representations, they can represent a certain type of data and as such, valid operations can be used on objects so long as the programmer who created the object intends it to be used in that way. I feel that by giving the programmer the ability to create objects is an immensely strong tool that computer scientists have. This allows the programmer to create abstract representations of things that he would have otherwise had to use built-ins to represent. An example of this could be a simple point on the x-y plane. Now think for a moment, how could you represent a point without creating a point object? Maybe a list of 2 elements? A tuple perhaps? Neither of those have build in functions that can calculate the distance between two points or any other operation that may be useful to use on points. No matter how you look at things a point object in this case would definitely be easier to use.

Now.. recursion..

The idea of recursion was hard for me to get used to at first. Using a function itself in its own body? That made as much sense to me as the end of this sentence banana chicken pie. However, as I got used to the idea of recursion, I've discovered that it opens up a whole new window and maybe even a door or two. After realizing the power that recursion had to offer I decided to embrace the idea. With recursion, working with naturally recursive objects became a lot easier, nested lists is a prime example of this. After working with recursion I feel that I've picked up a bad habit, that is I try to see any problem as a recursive problem even if it isn't.