?

Log in

No account? Create an account
Just for reference, I'm in college, working on this stupid Natural… - The tissue of the Tears of Zorro [entries|archive|friends|userinfo]
tearsofzorro

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Nov. 17th, 2007|03:24 pm]
tearsofzorro
[Tags|, , , , ]

Just for reference, I'm in college, working on this stupid Natural computing project.

Every time I think I've got it licked and I'm ready to set everything up for an experiment, it seems I have to modify/subclass yet one more thing. It's getting annoying.

I mean, I'm beginning to see the joy of object oriented programming in that I can make this work for my stuff without breaking other functionality in many and horrific ways, but at the same time, just the huge chain of things that I have to copy/paste so that I have objects that work like the others with just one little difference, which I thought was exactly what OO programming was meant to fix, makes me wonder if the concept is flawed somehow... or if it's just the implementation.

Overall, I just want to brutally beat someone over this. I don't care who, just so long as they can't fight back much. Ok, maybe just violently beat them with a pillow.

The moral of the story: if your lecturer says "It's a good idea, but I think it might involve a lot of coding" Believe them. It's half a week before I have to turn in a paper on this, and I'm still trying to get the damn framework to do what I want it to do.
linkReply

Comments:
[User Picture]From: granite_lullaby
2007-11-18 09:27 am (UTC)
Do you not have the Mighty Power of Aliasing?
(Reply) (Thread)
[User Picture]From: tearsofzorro
2007-11-18 03:48 pm (UTC)
Forgive my lack of leetness but aliasing?
(Reply) (Parent) (Thread)
[User Picture]From: granite_lullaby
2007-11-18 06:21 pm (UTC)
Ah. Sorry, I'm a bit Rubically (Rubially? Rubidically?) institutionalised.

Aliasing is a means in Ruby of adding more code to a method without rewriting it altogether.
(Reply) (Parent) (Thread)
[User Picture]From: tearsofzorro
2007-11-18 08:55 pm (UTC)
Hmmm... I can't immediately see how you could add on more code via aliasing in the article you gave, but I think I was doing sorta the same idea in Java. Basically in ours it's subclassing, lots.

But gotta say, nice idea in Ruby.
(Reply) (Parent) (Thread)
[User Picture]From: granite_lullaby
2007-11-18 09:04 pm (UTC)
class Class
def method
# do stuff
end
end

class Class
alias extra_stuff method #Alias name, method to add alias to
def method #Alias call prevents this def from just replacing original method
# do further stuff
end
end



Ruby then basically adds the alias onto the end of the original method and reads it as one big mofo method. Don't know if it would quite fix what you were doing, though, having re-read your post.
(Reply) (Parent) (Thread)
[User Picture]From: tearsofzorro
2007-11-18 09:20 pm (UTC)
In Java it's essentially

function_header_here(args){
super(args);
// Do extra stuff here
}
(Reply) (Parent) (Thread)