Posts tagged with "programming"


Grilled cheese object reference diagrams

Here's an interesting thought for those of you interested in interesting thoughts. Well okay it would only be interesting for those doing object oriented programming if you want to be pedantic. Pedantic sounds like a cheap brand of paracetamol.

We're often told the advantage of using pseudocode and diagrams like ORDs is beneficial because they're programming language agnostic, but that's not entirely true. Take the above example of a grilled cheese sandwich class; it's all fair and good if we were using Java because only the String here is an object not a primitive data type. But what about something like Ruby in which everything is an object? Huh? Would it be something like this?

That's a lot of duplicated boxes. Clearly the ORD was envisioned when what I call "hyper dynamic" programming/scripting languages didn't exist! I can't think they'd be terribly practical to draw all the time as a Ruby developer unless you wanted to bend the rules a bit for it.

The diagram looks like my bedroom in Singapore, if my bedroom in Singapore contained boxes with attributes regarding instances of grilled cheese sandwich objects. I'd go for a nice Colby or Extra Tasty Cheddar. Makes sense to me.

I need a stiff cup of coffee.


The real problem with PHP

PHP motivational poster

Coursesy of Nick Hodge of Microsoft I read this article from The Register discussing Microsoft Azure's support for PHP. In particular these paragraphs stood out:

Yes, let me introduce you to the professional PHP programmer. You see, PHP is like a handgun. On its own, it is simply an inanimate tool that has no moral leaning. In the hands of a responsible citizen, it can be used to the benefit of society. But in the hands of someone who is untrained or mentally unstable, it can be used to commit horrible atrocities.

Whenever there's such a tragedy, other developers are quick to blame PHP. If PHP were illegal, then Yahoo would never have happened. If we regulated PHP tightly, then there would be no Digg. Now, it's not fair to say that the world would be better off without PHP, but its community could certainly use less encouragement, which is why Azure's support for PHP worries me.

This has been one of my primary criticisms of PHP from day one, aside from some elements of the language that don't make sense. PHP can be used to create elegant and fast web applications, but only in the hands of competent programmers. It is way too easy to easy to create horrible spaghetti code in PHP. Even in the hands of said competent programmers, maintaining PHP code others have written I think is also more difficult than it needs to be. Then again I've heard people use the exact same observations to claim the language is more flexible; each to their own.

In a way I make up for a lack of time by using high level languages like Ruby and Python because more than PHP (or Perl) they force you to do things "more correctly", Python moreso.