2013年10月27日星期日
2013年10月20日星期日
2013年10月13日星期日
[WEEK V] Object-Oriented Programming and Recursion
So, for this week we are asked to write two paragraphs about object-oriented programming and recursion, also explain its concept and usefulness.
Object-Oriented Programming
I looked up on the internet about its information. Generally, object-oriented programming, which can be represented as OOP, is a programming model that 'objects' have data field and associated functions known as 'methods'. There are lots of OOP languages such as Python, Java and C++. An example for the OOP languages is they use 'class', which can be considered as a union of a certain type of information. They also use 'objects' and 'methods'. 'Objects' can be considered as a certain object belong or related to the defined class and 'methods' are under the classes and can be considered as the actions toward the defined objects by programmers. For instance, in Python, we could define a class 'Laptop' and an object under the class 'Laptop', 'Vaio', which means 'Vaio' is a 'Laptop'. In addition, we want to turn on the 'Vaio', so we define a method called 'Turn_on'. As the result, when we type Vaio = Laptop/ Vaio.Turn_on() in the Python Shell, it means 'Turn on the laptop called Vaio'.
It has valuable usefulness because programmers can assign value and data to any objects, and any defined objects can be used to process data and transfer data to other defined objects. It greatly enhanced the programs flexibility, compatibility and makes the program much more simple to maintain. This kind of language is widely used by software engineers, because it is easier to study and analyze the code for novices, also easier to design and maintain the program for experienced programmers compared to non-OOP language programs.
Recursion
Recursion is a method of programming that divide a problem into two parts, which are basic cases and sub-problems. Basic case is 0 or empty list/string for the most of time and for the sub-problems, the function calls itself to repeat computing until the basic case occurs. A failed recursion code can cause an infinite loop.
Recursion is very useful as well since it eliminates the unnecessary code and increase the its efficiency. A complicated task can be easily done by the recursion by break it down to two parts, and for more complicated problems we can break down sub-problems into sub-sub-problems and so on to solve them nice and clean.
Object-Oriented Programming
I looked up on the internet about its information. Generally, object-oriented programming, which can be represented as OOP, is a programming model that 'objects' have data field and associated functions known as 'methods'. There are lots of OOP languages such as Python, Java and C++. An example for the OOP languages is they use 'class', which can be considered as a union of a certain type of information. They also use 'objects' and 'methods'. 'Objects' can be considered as a certain object belong or related to the defined class and 'methods' are under the classes and can be considered as the actions toward the defined objects by programmers. For instance, in Python, we could define a class 'Laptop' and an object under the class 'Laptop', 'Vaio', which means 'Vaio' is a 'Laptop'. In addition, we want to turn on the 'Vaio', so we define a method called 'Turn_on'. As the result, when we type Vaio = Laptop/ Vaio.Turn_on() in the Python Shell, it means 'Turn on the laptop called Vaio'.
It has valuable usefulness because programmers can assign value and data to any objects, and any defined objects can be used to process data and transfer data to other defined objects. It greatly enhanced the programs flexibility, compatibility and makes the program much more simple to maintain. This kind of language is widely used by software engineers, because it is easier to study and analyze the code for novices, also easier to design and maintain the program for experienced programmers compared to non-OOP language programs.
Recursion
Recursion is a method of programming that divide a problem into two parts, which are basic cases and sub-problems. Basic case is 0 or empty list/string for the most of time and for the sub-problems, the function calls itself to repeat computing until the basic case occurs. A failed recursion code can cause an infinite loop.
Recursion is very useful as well since it eliminates the unnecessary code and increase the its efficiency. A complicated task can be easily done by the recursion by break it down to two parts, and for more complicated problems we can break down sub-problems into sub-sub-problems and so on to solve them nice and clean.
2013年10月6日星期日
[WEEK IV] Hello World!
'Hello World!' Guess thats how computer programmers say hi, so I made this to my title.
I would like to talk about something about myself here since it is my first SLOG here. I'm a second year student in U of T and I plan to take computer science specialist program. I love computer games (who doesn't? :3). When I was a kid about 3 or 4 years old I play Super Mario Bros. and Contra on NES which is an 8 bit video game console first released in 1983 (That is such a long game history you might want to say). Most of the games at that time were less than 1 MB and compared to nowadays games with a size more than 30 GB , they are pretty much'trash. However it was really fun to play them at that time.
Back to my topic, in fact I was planning to study life science in university until the day I apply for university. I love computer games so much that I changed my mind to take computer science program in university, however I have literally no programming background at all and it gives me some real hard times last year. Good thing is things are going fine now, I have friends who study in computer science as well I can ask questions, my university is one of the best universities in the world, I have nice professors and TAs, can't complain any of it.
Back to my topic, in fact I was planning to study life science in university until the day I apply for university. I love computer games so much that I changed my mind to take computer science program in university, however I have literally no programming background at all and it gives me some real hard times last year. Good thing is things are going fine now, I have friends who study in computer science as well I can ask questions, my university is one of the best universities in the world, I have nice professors and TAs, can't complain any of it.
Nothing much from the lecture this week, it is all about Stacks. It also involves orders, such as first-in-first-out and first-in-last-out, which are not hard as long as you understand the mechanisms.
Peace.
订阅:
评论 (Atom)