Welcome
 

Firefox to support OGG in

Sunday, August 3rd, 2008 Write a comment


Open source browser Firefox is going to support Ogg Theora video natively without installing plugins and will support the new HTML 5 tag

This is great news since there has been a long debate about the HTML 5

The latest version of Opera browser also supports Ogg Theora videos natively already.

Popularity: unranked [?]

 

Testing weblogger.el again

Wednesday, November 28th, 2007 Write a Comment

Lets see how enhanced this enhanced weblogger.el is. Last time it was
awful and messed up stuff in my post. Note that this is supposed to be
also categorized from within Emacs.

Popularity: 5% [?]

Ubuntu Gutsy CDs

Monday, November 19th, 2007 Write a Comment



Ubuntu Gutsy CDs

Originally uploaded by gabrielsaldana

Aahh por fin llegaron los discos de Ubuntu para el GSLIEST.

Despues de varios intentos fallidos de supuestos envios que nunca llegaron, por fin llego mi pedido.

La banda del GSLIEST los va a disfrutar. Gracias Canonical!

Popularity: 6% [?]

PHP 5 OOP implementation quirks

Wednesday, November 14th, 2007 8 Comments

PHP 5 is supposed to be fully object oriented. Yes, it has classes and inheritance and all those things an OOP language is supposed to have. But, is it implemented like most OOP languages?

First of all, I come from a C/C++ background, so there’s where I got all my OOP lessons. Then I started to learn Python and Ruby, and well, finally lots of little OOP details I couldn’t understand were clear. Ruby has a beautiful OOP implementation, sometimes it can get confusing having everything as an object and the object and class themselves are objects. But once you pass that, everything is cystal clear.

What bothers me about PHP 5’s OOP implementation is first of all, constructors. If I declare a Parent class, with a constructor, then a Child class that inherits from Parent, and this Child class has its constructor, when I instantiate an object of the Child class, only the Child class constructor is called.


class Parent
{
__construct()
{
echo "hello from parent ";
}
}

class Child extends Parent
{
__construct()
{
echo "hello from child ";
}
}

dummy = new Child();

This will display only

hello from child

Where in other languages, such as C++, Python or Ruby (don’t know about Java, but I expect the same) the output would be:

hello from parent hello from child

So in order to have this constructor cascading effect, in PHP 5 I have to explicitly call the parent constructor on my child’s constructor like this:


class Child extends Parent
{
__construct()
{
echo "hello from child ";
parent::__construct();
}
}

Which is not very nice.

Another aspect that I dislike is the class attribute accessor methods. I call them accessors like in Ruby, but they are commonly called setter and getter methods. So in order to control and filter my input/output for my object, I usually do so with this methods.

If I declare a User class with some methods, I expect the setter and getter methods to filter my I/O everytime I want to access the class’ attributes.


class User
{
public $name;
public $email;
public $password;
//set and get functions
public function __get($variable)
{
return $this->$variable;
}
public function __set($var, $value)
{
trim($value);
if($var != "password")
{
$this->$var = $value;
}
else
{
$this->password = hash('md5',$value);
}
}
}

This is supposed to encrypt the password everytime I set something on my password object attribute. What is wrong with this? That it doesn’t work! The get and set functions only work when you have NO attributes or undefined attributes in the class. So in order for this getter and setter methods to really filter I/O to the instantiated objects is to not declare the attributes, and this methods will generate them, like the PHP people say, “magically”. Maybe its a nice flexibility feature to have attributes generated on-the-fly, but it doesn’t help on object consistency.

PHP 5 is a nice tool, but as a language I think there’s still work to do on the OOP implementation.

Popularity: 8% [?]