02

12/11

Java’s Problems Compound on Themselves

13:17 by rleahy. Filed under: Elitism,Technology
Tags:

I just realize that when I posted yesterday I overlooked an instance of one flaw of Java exacerbating another flaw.

Yesterday’s post was about Java’s absence of pass-by-reference, and one Java programmer’s (i.e. “hostage’s“) defense thereof.

Talking about the idea of making a class that encapsulates the return values and returning that instead of having multiple return values via pass-by-reference I said:

Moreover, creating objects is non-trivial, especially creating an object so you can copy reference types into it, push the pointer to it onto the stack, pop it off, and then copy the reference types back out.

On further thought, I realized that this problem would be greatly lessened if Java supported something else that it doesn’t—structs—which are far cheaper to create than objects.

01

12/11

Java is Terrible and Java Programmers Have Stockholm Syndrome

09:47 by rleahy. Filed under: Elitism,Technology
Tags:

I hate Java.

It probably has a lot to do with being a libertarian, since Java is the programmer equivalent of big government—you want to write code, do it our way or not at all.

There are tonnes of dogmatic language decisions made about Java that aren’t made by its competitors—which are syntactically almost identical but much more flexible and useful because of the lack of dogma, e.g. C#—that I could rant about, but the most egregious—the one that I always fall back on—is pass-by-reference.

I was unable to sleep for a bit last night, and bored of watching Criminal Minds (the only non-HBO TV show I watch), so I decided to randomly Bing and see if Java had an equivalent to C#’s ref or out keywords yet.

The answer appears to still be “no“.

It seems, however, that when people use a deficient tool, they become emotionally attached to it and rather than recognizing and admitting its flaws they gloss over or even actively excuse them—a type of programming Stockholm Syndrome it would seem.

Case-in-point.

Let’s go through his workarounds one-by-one.

On a side note, I think it’s interesting that the header for the section I linked to is “[w]ays to avoid needing pass-by-reference“, which suggests that pass-by-reference is undesirable and should be “avoided“, whereas the anchor (if you view source) is “workaround“, which more accurately reflects the state-of-affairs: Something should be there, isn’t, and now you need to hack around it.  A bit of cognitive dissonance/doublethink/denial going on there.

I digress.

If any of your return values are status codes that indicate success or failure of the method, eliminate them immediately. Replace them with exception handling that throws an exception if the method does not complete successfully. The exception is a more standard way of handling error conditions, can be more expressive, and eliminates one of your return values.

Except exception throwing and catching is expensive (it triggers a stack trace, among other things), and it isn’t “a more standard way of handling error conditions“, it’s supposed to handle exceptional conditions (hence the name?). Not all errors are exceptional. If I want to read from a stream, but the stream is at the end of the underlying data, that’s an error, but it’s not exceptional since you reach the end of pretty much every stream (i.e. reaching the end is the rule, not the exception).

Find related groups of return values, and encapsulate them into objects that contain each piece of information as fields. The classes for these objects can be expanded to encapsulate their behavior later, to further improve the design of the code. Each set of related return values that you encapsulate into an object removes return values from the method by increasing the level of abstraction of the method’s interface. For instance, instead of passing co-ordinates X and Y by reference to allow them to be returned, create a mutable Point class, pass an object reference by value, and update the object’s values within the method.

Well sure, except that introducing non-standard classes just because one method had to return two values is idiotic and actually makes the code more confusing and harder to learn (since you have to learn the interface for a new class in addition to the signature/purpose of a new function).

The Point example is obviously hand-picked to make this look like a trivial argument, since the Point class (or struct, depending) is pretty much a given. But what about the case of highly efficient methods like TryParse, which is better than the corresponding Convert method solely because it doesn’t throw exceptions. Should we make a weird Boolean and Int32 encapsulating class just so this method can return without violating sacred Java dogma?

Moreover, creating objects is non-trivial, especially creating an object so you can copy reference types into it, push the pointer to it onto the stack, pop it off, and then copy the reference types back out.

Dumb.

