The only reason you hate $programming_language is because you’re rubbish at it
A few weeks ago someone went and said that he mad up a law and then said something that seemed incredibly obvious. That “law” was “Any work that cannot be done will not be done”. This law is as useful as the Weather Rock. What’s next? “if you sleep during the deadline of the project you won’t get it in on time”? “the sky is usually blue”? Damn I’m surprised that no one has taken the “Men have a penis and women have a vagina” law. I would but I’ve chosen something a little more subtle.
It’s very common to hear someone go “I hate $programming_language. It’s rubbish.” especially when the person saying that is a first year in computer science and $programming_language is Java. I’ve never really got to a point where I hate java. I mean it makes sense for an Object Orientated programming language. The usual excuse to why they hate it is because it’s “hard”. Just because it’s hard doesn’t mean it’s rubbish. The only reason why you hate $programming_language is because you’re shit at it.
Though if the $programming_language was easy you wouldn’t hate it right? You would be able to write some amazing code with it and you would evangelize on how amazing $programming_language is. Right?
You don’t think so? I’ll pick a random language… hmmm… how about JavaScript? It seems perfect to explain all this. Most people hate it and to be fair: it actually is a bit shit. Though at least I can admit that you can do some amazing things with JavaScript. Most people tend to just throw it away saying that it’s rubbish and shouldn’t be used ever before going on facebook to join another inane group and send everyone an invite to it.
JavaScript is shit easy. Look at this example:
alert("Hello Buttheads"); |
Look at it. How the hell is that hard? What don’t like my incredibly patronising tone? wll I have to be if you think that JavaScript is hard. Here, Have a look at this one then:
alert(document.forms[0].number1.value + document.forms[0].number2.value); |
If you’re not sure what this does it takes the value of a form element named “number1″ and adds it to a form element called “number2″ and then gives a message box displaying that. However like you JavaScript is retarded and can’t tell if you want to sum 2 numbers or concatenate them. In which case you have to cast the value to a number if you want it to sum the two values like this:
function sumUp(a,b){ return Number(a)+Number(b); } alert(sumUp(document.forms[0].number1.value, document.forms[0].number2.value)); |
What? You can have FUNCTIONS in JavaScript? YES you can. Didn’t you know that?
Saying that though a lot of people don’t like alert() cause it’s fucking annoying. However you can do this instead:
function addStuff(daId,stuff){ document.getElementById(daId).innerHTML = stuff; } |
If you don’t get this, this basically adds “stuff” inside of tags set by “daId”
Well that’s essentially all that you need to know about JavaScript to do the first (and second year) JavaScript assignment. As you can see it isn’t really that hard other than JavaScript being the most retarded language to write in.
What? How is any of this useful? This is Web 2.0?
Well a basic knowledge of JavaScript is needed to understand the REALLY COOL JavaScript stuff (i.e. AJAX). Perhaps I might do another blog on AJAX in the future but for now I’ll just leave you with these examples for you to use.
PROTIP: JSLint is very useful when writing JavaScript I suggest you use that.
PROTIP: You’re still rubbish at JavaScript
PROTIP: “PROTIP” is the new “P.S.”

