News for hackers. Stuff that matters.
Re:In Defence of WordPress by pyre on Thursday May 14, 2015 @10:24PM (#9548654)
I've heard that it's not very good at the "web app" paradigm vs. the "cgi script" paradigm that it was created in. Is that really true?
Re:In Defence of WordPress by girvo on Thursday May 14, 2015 @10:28PM (#9548665)
Not in 2015 it's not! Front-controller pattern (single index.php, in the same way you'd have a single Python process that Nginx talks to) that hands off to something like Silex or Symfony or Laravel, and you have a beautiful base for a proper web application API layer -- autoloaded classes, proper dependency injection, and more.
Re:In Defence of WordPress by fsk on Thursday May 14, 2015 @10:45PM (#9548712)
I never liked the pattern of routing every single request through index.php. I prefer to let Apache do the routing for me, having a separate script for each task.

I also had a PITA debugging someone else's code with autoload magic. He didn't follow any pattern for what code was in which directory, and he reused class names so grep didn't work. Now where is that source file again? (In one particular abomination, he took a string from the database and included that source file.)

That's one nice thing about PHP. You can use PHP for a simple straightforward style, or for an abomination like zend.

Vanilla wordpress is good. I'm working on a project that has a custom framework that lives on top of WordPress, and I'm cursing the people who wrote it and my employer for outsourcing the WordPress project to them.

Re:In Defence of WordPress by vectorpush on Thursday May 14, 2015 @10:54PM (#9548748)
> He didn't follow any pattern for what code was in which directory, and he reused class names so grep didn't work. Now where is that source file again?

http://www.php-fig.org/psr/psr-4/

Re:In Defence of WordPress by fsk on Thursday May 14, 2015 @11:02PM (#9548764)
Nope, he didn't follow that, he had a bunch of exceptions coded in his autoload function.

He also had a bunch of functions where a function in one class nothing but call another function in another class. He also had way too many classes.

Re:In Defence of WordPress by girvo on Thursday May 14, 2015 @11:52PM (#9548858)
Right, but that's the problem.

You can quite easily make an abomination of a class hierarchy in Ruby, or Javascript, or even Python to some extent. If people don't follow best practices, then of course things will not work with other tools that expect your work to do so.

Also, I highly recommend XDebug with the Codebug[0] client -- if you're working with a crappy codebase and run into the issue of "what damned file is this?" it will solve that in a super nice way. It also gives you a full REPL in your working environment, pause execution and play around in the PHP side during your request :)

[0] http://codebugapp.com

Re:In Defence of WordPress by fsk on Friday May 15, 2015 @07:34PM (#9554317)
I'll look into Codebug. I haven't found a PHP editor I really like yet. I've been using dev-PHP and emacs. I'm using Netbeans at work and don't like it.

Oh nevermind, Mac only, forget it.

Re:In Defence of WordPress by PebblesHD on Thursday May 14, 2015 @11:34PM (#9548834)
well said. Personally I like the file based routing solution (Multiple scripts for individual tasks) where applicable, there are benefits to multi-function scripts but I like modularity. If i've already written a script to do X, why re-write it every time? Still All these points above and below are good.
Re:In Defence of WordPress by girvo on Friday May 15, 2015 @12:38AM (#9548969)
The key benefit to the front-controller architecture is that you can keep your code outside of the webroot, such that you can avoid misconfigurations causing security issues, and allowing for user uploads without exec permissions on the files in the uploads directory.

The other reason I like it is it gives me much more control over routing, versus relying on folder and file structures :)

Re:In Defence of WordPress by vectorpush on Thursday May 14, 2015 @10:53PM (#9548743)
I'm not really sure there is much of a difference between the two beyond routing (which the framework handles just like in all the other popular imperative scripting languages), in fact if anything I'd say PHP is more aligned with the "web app" paradigm since the canonical run-times are all intended to be paired up with an HTTP server, as opposed to most others which were designed as general purpose scripting languages. I don't think it makes much of a difference though.