If you find yourself passing in an object and then returning a new version of that object, and the object is mutable, then consider moving the method to be a member of the class of the object that you were passing. This can improve the encapsulation of the design and simplify the interface.

Well sure unless you happen to want both versions.

If, after all steps above, you are still left with multiple returns to a method, split the method into several different methods that each return a part of the answer. Using this set of methods from client code will be much clearer than one mega-method.

Except some functions that return many values are logically one function. Separating them to get around arbitrary dogmatic language restrictions doesn’t make any sense whatsoever and can actually make things less clear because one logical operation now requires more than one function invocation.

Besides, function invocations (unless inlined) represent overhead.

19

01/11

Negative Space is Retarded

21:43 by rleahy. Filed under: Elitism,Random,Technology
Tags: ,

Here’s a quick disclaimer before I begin: I’m not a web designer.  I don’t want to be a web designer.  This picture pretty much sums up why:

On top of the excellent points raised by the above graphic (I actually do have my own keyboard at work.  I don’t “bring” it though, I bought an extra one so I could leave it there and so it’d always be there waiting for me…) there’s also the fact that I really don’t care how things look.  When you think about it, it doesn’t matter either.  Why does it matter if your website has a billion little JavaScript tricks et cetera as long as it gets the point across?

It doesn’t.

In fact, I’ve noticed that how pretty a site is, and the quality of its content, seem to be inversely correlated.

And then there’s the fact that 9 out of 10 “pretty” sites just don’t work.  At all.

Anyway, this post is about the dirge that is “negative space“.  You go to a site, and you see somewhere in the area of seven miles of totally wasted space on either side of the content.  Either these people never understood that you can size things in CSS proportionally (i.e. set a div to 95% of the screen’s width rather than 800 pixels to appeal to the non-existent viewer who’s still trapped on a circa 1997 monitor), or they think that it’s somehow artistic and appealing.

Sure, negative space is an accepted idea in art and photography, but this is web design.  You’re not trying to appeal to the user with art, you’re attempting to present content, and content has to be read or viewed, and to do that screen real estate is required.  What are you hoping to achieve by wasting 2/3rds of the screen?  Is it your mission in life to make your users use the scroll wheel more?

Here’s an example—the Battle.NET forums (inb4: WoW lol) (I’ve just cut out the left half the screen so the image isn’t too wide/large):


(Haha idiot can’t spell “looking“…)

Seriously, what in the name of God? This might be alright if it was just the topic listing that was like this, but the thread display has this same design, so you wind up scrolling something like 3-4 times the normal amount. Do they think that users find longer pages more appealing or impressive?

If the point of your website is to allow users to enjoy your content, let them enjoy your content! Your “content“—hopefully—isn’t so small that you need “tricks” like this to make appear bigger, or merely the design itself, because if either is the case, you’re pretty fucking vapid, and you need to worry about other things than how nice your page looks.

Or maybe you’re worried about users on widescreen monitors having to constantly look side-to-side?

NEWSFLASH: I bought a widescreen monitor for a reason; I actually wanted it to be wide.  Don’t take that choice away from me you asshole, if I wanted to be compulsive scroll wheel user I would’ve bought a 4:3 monitor, but I didn’t so I don’t.

Also: I’m pretty sure all window managers from the Explorer shell to X Server allow you to resize windows.  If I’m so stupid that I don’t realize my eyeballs move side-to-side in their sockets, and my neck gets sore or something else, I’m either too fucking stupid to matter, or I’ll just make the window thinner and put it in the middle of my widescreen monitor and it will look the same!

13

12/10

You Own Your Life

15:00 by rleahy. Filed under: Elitism,Randian

It’s been a while since I’ve blogged—it may be the Christmas season, but it’s also exam season—so I decided I’d come share something I wrote on a forum.

There was a thread with someone complaining about their “depression“, their low grades in school, their family etc., and refusing to take ownership of their problems and just get through it.  Instead they were blaming their parents (teenagers lol) and their therapist.  After a while of trying to tell him to man up, I broke into this TL;DR after someone attacked me…

