Tuesday, February 24, 2015

Summary of Object-Oriented Programming concepts

       Object-Oriented Programming(OOP) is a programming methodology based on objects, instead of just functions and procedures. 

For better understanding, I will start off with my understanding of an object and class.
Everything in reality can be an object.
For instance, let’s assume ‘cat’ is an object. 
Then this cat has its characteristics or properties (color, name, weight). 
And also, this cat can generate or do some  actions(mewing, eating, sleeping, hiding).

       In OOP, color,name,weight are called ‘property’ and actions are ‘method’.
Let me have a deeply applied example, “Black cat is sleeping.”
From above sentence, ‘cat' is one of the object.  
And the adjective that describes its color ‘black’ is a property.    
The behavior ‘sleeping’ is a method.
Just like a cat, dog, wolf and tiger can be an object!                         
They have very similar property and methods, in this case, I can group them by some standards into a “class".

        In OOP, objects can  exchange information in a standardized manner, and can be combined with one another as modules or blocks. Each object is independent which means that it can be changed without affecting other objects or module.
Objects can run (execute) by itself, and can be interlocked with other objects.

Wednesday, February 11, 2015

Impressions of tracing recursion

     This week, i learn about the recursion. 
Recursion is a method of coding a problem, in which a function calls itself.
For example, finding a maximum element in a list. We already know the ‘max()’ function but it only works with a flat list (list whose elements are just number, not a list or nested list).
If i didn’t learn about the recursion method, i would approach this problem by making a empty list called ‘l’ and put all the element in the argument to 'l'. Then i will get a flat list even if the argument was a list of list of list of list… so on.
Since argument is turned into a flat list, now i can use ‘max()’ function.

    However, my function would be very long , complicated and messy.  
As you know, “Simple is better”.
Recursion method will help my function to be simpler. BUT, I have to check whether i can use recursion method in this problem first.

    Let’s say my argument was s = [1, 2, [4, 3], [5 ,2], 8, 7]
What i have to do is, finding the maximum element in the nested list so that i can get s = [1, 2, 4, 5, 8, 7]. Then i can use max() function from this point.
So the task is the same (which is finding a max) if i break the problem down into smaller and smaller subproblems. Now i confirm this problem can be applied to recursion.



    This problem was covered in my computer science lecture. So i will just post the solution here, 
     You will easily capture how simple the code is. 
     This is the beauty of recursion!!


Wednesday, February 4, 2015

Impression of first few weeks


I really want to be honest with this topic.
My experience with CSC 108 was awesome. 
Especially, PCRS was a pretty impressive system.
This was my routine when i was taking 108 last semester.
1. Watching the lecture vidoes for purpose of previewing.
2. Go to lecture. 
            It was time to be more confident about what i already learned form PCRS and learned more 
            about what i was not sure.
        3. Do the exercise and perform activities in PCRS . This helped me to do the self assessment.

      With CSC148, I do not have such a system.
I was satisfied with the result from 108 and i was expecting to see the same routine in 148. However, It was totally different in reality.
I have a lab instead of PCRS.
Of course there are pros and cons of taking lab. But just in my opinion, I liked PCRS more than lab.
In questions(in PCRS exercises), they always provide the examples so i know what i have to do and what instructor wants me to answer. BUT in lab, I have most troubles in understanding the context or job. Simply, i don’t know what i have to do.
I know this is because CSC148 is more enhanced version of CSC108.
But, i really want a system like PCRS which provides more chances to estimate my ability or confidence about the materials.
I am not criticizing about teaching but i just sincerely hope there are more opportunities to practice the concept.