just "JR"
2011-04-21 09:56:47 UTC
When "classes" came in, I thought them as an extention of the classical C "structure", but not much more.
In my 18 years of web development, I have used ONE class, ONCE: to allow me to use php to create PDF documents, but I had to extend the class, just to make what I wanted. In other words, I have to write class methods, which, in fact, was nothing else but "writing a simple function", and add it to a "library".
Nowadays, everyone uses classes, but very few KNOW what the class does! (And they come here and ask "why is my call to that class not working" - without showing us the class code!).
I often see people including HUUUUUGE classes in their code, just because they need ONE method, when that "method" can be written with only a few lines of code. The result is that they end-up with a script of 20Mb, while I end-up with 5kb, doing EXACTLY the same thing!
When they got a problem, they can't find the answer.
When I got a problem, I can pin-point it in seconds...
I COULD understand to use a class if you have a script that makes 100 calls to that class, but for ONE call?
My principle is: "If you have to use a piece of code twice, make it a function".
I guess that's why "classes" have been invented.
But, then, I would call them "libraries of functions"...
The only thing I can think of is the big drawback in file-sizes. In the 80's, the Autocad space shuttle, well detailed, required 400k of data-file. Now it needs 4Gb! The 3999600kb are for the UNUSED "classes"...
Please, don't tell me "they make development faster": that's bull...
Please, don't tell me "they make the execution faster": that's bull as well...
So, WHY do we bother with classes? I don't get it...
(I must be getting old) :-)