…it sparked quite the debate, as you’ll be able to imagine by the time you reach the end.

Hope you enjoy reading it as much as I enjoyed writing it.

I don’t have a “silver fucking spoon”, because neither my family nor I are wealthy. Neither my family nor I had unusual privilege; we didn’t have opportunities that thousands of other people haven’t had. People get where they’re going—or not—in life because they decide to go there or not.

You think my life has been easy? You think anyone’s life has been easy? No. Life is hard. It demands that you work for what you want, or that you don’t have it. I’m willing to work for it. I’m willing to take responsibility. I—and I alone—am willing to be responsible for my life and what happens in it. Both the good and the bad, I own and am responsible for them both. I can take pride in what I have because I earned it. I can fix what’s wrong with me because I caused it; I chose it—because it’s under my control.

I’m not a piece of paper in the wind, blowing from place-to-place by the volition of everyone of myself—no one is. They choose to be because it’s convenient. It’s convenient to blame where you are and what you are on everything but yourself, because if you’re the one responsible for it, then you’ve forced yourself to take responsibility. You’ve forced yourself into a position where you—and you alone—have to dig yourself out, where you have to fix it, where you have to work to achieve, and people don’t want that. People want everyone and everything except themselves to be responsible. They want to be lazy and achieve nothing and go nowhere and blame it on mommy and daddy, to blame it on depression, to blame it on learning disabilities, to blame it on their therapist, their teacher, their principal, to blame it on “the system”, to blame it on “the establishment”, to blame it an AD[H]D, to blame it on Asperger’s.

Everyone has their cross or crosses to bear. Everyone has something that they have to face head on and defeat, but they have to face it and defeat it. Everyone has hurdles that they have to jump over, but only they can jump over them. No one can fix your problems by giving you a hand up, because you have to take that hand and be willing to climb. No one can fix your problems with welfare or handouts, because that feeds you for a day, it does not feed you for a lifetime—only you can do that. No one can fix your problems because they are your problems and they require your dedication and effort to fix. If you sit there laying blame instead of picking up the yoke and working for what you want, you’ll never have what you want. All you’ll have are excuses you can use to explain to the bystander why you don’t have you want, but that won’t fill you with satisfaction, that won’t fill your life with joy, that won’t make your tenure on this earth worth living, it won’t help you sleep with the thoughts of what could’ve been. Only you—and you alone—can do that.

You can be born into privilege, into wealth, into power, but it won’t make any difference if you aren’t driven, because wealth can be mis-managed, because wealth must be earned and kept and maintained, because power is contingent on the people over whom it is exercised, because without people willing to heed your words, your supposed “power” means nothing, because privilege is contingent on the people elevating you above themselves, because unless people are willing to put you before others, you have no “privilege”, and because ultimately privilege, wealth, and power are not happiness or satisfaction in and of themselves. Many privileged men, many powerful men, many wealthy men, lived terrible lives because while privilege, power, and wealth are means to happiness, they are not happiness. They will bring you no happiness and no satisfaction unless you and you alone know what you want and are willing to exercise them to have it.

He can sit in his room, on his computer, on these forums, complaining about his lot in life, about his supposed depression, about his family, about school, about all these things, but that will get him nowhere—as I’ve said. At the end of the day, he’ll still be sitting. He’ll have accomplished nothing. He’ll be no further ahead. He’ll have nothing to be not-depressed about. He’ll spend his whole life complaining about his lot while the way he leads his life makes the lot he has in life. His complaints will become and remain self-fulfilling prophesy, and it will inconvenience no one but himself. He can make all the excuses he wants, he can scapegoat whatever conditions or whatever misfortunes he wants, but that won’t change the fact that he is a “have not”, while others—those who went out into the world and made a place for themselves—are “haves”. That’s not injustice, that’s justice. That’s not unfair, that’s fair. You are what you make yourself. Your life is what you make it. Ownership of your life isn’t just the ability to lead it, it’s the ability to decide it, and since only you can make those decisions—since you own your life—you—and you alone—are responsible for them.

