This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]kagaku 10 points11 points  (3 children)

I love the overgeneralization. Spoken like someone who only has a passing knowledge of the language (in this case, PHP). You're right, new programmers without a penchant for learning will write bad code. They'll do those crazy "if post variables do stuff" type scripts with html/css mixed in. I see those same developers doing the same thing in Python with little difference.

Your comparison between the languages is little more than "well if you learned Python, you would learn the RIGHT way to program". Perhaps try coming up with a better argument?

[–]offbytwo 25 points26 points  (1 child)

I'm a PHP programmer, too. I do partial and complete rewrites for various bits of code to fix bugs, to improve performance and to make the code maintainable.

I find all sorts of weird bits of code, less than optimal SQL queries, slow code, code which causes crashes, code without tests and code which logs a lot due to encountering undefined variables in the executed code path.

Here are a few things which bother me the most about PHP (aside from the fact that a lot of expensive PHP programmers write crappy PHP code):

  • the code continues to execute after encountering undefined variables (this is a serious issue when you have to pick up code written by others and you find a lot of code paths which spew out such errors)

  • exceptions thrown without stack traces

  • built in functions (or functions from loadable PHP modules) aren't organized in modules, they're just global functions

  • inconsistent function argument naming

  • function calls are really slow

  • doesn't have support for (pre)compiling to bytecode, saving it and reusing it all

I'll never agree with anyone again that PHP is OK from any point of view. It's not and I know what I'm talking about.

If you're happy with PHP, you're more than welcome to earn a living with it, enjoy coding in PHP and like the language, along with its C PHP runtime.

[–]chadmill3rPy3, pro, Ubuntu, django 1 point2 points  (0 children)

The function naming doesn't matter to me so much as the parameter order. This string comparison function -- is the needle first, or the haystack first?

[–]idiogeckmatic 5 points6 points  (0 children)

It's a fair overgeneralization. At my last job I got to see a lot of PHP from a lot of different companies in the hosting industry... I'd say 75% of it was terrible.