Tuesday, July 27, 2010

The Unholy Trinity

Hi, and welcome to another post about how much x or y sucks. Well, not really. This is more of a "lots of people who use x and y" sucks type of post. Whatever the programming language, or framework, or CMS, there will be people who make it work, and like it.

Well, this post is about Javascript, HTML, and PHP. All three are established technologies that make life a little bit easier for everybody. Well, except Luddites and people with no access to the Internet. All three of these technologies work.

Now, because they work, an entire industry has evolved out of making money from it. I myself make money out of fixing websites. While this financial reward is a good incentive to learn, it is not a good enough incentive for many people to learn enough. There is so much money being made off the Internet that it attracts people who suck at writing code.

I was never a computer scientist, but I think some of them believe that the golden age of information technology came when computers were giant, vacuum tube monsters that scared the common person away. Programming back then usually involved a lot of numbers. Despite the tedium of it all, they consider it the golden age because only the most disciplined and learned people actually handled computers. Except for the rare, insect induced error, most problems resulted from mistakes by people they knew, people they could talk to, and people they can expect to fix the problem.

Nowadays, with high level languages, writing a program is considerably easier. In fact, it's so easy that thousands of people join the big happy family that is the IT industry yearly. Just like any family, there smart relatives, and stupid relatives.

It's possible to write bad code even with a ridiculously strict language like ADA or Eiffel. Javascript, HTML, and PHP are not unique in that regard. However, Javascript, HTML, and PHP are so damn easy to learn, that any fool can pick up a book, code a little, and then pass off as a pro.

Take HTML for example. It's fantastically hard to write it wrong. However, I've handled pages where the design is scattered all over the elements, and design changes take hours! Learn CSS!

As for Javascript, there are still quite a few people who haven't caught on to the JQuery, MooTools bandwagon. Stop writing your own code, and then complaining why it doesn't work on every browser!

However, PHP, at least for me, is one of the worst offenders. I've seen boatloads of code that don't even have proper indentation. Sure, the code words, but when something needs to change, it takes forever to understand it, let alone change it.

Well, it's not the fault of tool. It's the fault of all the people who don't use it properly.

Tuesday, July 20, 2010

What Makes Joomla so Hard?

I recently had to work on a Joomla project. It was a simple application. There was at most 20 pages, and hardly anything was generated dynamically. It could have been a simple HTML website that anybody with a basic knowledge of HTML could edit.

However, because it was the year 2010, somebody made the decision to use a content management system, in this case Joomla. The goal of using Joomla was to free the unlucky soul tasked with maintaining the site the burden of learning HTML. Things didn't turn out that way though.

The development didn't really have a process. They wanted results now, so we used the first modules and components that could recreate the mock-up. While this rapid development seemed like a boon, little did we know that there was a price to pay.

In the last weeks, the clients asked for SEO friendly URLs. Let's just say that Joomla does not do this by default. We turned on the built-in SEO friendly URL feature, but it was not SEO friendly enough. We then tried installing components like Artio JOOMSEF and it apparently didn't like the configuration of the server.

Well, the development slowed down, and lots of things got finished late.

Now, I'm tempted to say "JOOMLA SUCKS BIG TIME" because a lot of Joomla fanboys will frequent this post and shoot my hit count up but I won't be giving credit where credit is due. Joomla is a tool, just like C++. It can make life easier, or harder depending on the usage. In this instance, it made life harder because we neglected to think about a few problems.

1.) Modules and components don't always work well with each other. In a perfect world, people write code that only affects itself. The world is not perfect and there are thousands of bad programmers out there, and some of them write for Joomla. Test everything.

2.) Manage the expectations of the client. Sure Joomla is as customizable as any ground up website, but it will most likely take more time. Modules and components can be altered to produce all sorts of effects but making a module or component do something it never did in the first place increases the time it takes to test things, and exposes the project to the first problem.

3.) Get the client to focus on things that are really important. In the above example, the client was paying too much attention on font sizes and button sizes. Sure, it was easy to change stuff like that, but it created an illusion that the project was actually close to completion. When the really important stuff like SEO friendly URLs came out, things got delayed and we got the flak.

People make things hard. I could be using an archaic language like COBOL, but if I coordinate with my clients better than the above example, I'm sure I'll have an easier time.

Wednesday, July 14, 2010

Hello World

It's normally a custom for new programmers to write a "hello world" program. Underlying the seemingly simple command that displays two words is a vast set of instructions that can turn a mere mortal (in the real world) into a deity (in the computer world). With all that power, wouldn't it be cool to just jump into the the computer realm like in Tron or in Superhuman Samurai Syber-Squad? Although it sounds good, any technological paradise could easily turn into technological Tartarus, considering that a lot of people can't use computers properly.

I'd like to introduce Edsger W. Dijkstra. He's a well known computer scientist from the Netherlands. Here is one of his quotes.

How do we convince people that in programming simplicity and clarity —in short: what mathematicians call "elegance"— are not a dispensable luxury, but a crucial matter that decides between success and failure?

Now, this quote is extremely relevant to the point of making it my first post because too many people in Information Technology are making their lives more complex. To prove my point, here is a math example.

I start at the number 10. I want to be at number 2.

10 - 8 = 2
10 + (10 - 18) = 2
10 * (2 / 10) = 2

Needless to say, there are are infinite number of possibilities. Now, given that I just wanted the number 2, the first option is better. Why waste time calculating more and more numbers when a simple equation can do the trick?

Now, it's tempting to think that people always pick the simplest equation, the easiest path, but that isn't really the case all the time. Take for example, Joomla. It's a content management system, and a popular one to boot. Lots of users are using it, and lots of developers are writing code for it. It's also open source, so users are free to alter the code if they need to. The problem though, is that a lot of the code for Joomla sucks. I've been tasked to alter modules and plugins to make it behave in a certain way, and most of the time, I keep seeing code like this.


if($variable1 == $class1->method1($parameter1, $parameter2, $parameter3, $class2->method1()) || ($variable2 && $class1->method2($parameter4, $parameter5)))


I'm not saying that Joomla sucks, or all of its developers sucks. I'm just saying that some people just write stuff and make it the problem of somebody else. I just used Joomla as an example because the more popular something is, the more crap gets thrown in its direction, from all directions!

Take the IPhone for example. I hear it's really popular, despite having a bad antenna that can't receive signals through human flesh. It's selling like pancakes. Now, the application market for the IPhone is booming. Now for every useful application, or nifty new game, there's this horrible app waiting to be purchased. In truth, there are enough bad applications that Apple has to resort to draconian licensing with the SDK.

Generally, I all for the spread of technology. I think it can really help people do more with their lives. However, when some fool starts misusing technology, making things harder for other people, that's when the hammer needs to be brought down.