You’ll notice that the men who take ownership of their lives and their decisions are the ones who have done well for themselves, who have good lives—the “haves”. You say that this is because they are successful, that they say these things to maintain the status quo, to make themselves appear good, hard-working, and motivated. You say that they are only “haves” because of luck—because of things beyond their control. You say that the destitute and the down-trodden—those who blame everyone but themselves for their lot in life—are the truly aware ones, the ones who believe that men are not controllers of their own destiny, but rather beholden entirely to the whimsy of fate, those who believe that your fate is decided for you, rather than you deciding your fate.

I tell you that it is exactly the opposite. The men of wealth, of success, the men of happiness, these are the men who are truly enlightened. No man obtains wealth or success or happiness by luck, for wealth must be produced by his own effort, or obtained through trade by the consent of his fellow man. Wealth is a judgment upon your work and your effort by your fellow man. Wealth is truly earned. Success is but a rubric whereby everything in your life is measured, and it is decided whether you have done well for yourself or not. Happiness is having what you want. They are intrinsically linked. To be happy you must know what you want and you must obtain it. To possess wealth you must produce it or obtain it from your fellow man by trade. To be successful you must be wealthy and happy. None of this is luck, it is a measurement of you. Of what your life is and what you have made it. No one makes you successful or unsuccessful. Men are born and remain free, with the ability to think for themselves and determine their own fate. Since their fate is determined by them—since they are free, capable of deciding for themselves—then they own their fate, and whether it be good or bad, they own it and are responsible for it. No one cares more highly for you than you do, for all men are born and remain selfish and individualistic, interested only in their own success, happiness, and wealth. If you wish to be happy, you must know what you want and you must get it. To be wealthy, you must make other men happy—you must satisfy and appeal to their endemic selfishness—so that you may part them from their wealth and add it to your own.

No man—being born and remaining free—is ever exploited by another man, for in a free society all associations and transactions are voluntary. The only one who may exploit him is himself, by giving into his laziness, his depravity, by refusing to live his life and live it well. And when a man does this, then all the judgment of other men crash down upon him. Then the framework by which those who live their lives and live it well are made happy destroys him utterly—and not unfairly. He may know what he wants—know what it will take for him to be happy—but he will not be allowed to have it, for he offers no one anything for which they are willing to trade—he cannot acquire the wealth by which he may be happy.

There is, however, one hope for the men who destroy their own lives. They betray what makes them human—their mind—and turn instead to what separates animals and men. They raise arms, they raise clenched fists against the “establishment” and the “bourgeoisie”. They point guns at their fellow man and seize what they could not earn by force. They betray reason and free will, instead seizing what they want. These are the men who do not understand that the world was not built by destroyers and looters, but by producers. The world was not built by men of weakness, stupidity, or force, but rather was built by men of wealth, success, and production. The world was not built by men who cried about their lot in life, who complained that it was unfair or too hard. No. The world was built by men of fortitude, men who were armed with nothing but their own vision. Men who knew what they wanted, and weren’t afraid to go out amongst their fellow man and get it, men who didn’t fear the mind. Men who didn’t demonize the individual, with his wants and needs, but dignified the individual, granting the individual the satisfaction of those wants and needs in exchange for the satisfaction of his own wants and needs. Men who realized that trade isn’t exploitation, that it isn’t evil, that dealing with your fellow man by offering him something he wants in exchange for something you want is the most righteous thing that you can do.

You do not engage in trade, nor produce the things needed to trade, by complaining about your lot in life. Rather you engage in trade, you produce the things necessary for trade, and make yourself happy by obtaining what you want in life through trade, through your own effort; by making yourself and your effort something that those around you value and want and are willing to trade for.

So who will you empower? Who will you dignify? Those who create happiness—both for themselves and others—through their own effort, through their ownership of themselves and their lives, or those who lay claim by tears or guns upon happiness which is not theirs and which they have neither produced nor earned? The food that you eat to sustain yourself, was this produced by tears or by guns, or was it produced by men who stand tall, seizing control of themselves and their minds and their lives, who are willing to work for themselves?

