Sunday, March 29, 2015

week11: Revisit my earlier SLOG and visit my friend's slog

In this week's slog, I will revisit my earlier SLOG and check my earlier ideas.


In my week4's slog, I wrote:"self was very trick for me. But I decided not to understand but to remember it! For every method in a class, remember writting self!!!" However, now I understand that "self" is just the class itself. So when we call method in a class, "self" tells system which class is used.


In week7's slog, I wrote my point of view for benefits of Object-Oriented Programming. Now after finishing my assignment 1&2&3, I get another point. Using class is quite convenient to add something new to your code! In assignment 1, we wrote "subtract_square_state.py" and in assignment 2 we wanted to write another game state called "tippy_game_state.py". By using class we can keep "subtract_square_state" in place and wrote another class inherited from super class "game_state".



(Here is the result in python shell after running "Game_view". By using class we can choose the game which we want and choose strategy.)


In my view, it is efficient if the program is huge.I also find that it is efficient for "debug" because we can choose different games to check our code as we want.

Another point which is worth mentioning about OOP is that I find our code  is much easier to understand by using class.
For example:


In class Queue, it is quite clear that this data type is something like a list and we can add data using method enqueue. Using class is much easier for us to understand the code than just providing a branch of functions.


I also visited my friend's SLOG this week. What is worth mentioning is my partner Celina's slog!




I found something useful in her slog. In week 7, she gave a summary for abstract data types. After giving a summary for each type, she provided a website link such as:
"http://interactivepython.org/runestone/static/pythonds/BasicDS/TheStackAbstractDataType.html"
I visited those website and found it is quite a good summary for abstract data types!

It gives a summary for each data type and give an example for each method!

I have highlighted this website! Thank you Celina~!


1 comment: