Going Dynamic with PHP
Five-Oh writes to tell us that IBM DeveloperWorks has an interesting article about the OO advantages of PHP V's new features. From the article: "PHP V5's new object-oriented programming features have raised the level of functionality in this popular language significantly. Learn how to use the dynamic features of PHP V5 to create objects that bend to fit your needs."
The answer would seem to be that there is no input validation or output interpretation going on in this sample. So, you can either write a switch block that makes sure your integers are in valid ranges, etc. or go back to individual properties. (Six dozen of one, half of the other.)
I'm a fan of using objects in the right place .. but to suggest they increase the functionality of a language is simply wrong. They allow for better (well, different) organisation of code, easier reuse, and improved encapsulation over procedural or functional coding styles, but they don't actually allow you to do anything that can't be done using any other approach. The functionality of the language remains the same.
http://twitter.com/onion2k
This is what I was thinking the entire time I was reading the article. I mean, it's one thing to have to whip up some small project for yourself, it's another to build a project that is maintainable by a group of people.
I'd bet that Brian W. Kernighan and Rob Pike (The Practice of Programming) would probably recommend against using it. It doesn't provide for clarity, nor does it simplify, it just makes things "easier" for the guy that writes the original code.
Notes From Under *nix: blas.phemo.us
So, it's got some of the features of Ruby now, plus a whole lot of crap dragged in from PHP 3 and 4 inluding that crazy mishmash of a function library? Boy, sign me up.
Any fool can code Perl, just like any fool can code PHP/C/Java/VB/Smalltalk/COBOL etc. etc.
Anyone can write code, but very few can write really great code, that reduces the problem to the essential elements and uses the simplest approach to the problem, with the tool (i.e. language) in hand.
You can write shit code in ANY language. You can also write good code in ANY language (within the limitations of the language).
What you're saying is like "Spanish for People who can't speak in German".
It's nonsense and insulting at the same time.
You need to express yourself or solve the problem within the framework of the language you have.
You might choose a different language for a particular task, but if the language is a given, a good poet (or programmer) will make the best of it.
A better language doesn't make one a better programmer (or poet).
Comments that a friend made: PHP 5 -- when using the OO -- looks a lot like Java, except no real threads, no security (sandbox), no WeakReferences and other GC niceties. Enjoy!
Yeah, the inability to scale is the primary reason all the porn sites use it...
And why we have a lot of high traffic sites that have no issue with it...
Threading != Scalability. Threading is only needed if you do certain types of tasks that need it.
In programming, there is no silver bullet, there are lots of tools suited for different jobs, PHP fits in a lot of those places, Java in others, other languages elsewhere. Threading isn't a "Oh, I'll multithread it, that'll make it faster" type of magic button.
This sig is the express property of someone.
Your comment is true, but the same can be said about Perl (it just sounded like you were putting down PHP only).
This is what frameworks are for. Security and performance conscious people like myself write them so that other neophytes and developers alike can make good PHP apps without worrying about those things.
'Yes, firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.'
Not enforcing Object Oriented programming is actually a very good thing, one of the few good things in PHP5.
Giving the option to use OOP (with a good object system, which PHP doesn't have) is good, forcing it on the poor user and preventing him to write as much as a line of code outside of a damn class is stupid, and is a god damn failure of both Java and C#.
While OOP is a good idea for some problem, others are better solved using more imperative or functional styles. That's why I much prefer Ruby or Python to Java: while they have great object models, they don't try to beat you with an ugly stick if you don't wrap every damn thing in a useless class that is only here because the language absolutely forbids you from doing otherwise.
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
Turing-completeness also states that, technically, there is nothing Python can do that Whitespace can't. That doesn't mean you have to use Whitespace..
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
You mean kinda like every language that supports OO design? None of this is even remotely ruby specific, or even ruby inspired.
You're really overreacting mate, especially since the kind of english being put down is the sort that's poor and lazy when the speaker could just as easily speak normal english. At least you included the word somehow as a handy comfort zone.
Now, how to take away the flamey tone of this reply? Common ground!