You tell me that I have no understanding of the world or its realities, and yet you yourself do not seem to understand that it is not tears or guns that make the world go around. It is not tears or guns which have lifted men from a tribal existence living off the land, to a metropolitan existence where man rules the land. It was not tears or guns that gave you the ability to eat oranges not only when they are in season, or not only where they grow naturally, but wherever and whenever you want. Tears and guns bring upon the world death, destruction, hunger, and starvation, for crying idly does not plough fields nor harvest them, and violence cannot force wheat to sprout nor place it upon the mill nor make it into the bread you require to survive.

I ask for men to be and remain empowered—masters and makers of their own fate. You ask for them to be a piece of paper in the wind, going wherever those around them take them. I ask for progress, betterment both of the self and others. You ask for destruction. You deal with me by insults. I deal with you by words and logic—the tools of the mind.

Which of us is truly noble?

If the world is so terrible, then why has it not changed? Many men of great power from differing backgrounds and with differing views have ruled great portions of the earth throughout history. Many men have pointed many guns at many people and sought to change human nature, and yet all have failed. When will you realize that no common good, that no collective power or cause, can trump the individual? Because every collective, every common good, is an umbrella under which stand many men. To deny the individual for the sake of your collective or your common good is to destroy each component of your collective and your common good. To take from the rich to give to the poor is to place higher value upon the poor than the rich, to say that the poor may keep all that they earn and that they may seize the wealth of the rich, but that the rich may not even keep that which they earn. To say that men are not owners of themselves and of their minds and of their destinies is to defy everything it means to be human, to destroy the selfishness and individualism which are at the core of our existence and the motives which incite us to make the world a better place.

I see men for what they are and love it, love their nature and wish to see it unleashed. You see men for what they aren’t and seek to destroy and change their nature, to mold them by force into something you would prefer more, and wonder why they rebel at every turn. It is not that they are unintelligent or unenlightened, it is that men are and are driven to remain free, and that they may be bent, but they may never be broken.

30

11/10

A Compelling Reason Not to Buy a MacBook

00:00 by rleahy. Filed under: Elitism,Technology

One of my pet peeves is Apple.

Not any particular product that they make, just their corporate ethos in general.

Therefore you can imagine that it bothers me when people go ahead and buy MacBooks, without really giving serious consideration to what they’re actually buying.

I don’t really understand what the allure of MacBooks is.  Is it the shiny brushed aluminium body?  You can get that from HP in their EliteBook line.  Is it the terrible UNIX-inspired OS with minimal compatibility?  Why not just use Windows which actually just works“?  Or maybe it’s the lack of a user-replaceable battery?  The absence of DVI and HDMI in favour of the widely-unsupported DisplayPort?

I could go on for a while—and probably will, in later blog posts (aren’t you excited?)—but the point is, is that I don’t think most people buying MacBooks actually think about what they’re throwing away their hard-earned money on.

I would rant about that—them throwing their money away—but then I’d have to tag this post “Randian” and possibly “Libertarianism“ as well and that wasn’t what I was aiming for.

However, I could be mis-judging, and everyone who buys a MacBook really needs to use Final Cut Pro.  Or maybe they legitimately buy into the ridiculous notion that the Mac is better for graphics design (Adobe makes the Creative Suite for Windows too…).

Anyway, my “[c]ompelling [r]eason [n]ot to [b]uy a MacBook” is none of the things cited above—that was just a warm up/vent. What I actually wanted to talk about was the MacBook keyboard:

A lot of you are probably thinking that I’m off my rocker, that the MacBook keyboard is the best part of the MacBook, et cetera, but hear me out—I know what I’m talking about when it comes to keyboards.

Sure, the chiclet design is great, but you can just get that in an HP ProBook and a bunch of other Windows laptops if you want that.  The problems with this keyboard are:

  • Why is “fn” outside of “control“?  Did Steve Jobs decide that having CTRL/”control” on the outside—where everyone is used to it—was too conformist?
  • Speaking of CTRL/”control“, don’t keyboards have a left and right CTRL?
  • Why is “option” outside of “command“?  See above.
  • Why are the up and down arrow keys so tiny?
  • Why is BACKSPACE labelled as “delete“?  See my conformist critique again.
  • Speaking of DELETE, where is it?
  • Where are HOME, END, PAGE UP, and PAGE DOWN?

