Saturday, 10 January 2015

8 Shortcomings That Make Programmers Hate PHP!

The programming world is often very choosy about the language they use for their projects. This is perhaps best witnesses in the PHP vs Java debate. While there are proponents of PHP, it is hard to ignore some of the shortcomings of the language.

PHP, HTML, Java, PHP coding, PHP shortcomings, PHP mistakes, learn PHP, PHP faults

1. PHP to HTML to PHP

If you’ve used PHP, you would know that you have to switch frequently between PHP and HTML. It becomes quite tough to keep up with what you’re coding in and when.

2. Markup mixing

The basis of PHP is to mix HTML with controller logic for the server. This isn’t a good practice and should be avoided. But avoiding it pretty much defeats the purpose of using PHP, making Java the better choice.

3. Nomenclature

Commands and functions in PHP have weird and inconsistent nomenclature. This is a big negative for any language. The API isn’t well thought out, which makes it difficult to get a hang of it.

4. Sort

Have you seen the number of sort functions that PHP has? Java has one sort function, while PHP has multiple, which is unnecessary and confusing. As a programmer, one sort function is enough and having more makes it difficult to understand what to use where.

5. Open Source

Is PHP open source? Yes. Is everything about it open source? Definitely no. In fact, many have said that the most important aspects of PHP aren’t open source, which again defeats the purpose of being open source in some ways. Caching is a good example of this.

6. Broken Namespaces

If you’re going to use namespaces, then make sure you’re using PHP 5.3, which is when namespaces first started. If you don’t use PHP 5.3 then ensure that your code doesn’t collide with any of the libraries because it will conflict with the fact that everything was global in the old days.

7. Broken Type Safety

(string)"false" == (int)0

See that expression above? In PHP, this expression is valid. This means that a string is equal to an integer, which is just crazy. The designers really needed to take another look at this one.

8. Options and redundancies

Options are always good in life, but not when you’re coding. Sure, it is good to have some options, but too many options and redundancies are bad. That is what happens in PHP, there are too many ways to do the same thing. As a result, it is very difficult to simplify your code in PHP.
Related Posts Plugin for WordPress, Blogger...