From my own experience, developers, particularly inexperienced developers, when learning something new have an insatiable need to implement their new found knowledge .. no matter if it's a good fit or not for the problem at hand (myself included .. I remember abusing the hell out of recursion for example).
One of the worst examples I've seen is the functional programming paradigm being crowbarred out of PHP .. why.
One of the worst examples I've seen is the functional programming paradigm being crowbarred out of PHP .. why.
Most likely related to the Innter-platform effect: ...the tendency of software architects to create a system so customizable as to become a replica, and often a poor replica, of the software development platform they are using.
Hey bill - looks like you've been hellbanned. Something that you said on http://news.ycombinator.com/item?id=4213223 ticked someone off. Maybe talk to info@ycombinator.com and get it sorted out.
If you're talking about PHP's anonymous functions then yes I agree they have made life a lot easier. I was talking more about projects like Swiftmailer for instance, example:
// Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
->setFrom(array('john@doe.com' => 'John Doe'))
->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
->setBody('Here is the message itself')
;
That example is full of state. There's nothing to prevent you from calling any of those setX methods at a later point in time and changing the object's state. That interface very well could avoid state, but Swiftmailer doesn't seem to be implemented in that way. [1]
The stateless way would be to return an entirely new Swift_Message instance with each setX method. In languages that aren't built with immutability in mind, like PHP and Java, you end up instantiating and throwing away a lot of objects. Sometimes it doesn't matter, but when it does you use a mutable Builder to create the immutable instances.
That's why I said it appears to try and avoid state. Either way, as far as I'm concerned it's an horrific way to write code in an imperative language such as PHP.
This looks exactly like Smalltalk's cascading; just allows you to not repeat $message loads of times. To me it's a useful feature which I often would like when working with lots of Java libraries.
One of the worst examples I've seen is the functional programming paradigm being crowbarred out of PHP .. why.