These aren’t just cosmetic complaints, or complaints about having to break and remake habits (which is bad HCI anyway Mr. Jobs).  There’s a reason that there’s a gap between CTRL and ALT on a regular keyboard.  Go and hold down WIN and CTRL (which are side-by-side), and now CTRL and ALT.  Which is more comfortable?  That aside, what about CTRL+A?  Try holding WIN+A (which is comparable to CTRL+A on the MacBook keyboard), not as comfortable, is it?

Then there’s the matter of the missing keys—to be comprehensive, the list is: HOME, END, PAGE UP, PAGE DOWN, INSERT, DELETE, PRINT SCREEN, SCROLL LOCK, and PAUSE—where did they go?  Admittedly, at least two of those keys (I’m thinking SCROLL LOCK and INSERT here) aren’t very useful, but what about the others?  How do you do serious text editing without HOME, END, and DELETE?  I’ve Googled it, and there are replacement keyboard shortcuts (COMMAND+RIGHT ARROW=END), but these are nowhere near as convenient.  When you want to select a full line of text, you go to the beginning of it (HOME), then select (hold SHIFT), and then go to the end (END) and remove it (DELETE or BACKSPACE).  With your MacBook, you have at least two more keystrokes which have to be made with the same hand that’s holding SHIFT (or with the hand that’s stroking the arrow keys).  As an added bonus, the arrow keys that you have to use to execute these useful text editing commands are tiny.  These keys were put on the keyboard for good reason, replacing them with two keystrokes just makes life more complicated.

Which leads nicely into a long-standing complaint I have about the Mac world: When you want to do something simple with Mac, it’s usually easier than it is on any other platform, but as soon as you want to do serious work, your life just becomes much more complicated, since, to make the simpler things simpler, they had to take and hide the more complex functionality.

The above picture is the keyboard used on all MacBooks—even the 17″ ones—below I’ve included a picture of the keyboard from my 12.1″ HP EliteBook 2740p tablet, for comparison:

Whoa look at that!  A CTRL key I can comfortably hit alongside A!  Arrow keys that aren’t ridiculously small!  HOME, END, and DELETE, my old friends!  A properly labelled BACKSPACE key!

Just because I enjoy kicking Macs when they’re already down, I mentioned that the Mac keyboard pictured above was the keyboard for all MacBooks, specifically mentioning that the 17″ model was included in that statement.  This wasn’t a mistake.

Where am I going with this?

The 17″ MacBook doesn’t have a numberpad!

This person has the correct idea:

22

11/10

Snow in the Pacific Northwest

12:31 by rleahy. Filed under: Elitism,Random

So, it’s snowing here in the Pacific Northwest.

Not so unusual many, many other places in North America, but it doesn’t happen often here.

I get to ignorantly thinking—times when it isn’t snowing—that man really has conquered nature. We have settlements in places that have no business being settled, running water in places that have no business having running water, cool shopping malls in places where it’s over 40°C, et cetera.

But snow—crystallized water falling from the sky—that conquers us here in the Pacific Northwest.

I’m always amazed by how incapable people are of handling themselves in the snow.  Whether it’s just blind panic at the sight of fluffy whiteness falling from the sky, their inability to leave their houses because of the powder covering the ground, or their inability to see that driving around a sharp bend at 60km/h when the road is covered in crystals of ice is a bad idea, it amazes me.

And so, life—at least, normal life—here in the Pacific Northwest grinds to a halt for a while, and everyone acts like it’s totally normal for people to be wantonly skipping classes or calling into work, just because some powder’s covering the ground (and look at the picture, it’s not even that deep!).

Me?  I’ll be at work, at school, driving the roads, out and about doing the things that I normally do.

Because there are still men—or maybe just one man, me—who doesn’t stop just because nature threw something in their way.