Saturday, March 21, 2015

Why Ruby is Amazing

First of all, I love Ruby. Let's get that out first. If it wasn't clear by the title of this post, it is now.
Second, my open classes example will not be used in this as it is primarily opinion-based. Now, on to the amazingness.

Easy Looping Through Arrays

Quick comparison of Java code to Ruby code:
// Java
int[] array = {1, 5, 3, 7};
for (int number : array) {
System.out.println(number);
}
vs # Ruby
array = [1, 5, 3, 7]
array.each {|num| puts num}
Well, in Ruby we just saw a few things. We saw the puts function, the lack of parentheses, and blocks. A block is just that, a block of code.

Gems

At this point, I think there's a gem for everything. There's even a gem for NBT, although its docs are awful. Need a IRC framework? We have that. Hey, we have a ton of them. Need a web framework? Ruby on Rails, Sinatra, and there's some others still. Take your pick.

It Follows the Perl Philosophy

For reference, this is having many ways to do the same thing. Not much else to say here. Moving on!

The Syntax

Although this is primarily opinion-based, which do you think looks better, this basic Java class or this basic Ruby class? //Java
class Greeter {
String name;
public Greeter(String firstname, String lastname) {
name = firstname + " " + lastname;
}
public void sayHi() {
System.out.println("Hi "+name+"!");
}
}
# Ruby
class Greeter
def initialize(first_name, last_name)
@name = "#{first_name} #{last_name}"
end
def say_hi
puts "Hi #{@name}!"
end
end

Saturday, November 8, 2014

On the use of Alternate Universes in Fiction

Hello.

I've started using HTML to blog with, so sorry if this looks different. Also, if it looks like there are HTML tags in this post, blame google.

Now, to the point.

There are many issues with mirror universes, but I'll focus on a few.

How are they different

If everything was the same, then how did it become different in any way? The slightest change could, theoretically, have a huge impact on the world. Also, how is it different? Is it evil, because in that case....

If the Mirror Universe is evil, then everyone would have their own

The definition of evil shifts from person to person. I would find a world in which all minority groups are hunted down via international collaboration, or worse yet, a single world government, horrible. However, the person standing next to me could think that this world is horrifying and find a world government wonderful.

That doesn't increase or decrease the validity of anyone's particular vision. It only means that we hold differing ideals, and we have to work together to achieve what will make both of us, as well as everyone around us, most happy.

I'm too lazy to write more, so to the blog with this post!