Bitcoin Forum

Other => Off-topic => Topic started by: jothan on January 24, 2012, 04:55:49 AM



Title: Re: Looking for someone to create/modify software for this forum [1100+ BTC]
Post by: jothan on January 24, 2012, 04:55:49 AM
Are you dead set on PHP? I know PHP, but I really am loving python.

For better or worse, PHP is the BASIC of the web, with all that it implies and I am in a good mood about PHP today. I speak from experience, I have used PHP extensively starting in 2003.

I have also, over time, called it:

  • A bad imitation of Perl.
  • The FORTRAN of the web.
  • Noob bait.
  • A poor replacement for Intel 8088 8 bit assembly.

When the PHP devs could have taken a good decision, they have almost always made the bad one. The result is:

  • No standard file to class name mapping (autoloader).
  • A single namespace.
  • No support for unicode strings without a clumsy external module.
  • A lot of extensions supported, but they sometimes have limitations that make them unusable.
  • The default embedded code in HTML is a horrible templating tool.
  • No exceptions thrown from functions that wrap system calls.
  • When a standard function has an error, it returns 0, null, false or something else entirely.
  • Inconsistent naming of functions, underscores CamelCase, nothing, guess which one.
  • Class system is a bad imitation of Java. Constructors cannot be overriden.
  • Poor runtime, no weak references, a daemon written in PHP will eventually run out of memory because of this.
  • Static context, everything, the web browser connection, the $_GET, $_POST cannot be separated from the runtime context. Everything is global and static. Compare with Python WSGI.
  • false == null, false == "", false !== null, this will slowly drive you insane.

Edit: I forgot to mention: useless dollars signs everywhere that remind you how much $ you could be making coding with any other language.

You will not regret picking any language over PHP. Python is heavenly compared to it.

Sorry for bashing, but this is hard-felt experience.


Title: Re: Looking for someone to create/modify software for this forum [1100+ BTC]
Post by: theymos on January 24, 2012, 04:41:12 PM
PHP is my favorite language for small projects. It's far from the best language for any task, but it has so many built-in functions that you can do anything with it. I've even written a little Bitcoin network client with it.

No exceptions thrown from functions that wrap system calls.

You can use ErrorException to change this.

I forgot to mention: useless dollars signs everywhere that remind you how much $ you could be making coding with any other language.

There's a reason for this, though it probably could have been done in a better way. Text after a dollar sign is just a string representing the variable name, so you can do stuff like this:
Code:
//Assign "asdf" to the variable whose name is contained in $varname
$$varname="asdf";
Bitcoin Block Explorer uses this feature to create variables from the slash-separated data in the URL:
Code:
//creates variables like $param1,$param2, etc.
${"param".$number}=urldecode($item);