Well it’s late and I’m trying to go to bed. But before I wrap up I’ll quickly go over what I learned tonight.
Structs, although pretty simple, seem like a nice way to organize data. Essentially, this is the definition of a struct:
# Struct format:
Coordinate = Struct.new(:x, :y)
# Essentially the same as:
attr_accessor :x, :y
def initialize x, y
@x = x
@y = y
So nothing too crazy but a clearer and more “Ruby” I’d say. I’d like to do some further reading on Structs like that recommended here.
Graphs & Trees:
We also went over graphs and trees tonight (though not incredibly deeply). I’m excited to work with trees in our future projects and can see the glorious power of graphs. Everything regarding graphs was brought back to the idea of a social network and that made a bit more sense.
Like I said, I don’t have much to talk about tonight but since I’m trying to get in the habit of blogging after I code it was more important to get something down rather than nothing at all.