csc148~Slog
Sunday, 8 March 2015
Sunday, 1 March 2015
week #7 - Impression Of Week 6
(I would like my recursion summary from week#5 to be graded.)
In week 6, we learned a new class called the Tree Class. It's a class initiated with only one value, and a number of children following the value, and for every children, it also contains a value
In week 6, we learned a new class called the Tree Class. It's a class initiated with only one value, and a number of children following the value, and for every children, it also contains a value
Sunday, 15 February 2015
week #6 --- Summary of Object-Oriented Programming concepts
Object-Oriented Programming is a programming model that stores different concepts into some data structures called objects and those objects are created within classes containing similar features. Then we can interact and manipulate the different attributes of those objects within the classes, and use the methods of the those objects in the same class.
Inheritance is one big concept in Object-Oriented Programming. It's about how we can implement new classes based on already existing classes and then expand the features in our new classes without having to write everything over. When writing classes with inheritance, it's important that we sort out the order and the organization of the classes first. For instance, there is always one parent class called the super class that contains all the starting features, but may also have some methods that can only be determined in the new classes based on this super class, then in this situation, we may raise a NotImplementedError when such methods are classes. After we've got a parent class, by applying the concept of inheritance, we may write subclasses based on the existing parent class without write everything all over again. Another important factor we should be careful about is that we need to be extra careful when we decide to change something in our parent class. Sometimes, some programmers would share the classes they have written to the internet, and people may write code or even implement new subclasses based on those programmers' classes, but if the programmers change some things in the codes they distribute to the internet, the changes may cause all kinds of error and confusion for other people, as the codes in the classes now are different from the past, so remember, it's all connected!
Inheritance is one big concept in Object-Oriented Programming. It's about how we can implement new classes based on already existing classes and then expand the features in our new classes without having to write everything over. When writing classes with inheritance, it's important that we sort out the order and the organization of the classes first. For instance, there is always one parent class called the super class that contains all the starting features, but may also have some methods that can only be determined in the new classes based on this super class, then in this situation, we may raise a NotImplementedError when such methods are classes. After we've got a parent class, by applying the concept of inheritance, we may write subclasses based on the existing parent class without write everything all over again. Another important factor we should be careful about is that we need to be extra careful when we decide to change something in our parent class. Sometimes, some programmers would share the classes they have written to the internet, and people may write code or even implement new subclasses based on those programmers' classes, but if the programmers change some things in the codes they distribute to the internet, the changes may cause all kinds of error and confusion for other people, as the codes in the classes now are different from the past, so remember, it's all connected!
Saturday, 7 February 2015
Week #5 --- Impressions of tracing recursion from week 4
Recursion, What is that?! When I first saw the function has the name of the function within the function itself, my immediate first impression was just 'How is it going to work?'. It looked really weird at first sight! Gladly, Professor Danny explained to us step by step what recursion is about and what kind of problems we can use recursion to solve.
Basically, recursion is an algorithm that you plug in the name of the recursion function into the function itself for certain conditions with some other elements in the function for 'other' conditions, so when an argument is processed, it will either meets the 'other' conditions and be directly executed, or be broken down into pieces, and those pieces will be processed through the same recursive function again until they meet the specific 'other' conditions.
For example; We have a deck of one hundred random poker cards, and we are to find the joker card in the deck. It's really gonna take one person some time to find it, but with recursion, we may break the one deck of one hundred cards into ten decks of ten cards, and have ten people looking for the joker card the same time, which would be a lot more efficient, or we may even break the ten deck of ten cards into one hundred decks of one card and have one hundred people just checking their only one card the same time. In this way, We will be able to find our joker card in a blink of eye! Now, that's the beauty of recursion! It is how we can break down one fairly complex problem into many pieces and solve all those little pieces individually. It can just make our codes a lot more efficient!
I found the tracing of the recursion in class to be quite helpful. It taught me the idea of how the recursion break down and go recursively, and how is the recursion function working when we do it on a computer. Same thing for the ones in lab, those tracing of different type of recursion functions introduced me to a variety of how we can use recursion to solve different types of problems, so recursion came to me as understandable and it did flow quite well in my mind, but it was no longer the case when I had to write recursive functions myself. For the last question in week 4's lab, I was stuck on it for almost half of the class, and I couldn't really figure it out until the TA gave me some obvious hints. At that time, I realized that my mindset of writing recursion function was wrong. I tended to think about the huge amount of the broken down pieces at the end, and that was just highly inefficient, because I really didn't have to. All I should have done was to think about the base cases when there will be no recursion and the argument will be directly executed, and the recursive cases when the function needs to break down the argument into many more pieces, then carry on to how I can develop the detail of the function based on what the function's about.
Now I feel that I'm much more adapted to the writing of recursive functions, and I'm really looking forward to how I can make use of recursion in the future.
Here is another explanation of recursion from another slogger
Basically, recursion is an algorithm that you plug in the name of the recursion function into the function itself for certain conditions with some other elements in the function for 'other' conditions, so when an argument is processed, it will either meets the 'other' conditions and be directly executed, or be broken down into pieces, and those pieces will be processed through the same recursive function again until they meet the specific 'other' conditions.
For example; We have a deck of one hundred random poker cards, and we are to find the joker card in the deck. It's really gonna take one person some time to find it, but with recursion, we may break the one deck of one hundred cards into ten decks of ten cards, and have ten people looking for the joker card the same time, which would be a lot more efficient, or we may even break the ten deck of ten cards into one hundred decks of one card and have one hundred people just checking their only one card the same time. In this way, We will be able to find our joker card in a blink of eye! Now, that's the beauty of recursion! It is how we can break down one fairly complex problem into many pieces and solve all those little pieces individually. It can just make our codes a lot more efficient!
I found the tracing of the recursion in class to be quite helpful. It taught me the idea of how the recursion break down and go recursively, and how is the recursion function working when we do it on a computer. Same thing for the ones in lab, those tracing of different type of recursion functions introduced me to a variety of how we can use recursion to solve different types of problems, so recursion came to me as understandable and it did flow quite well in my mind, but it was no longer the case when I had to write recursive functions myself. For the last question in week 4's lab, I was stuck on it for almost half of the class, and I couldn't really figure it out until the TA gave me some obvious hints. At that time, I realized that my mindset of writing recursion function was wrong. I tended to think about the huge amount of the broken down pieces at the end, and that was just highly inefficient, because I really didn't have to. All I should have done was to think about the base cases when there will be no recursion and the argument will be directly executed, and the recursive cases when the function needs to break down the argument into many more pieces, then carry on to how I can develop the detail of the function based on what the function's about.
Now I feel that I'm much more adapted to the writing of recursive functions, and I'm really looking forward to how I can make use of recursion in the future.
Here is another explanation of recursion from another slogger
Friday, 30 January 2015
Week #4 --- Impression of first few weeks
The first few weeks of classes were rather frustrating for me. After having a winter break without anything related to computer science, I successfully managed to return all those python materials to my professor. It was not that I completely forgot how to properly do python programming. It was just that, during those first few classes, I realized I had missed lots of details in python. For instance, I even messed up between doctset and unittest. Therefore, lots of silly mistakes were made, as I was trying to test out my codes in lectures and labs.
Nevertheless, isn't programming a process of learning different mechanics as tools, and use them
to construct that whatever bling~ bling~ lightbulb in our head. Through reading over the course notes, and the slides and examples provided in class, I was able to pick up the stuff that I had missed, and catch up on the new materials we are learning in class. When learning abstract data and inheritance, I found the slide examples to be extremely helpful. Though I've lost lots of detailed knowledge about python over the winter break, reading and practicing on those slide examples really helped me to get an idea of what the materials is about, how are we supposed to do it properly, and of course, most importantly, how can I fix my silly mistakes.
Now I feel that I'm back on track and I'm really starting to enjoy computer science.
Saturday, 24 January 2015
Why Geeks Should Write
Geeks, like some of the computer programmers or crazy scientists, are generally portrayed as people who dig into their work fervidly and eventually achieve some amazing results from their work. The common ideal stereotype of geeks is that the geeks are those people who focus on these scientific knowledge all the time such as math, physics and computer science, and they take almost no interest in anything else. They usually wear a pair of big glasses and some semi-formal shirts and pants down there, which is also a representation of them focusing so much on their work and forget the other stuff around them in life, even clothes! Therefore, though geeks may be super smart and hardworking with the great potential of creating the innovations of our future, they may also be a little socially awkward and mostly important have difficulties convey their thoughts to others through understandable human language. Of course, some might say that geeks should be fine on their own as long as they are able to invent new things and deliver them to the world, but time has changed, and one man army is no longer a wise choice to work on a project nowadays. As the technology and level of innovation become more and more complex in our society, team work will be a intrinsic element to the further development of what we already have. In order for all the team members in a team to connect, everyone has to communicate with one other through human language, then the core of communication should be the essential ability to write and speak. Only through proper writing, a group of geeks can be able to understand the ideas of others, and then collaborate actively altogether! This is why geeks should write!
Subscribe to:
Posts (Atom)


