Sunday, February 1, 2015

On Recursion and Inheritance

I feel like after these past two-three weeks of lectures and tutorials, I have learned some of the most useful things in programming! Recursion is one of the best things that has ever happened to me in my opinion! It converts a crazy problem into only a few lines of code and I would give it a 10/10. I wanted to have some practice problems on recursion for our Midterm1(Good luck everybody) in the upcoming week but since I couldn't find any, I just started implementing code to give me the nth Fibonacci number, the sum of numbers (1^2, 2^2, ...,n^n) and these sorts of things which I suggest you to do if you want to have more practice on this matter.
what is the Fibonacci sequence ?

One more thing I am thankful for is inheritance and I know all of you who took csc108 last term agree with me! I can feel how much knowing how to implementing  sub/super classes would have helped us on out assignments!

I am currently trying to write code to play a simple Hanoi tower puzzle using stacks and it is becoming really interesting! I will show you my code probably after the midterm in the next slog entry! I encourage you to also try it and if you don't know what a Hanoi tower is, check out the following link!
Hanoi tower puzzle
happy studying everyone!

Monday, January 26, 2015

Keeping track of my mistakes? what good would that do?!(Why Geeks should write)

    There has been the rumor of computer scientists being lazy! wow wow wow hold on there that's outrageous is what we, as beautiful young minds interested in pursuing this beautiful world (I mean Comp Sci of course), would say to this!
But between me and you, aren't we really? I wanted to postpone starting the SLOG so much but I need 8% so here I was reading through the blogs posted about why geeks need to know how to write and I was talking to myself : "man there are a lot of better thing to do right now, I an go work on my A1 code".
    Then it hit me! I was reading about Mark D's experience on  debugging and I thought about all the time that I would sit before this lap top and just look at my code without even blinking just to find that hard to find tiny error which might turn out to be such a simple thing like a typo or maybe a conceptual thing.
We are computer scientists! We might not care about a lot of things other people do! But Damn it we care about our code and our code is a part of us! So I won't be lazy when It comes to my code! and I know you if you are a true CS dude or gal won't be either! keep track of your maybe in a blog, or maybe in a notebook, you will learn from mistakes, you will fix your code faster, and hey! you get more t
time on your hands and you can sleep the rest of the day instead of looking at that code that does not run.
There are some obvious reasons why you should start blogging when you are a programmer. Most of them also apply to everybody else:
  • You share your knowledge. This is a benefit for all of us. If everybody would be blogging about all the little issues they had then a Google-Search would help us even more. I am sure nearly every problem in the world is already solved. It is just not written down.
  • It’s a kind of self marketing. A potential employer can get a much better picture of your abilities than he could from CVs or references. When I hire somebody it is already a huge plus for him when he has a blog at all.
  • Explaining things to other people is the best way to learn. You can only teach what you fully understand. This is at least as efficient as hands on experience.

Programming is doing something weird to your brain. When you write a piece of documentation right after a programming session the result is likely to be barely readable for human beings.