2015年1月21日星期三

week 3's topic: Why Geeks Should Write?

I saw this topic after I finished my week 3 SLOG!!! God!!

For this topic, I think I'm gonna start with the word geek. Geek should refer to someone who is super smart and has inadequate communication with others. Those people who might have issue to talk with others or they are too busy doing their work and have no spare time. Why do this kind of people write? It seems obvious right now. To fill in the communication gap between them and others.

For them, writing is a good way to record and show others their work. They cannot simply go around the world and tell everybody they meet what they did in order to publish their work. If he just talk to people about his work, there is no guarantee that others won't just stole his work and claim that it is theirs. But, as long as they write it down, they make it sure that their work can be read all over the world. And provide an evidence of proving his work.

Secondly, it provides a chance for them to communicate with others and show their world to others. Some geeks are not understood or accepted by others for their different behaviours. Writing seems to be a good way for them to express themselves and get people to know about their thoughts, their own minds. Definitely better than speaking as you got to arrange your word when you are writing and in this way you express better.

Those are the reasons I can think of for now, I'll add things if I come up with new ideas.

The Third Week's SLOG

    It's already the third week of this semester and the SLOG starts as usual! Why did I say as usual? I've done this last semester for 165 which was also taught by Danny!
    This semester, in the beginning, we are doing class, which we briefly talked about in 108. This week, we are discussing subclasses.
    We implement a general class, and then use subclasses to implement the different consequences. As Danny did in the lecture, a general class is Shape, functions like draw and get_area are in the class but they cannot be implemented in the general class as they differ in different shapes. What we did in this is: raise NotImplementedError: 'Need a subclass.' Also, using a subclass, the subclass should look like this: class Square(Shape), with the name of the general class in it. And, in the __init__ function of the subclass, we are supposed to call the function __init__ of the general class as we are going to use the functions in the general function.
the codes are:
    def draw(self, t):
        ''' (Shape, Turtle) -> NoneType

        Draw self using t.
        '''
        raise NotImplementedError('Need a subclass')

in the subclass:
from shape import Shape
import turtle

class Square(Shape):
    '''
    Represents geometric square lined up with axes

    position: inherited from Shape
    base: float               --- length of base of this Square
    '''

    def __init__(self, x, y, b):
        Shape.__init__(self, x, y)
        self.base = b
  
As for the  draw and get_area function in the subclass, they are implemented. So when we run the subclass, these functions in the subclass will completely replace the functions in the general class in which we raise an error. But when we run the general class Shape, it will still result in an error as the general class will not be influenced by any change we make in the subclass.