Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,133 members, 7,814,973 topics. Date: Thursday, 02 May 2024 at 03:03 AM

Why PHP Should Not Be Your Primary Language - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Why PHP Should Not Be Your Primary Language (4464 Views)

Complete Primary And Secondary Website Needed / ICT Training Manual For Primary School And Secondary Schools (2) (3) (4)

(1) (2) (3) (Reply) (Go Down)

Why PHP Should Not Be Your Primary Language by larisoft: 1:09pm On Jul 11, 2016
In Nigeria, it is taken for granted that any body who calls him/her self a programmer knows the PHP language. PHP rocks. There are thousands of already written free software implemented in the Language. There is a hug support base…probably the biggest for all web programming languages. And most importantly, PHP has a low learning curve.
However, except in the hands of those who know the language thoroughly (and because they know it thoroughly, they know when not to use it) PHP might be a bad language for any slightly huge project. Here is why.

Bad Concurrency
As a newbie, I churned out more programs in a week than I knew what to do with. Every program seemed so easy and I kept wondering why I would ever need to use Java or C# to write a web app. I then got a contract to implement an app which facilitates file sharing. This was no big deal. In a matter of days, the app was ready (with a lot of bad, undocumented code of course).
There was a problem though. Once up to 100 persons tried sharing files of (5mb+) at about the same time, a lot of errors sprung up ranging from gateway time out to connection to server lost. Once this happened, the user had to start over.

I realized what I needed was called “multi-threading”. This would have allowed the files to be queued for upload, eaten away in bits and pushed to another queue of files ready to be sent to clients that request for them. All this would be so efficiently controlled that a thousand people can exchange files, and the user can see a message like “too many people are uploading, your file is uploading but going much slower”. Or it could just show a progress bar (like google drive). I will also be able to limit the number of active threads, keeping some activities in pause till more threads are freed. The load on the server would have been so controlled,

PHP is just bad for this. There are libraries of course that simulate this by instantiating another PHP Instance. But you’d be simulating and you’d eventually move over to langauges that offer multithreading features natively.


Speed
There are lots of goody goody resources out there telling us that PHP’s speed is just as good as any other language. I wont argue. I will just show you facts and let you decipher the truth for yourself.
PHP is an interpreted language. Every time a page is requested in PHP, it is compiled and then the compiled code is executed. This means that your code is read from disk first, compiled, and then the compiled code is executed. Compare this to a compiled language like C# where the process for responding to a request is just ….execute!


Respect

Respect is everything in the lives of hackers. Introducing yourself as a coder whose primary language is PHP makes you look weak. This will affect the circle of programmers you maintain. The circle of programmers you maintain will affect the opportunities you are able to attract. If I may brag a little, rumour around town has it that am kinda a good coder. If you want to work on a project with me….I’d really love java or C# or C++. Its stupid….but you know…hackers value bragging rights.


Opportunity

Even though the job you will be doing most times will be restricted to PHP, many job offers will list perceived hardcore languages like C++, C, C#, Java as vital to the job just to scare off coders they perceive as unserious.

As tempting as it is to keep using PHP for all projects, Nigerian coders should work hard to stretch their horizon beyond it because when the game gets big...the language gets weak.

Source: http://larisoftng..com.ng/2016/07/why-you-should-not-have-php-as-your.html

4 Likes 1 Share

Re: Why PHP Should Not Be Your Primary Language by NigAmbassador: 1:39pm On Jul 11, 2016
Php is best used for little projects but when it comes to enterprise development, its dead meat. I am a C# coder....that's my bragging right
Re: Why PHP Should Not Be Your Primary Language by dangujba: 2:58pm On Jul 11, 2016
I can't believe what you are trying to say PHP is very important to learn at every time Because you can also use it as Backend of your Android App and e.t.c
Re: Why PHP Should Not Be Your Primary Language by FrankLampard: 6:59pm On Jul 11, 2016
Let me spread mat and watch how this argument will unfold.

But PHP 7 has addressed all this issue. PHP 7 is even more faster than Python 3

Let's not talk about. HHVM

With a good PHP framework self your argument is pointless.

I know so many C# programmers, all they do is complain of bugs, but PHP programmers program on the fly.

2 Likes

Re: Why PHP Should Not Be Your Primary Language by Nobody: 7:42pm On Jul 11, 2016
Where are the PHP war boys?
Re: Why PHP Should Not Be Your Primary Language by Codenister: 8:40pm On Jul 11, 2016
Make I pitch my tent
Re: Why PHP Should Not Be Your Primary Language by seunoni34(m): 8:49pm On Jul 11, 2016
larisoft:
In Nigeria, it is taken for granted that any body who calls him/her self a programmer knows the PHP language. PHP rocks. There are thousands of already written free software implemented in the Language. There is a hug support base…probably the biggest for all web programming languages. And most importantly, PHP has a low learning curve.
However, except in the hands of those who know the language thoroughly (and because they know it thoroughly, they know when not to use it) PHP might be a bad language for any slightly huge project. Here is why.

Bad Concurrency
As a newbie, I churned out more programs in a week than I knew what to do with. Every program seemed so easy and I kept wondering why I would ever need to use Java or C# to write a web app. I then got a contract to implement an app which facilitates file sharing. This was no big deal. In a matter of days, the app was ready (with a lot of bad, undocumented code of course).
There was a problem though. Once up to 100 persons tried sharing files of (5mb+) at about the same time, a lot of errors sprung up ranging from gateway time out to connection to server lost. Once this happened, the user had to start over.

I realized what I needed was called “multi-threading”. This would have allowed the files to be queued for upload, eaten away in bits and pushed to another queue of files ready to be sent to clients that request for them. All this would be so efficiently controlled that a thousand people can exchange files, and the user can see a message like “too many people are uploading, your file is uploading but going much slower”. Or it could just show a progress bar (like google drive). I will also be able to limit the number of active threads, keeping some activities in pause till more threads are freed. The load on the server would have been so controlled,

PHP is just bad for this. There are libraries of course that simulate this by instantiating another PHP Instance. But you’d be simulating and you’d eventually move over to langauges that offer multithreading features natively.


Speed
There are lots of goody goody resources out there telling us that PHP’s speed is just as good as any other language. I wont argue. I will just show you facts and let you decipher the truth for yourself.
PHP is an interpreted language. Every time a page is requested in PHP, it is compiled and then the compiled code is executed. This means that your code is read from disk first, compiled, and then the compiled code is executed. Compare this to a compiled language like C# where the process for responding to a request is just ….execute!


Respect

Respect is everything in the lives of hackers. Introducing yourself as a coder whose primary language is PHP makes you look weak. This will affect the circle of programmers you maintain. The circle of programmers you maintain will affect the opportunities you are able to attract. If I may brag a little, rumour around town has it that am kinda a good coder. If you want to work on a project with me….I’d really love java or C# or C++. Its stupid….but you know…hackers value bragging rights.


Opportunity

Even though the job you will be doing most times will be restricted to PHP, many job offers will list perceived hardcore languages like C++, C, C#, Java as vital to the job just to scare off coders they perceive as unserious.

As tempting as it is to keep using PHP for all projects, Nigerian coders should work hard to stretch their horizon beyond it because when the game gets big...the language gets weak.

Source: http://larisoftng..com.ng/2016/07/why-you-should-not-have-php-as-your.html

But Facebook & wordpress still run on php. How they manage to scale their apps despite the limitations?

1 Like

Re: Why PHP Should Not Be Your Primary Language by Objectoriented: 8:49pm On Jul 11, 2016
Sipping tea................ :-) Sipping tea................ :-) Sipping tea................ :-)
Re: Why PHP Should Not Be Your Primary Language by NigAmbassador: 9:41pm On Jul 11, 2016
seunoni34:

But Facebook & wordpress still run on php. How they manage to scale their apps despite the limitations?

https://www.quora.com/What-programming-languages-are-used-at-Facebook
Re: Why PHP Should Not Be Your Primary Language by maekhel(m): 11:35pm On Jul 11, 2016
OP your points are soooo 2010




As mentioned above PHP 7 renders all your points non and void

3 Likes

Re: Why PHP Should Not Be Your Primary Language by losprince(m): 11:41pm On Jul 11, 2016
My bragging right is php7
Re: Why PHP Should Not Be Your Primary Language by Nobody: 12:27am On Jul 12, 2016
I know a war will happen on this thread
Re: Why PHP Should Not Be Your Primary Language by Nobody: 2:08am On Jul 12, 2016
The problem with PHP is its bad reputation, which will hurt your career in next 5 to 6 years if you keep writing it, your career is at stake.

PHP 7 will be meaningless
Because companies are now moving from MySql to NoSql Database, and moving from Crud to Event driven web apps and by the time they put adverts for job opportunities, you will not see PHP amongst the list of Stack.

Facebook now uses HHVM which is a runtime for their own language called Hack. So they don't rely on PHP that much.

So its either we all start learning new set of languages or start planning to become carpenters and bricklayers in next few years. Lobatan !

2 Likes

Re: Why PHP Should Not Be Your Primary Language by Nobody: 2:11am On Jul 12, 2016
maekhel:
OP your points are soooo 2010




As mentioned above PHP 7 renders all your points non and void

Sorry sir, PHP 7 is of no use.
Re: Why PHP Should Not Be Your Primary Language by Nobody: 3:42am On Jul 12, 2016
Whether you use PHP 15, Python 9, C-- or Guava Java, just make sure you build something meaningful to the society, make a name and make money. Facebook started with ONLY PHP back then because PHP is FREE and gets you up and running in no time (Zuckerberg was smart enough to make use of the opportunity at that time but as Larisoft said "because they know it thoroughly, they know when not to use it" ), I don't know of a single Web Host without a version of PHP all you need to do is upload your files and go live but other languages require more time on server configs and work-arounds compared to PHP.

Of course to say PHP is the best language is lame, We've got Ruby, GoLang, Haskell and other promising languages that are leightweight but my point is Build IT first and leave the rest complain later.

4 Likes

Re: Why PHP Should Not Be Your Primary Language by larisoft: 5:35am On Jul 12, 2016
FrankLampard:
Let me spread mat and watch how this argument will unfold.

But PHP 7 has addressed all this issue. PHP 7 is even more faster than Python 3

Let's not talk about. HHVM

With a good PHP framework self your argument is pointless.

I know so many C# programmers, all they do is complain of bugs, but PHP programmers program on the fly.

Frank, thanks for calling my attention to PHP 7. Python 3 is another interpreted language. There are just places these technologies are best used. A small forumn? Yes. An online video school? Probably not except you want to be implementing patches for the rest of that application's lifetime.


By the By; its good to see all the coders arguing away...just like the good ol' times.

2 Likes

Re: Why PHP Should Not Be Your Primary Language by FrankLampard: 6:23am On Jul 12, 2016
truthsayer007:
The problem with PHP is its bad reputation, which will hurt your career in next 5 to 6 years if you keep writing it, your career is at stake.

PHP 7 will be meaningless
Because companies are now moving from MySql to NoSql Database, and moving from Crud to Event driven web apps and by the time they put adverts for job opportunities, you will not see PHP amongst the list of Stack.

Facebook now uses HHVM which is a runtime for their own language called Hack. So they don't rely on PHP that much.

So its either we all start learning new set of languages or start planning to become carpenters and bricklayers in next few years. Lobatan !


HHVM was built for a normal php code. A friend of mine has used it to host his site, which has up to 10,000 users daily. Performance in HHVM is twice as fast as JVM. The only disadvantage of HHVM is that it lags when you install it in a server less than <= 2GB of RAM.
Re: Why PHP Should Not Be Your Primary Language by Scholar01: 7:27am On Jul 12, 2016
Wondering why bros guru01 never show up
Re: Why PHP Should Not Be Your Primary Language by danidee10(m): 7:55am On Jul 12, 2016
Most of those benchmarks are bias....if you throw in some numpy or cython and 'cheat' grin. Python will smoke php in speed

Not hating on php though....but as a language python has a wider domain.

Php machine learning.....Nope smiley
Re: Why PHP Should Not Be Your Primary Language by bot101(m): 8:14am On Jul 12, 2016
I have seen some top websites running PHP and still doing so. Going by your assertion, they should all have been dead and off the net by now. Please let's not hang a language because of a bad coder's crimes. Given the worst language, a good programmer will make a great, efficient application but give a bad programmer the best language (there is none), and he'll develop a program that'll make you want to murder him. This is the same bull poo they said about Cordova, nowadays I take such opinions with a pinch of salt.

1 Like 1 Share

Re: Why PHP Should Not Be Your Primary Language by NigAmbassador: 9:22am On Jul 12, 2016
These Php coders.... Try to expand your horizons or be ready to return to the cold age... #.net_tech
Re: Why PHP Should Not Be Your Primary Language by Codenister: 10:52am On Jul 12, 2016
Scholar01:
Wondering why bros guru01 never show up
He's busy saching for dhtml18's goat
Re: Why PHP Should Not Be Your Primary Language by guru01(m): 11:09am On Jul 12, 2016
@op you didn't give us an alternative to use as primary language.

All I see here is comparing php and c#

As you mentioned in your post, you are still a newbie with php programming, so you have little experience using php. I guess the version you last used was <=5.2.

Everyone knows php has come to stay as long as the parent language is not dead yet, and php is even more relevant in 2016.

Talking about nosql, php support is far more than other languages.

Php will get more popular when its been criticised.

Finally, php is the web.
Re: Why PHP Should Not Be Your Primary Language by Nobody: 11:31am On Jul 12, 2016
Let me now abuse all of you guys - you dudes are concerned about language eh?
I guess you should be concerned more about creativity. Whatever language you use - do something productive with it.

Although, I use quite a good number of languages especially JAVA and MEAN-STACK, PHP is still the fastest one for me to use in a tight situation.

I see all programming languages as tools for developers to use. My PHPbrowserbox - http://phpbrowserbox.Nairaland.com/ - for example was built with NODE.JS.

1 Like

Re: Why PHP Should Not Be Your Primary Language by FincoApps(m): 2:43pm On Jul 12, 2016
dhtml18:
Let me now abuse all of you guys - you dudes are concerned about language eh?
I guess you should be concerned more about creativity. Whatever language you use - do something productive with it.

Although, I use quite a good number of languages especially JAVA and MEAN-STACK, PHP is still the fastest one for me to use in a tight situation.

I see all programming languages as tools for developers to use. My PHPbrowserbox - http://phpbrowserbox.Nairaland.com/ - for example was built with NODE.JS.

Exactly.... these comments on PHP are beginning to annoy me.

I noticed something about Nigerians, when something gets too popular, they start to find errors and ways to criticize it
Eg

BlackBerry
WordPress
PHP
MySQL.... even Facebook and WhatsApp....

If any of these products are as smart as Facebook, they would still stay alive for a pretty long time
Re: Why PHP Should Not Be Your Primary Language by Nobody: 3:00pm On Jul 12, 2016
I have been trying to hold my peace, but the truth is that I feel like flogging many people on this thread - and I shall if seun gives me an e-cane.

For what now??

Are you guys are that youtube is one of the successful websites built by PHP

You guys should look at this link - https://www.quora.com/What-are-the-top-10-websites-built-with-PHP

Now, the question I will ask you dudes including the OP. Have you built something as awesome as the above with PHP? In short, have you used to PHP to the limits before you start criticizing it?

I am not here to criticize PHP, I am just saying that Nigerian developers are usually lazy, with zero startups or even works to show for their skills.
Instead of spending time criticizing PHP, .NET, Python and the others. You guys should spend your time creating awesome stuffs for us to review.

PHP is not my primary language anymore, that will be JAVA. But again, you will see people shouting that JAVA will die and all that. I have an app in playstore at the moment built with android/JAVA and it is being used worldwide with almost 100,000 users at the moment.
And you know what, the backend of the app is built with PHP/MySQL - yes, i said it. And it has not died till now. And it serves concurrent users without any hassles. And no, it is for a client, and i am under NDA agreement, so i am not going to disclose it - although some nairalanders close to me already know the APP i am talking about.

Yeah, I know that I am very likely to migrate everything to a NODE cloud very soon. But wait, before you start criticizing PHP, how many of you guys have actually created a PHP APP/API serving like a 100,000 concurrent customers?

To do that, you will have to go beyond your conventional PHP programming, and learn so many gaddamn techniques that your code will no longer even look like PHP again.

I am not trying to make anyone feel bad, but you guys should get to work!!!!!!!

8 Likes 1 Share

Re: Why PHP Should Not Be Your Primary Language by Craigston: 6:16pm On Jul 12, 2016
It's nice to see some language wars again. Keep it up.
BTW it seems everyone loves PHP because they always find a reason to talk about it.
There are more languages that we can learn. And the author is right on some things: PHP shouldn't be the only thing in your arsenal if you're thinking of getting hired. And you cannot do everything with it.
But PHP is open to contributions so if you feel something is missing, give back to the community by creating it yourself. Good job if you can bring the PHP ease of use to desktop application development and or system administration.
*Just posting too. It's not nice to stay quiet even though you're a noob*
Re: Why PHP Should Not Be Your Primary Language by abubaka101: 6:20pm On Jul 12, 2016
You guys should not compare programming languages. It's immature.
Programming languages all come in different forms and variants. You should use what you know best and what seems most efficient for a task (if you know other languages) and stop this yeye comparison.
You guys are providing information of top websites built with PHP. That's childish please stop.
Discuss creative web and programming ideas before looking at the capabilities of your language of choice.
My thoughts though.
Re: Why PHP Should Not Be Your Primary Language by Nobody: 6:48pm On Jul 12, 2016
It does not matter whether the points of the OP are correct or not, this is so wrong. I mean, this thread is about discouraging PHP users - and just that.
I work with over 10 programming languages, and my best language is not even PHP (contrary to what many of you may think - I am a javaScript expert primarily, followed by JAVA, .NET and others like PHP).

We should be comparing projects, teaching each other how to script and all that. Sharing our experience in programming and all that.

Not criticizing one another.

When people compare programming languages, they put facts together - pros and cons making a person select something based on their options.
Re: Why PHP Should Not Be Your Primary Language by onedayatime(m): 8:53pm On Jul 12, 2016
well, I can see that the OP is not proficient enough about PHP. So that is your opinion. I would have agree with you if you say 'PHP is not general purpose language and it is meant for wen alone', but, PHP can run from command line as well(as I would argue also). No language is bad, all languages are good. What we need are experience and all languages have their weaknesses and strenght. And all have where they are regarded as a major factor.
Re: Why PHP Should Not Be Your Primary Language by Nobody: 9:11pm On Jul 12, 2016
onedayatime:
well, I can see that the OP is not proficient enough about PHP. So that is your opinion. I would have agree with you if you say 'PHP is not general purpose language and it is meant for wen alone', but, PHP can run from command line as well(as I would argue also). No language is bad, all languages are good. What we need are experience and all languages have their weaknesses and strenght. And all have where they are regarded as a major factor.
The same thing that NODE.JS does for concurrency, sockets and all that - PHP can do it too.

I have a phpscript with just few lines of code - with only one single mysql connection - it can accept 1 million and more simulatenous connections and process every gaddamn thing as fast as the server can process.
And no, it does not require a dedicated server to run or even a VPS, it can run on any PHP server (but VPS and dedicated will make it run faster), and no it does not require websockets to work or any special PHP extension to work.
What happens if the script dies - a cron job can restart it
Does the script terminate - no it does not - it runs as a DAEMON (same way NODE.JS works)

This is just basic CLI programming in PHP - if you dont know how to do it, research, learn and develop - i did not get there in one day.

By the way, all the problems the OP encountered in PHP, I do not see them as a problem. That having been said - it is not every project that is best done with PHP.
There are some projects that if you wish to do it - the best language will be PYTHON. Some NODE.JS is best. Some JAVA, some .NET
Based on my experience, I can cite many instances where I have had to learn a particular language just because of a particular project.

All I am trying to say is that - there is no best language - I dont encourage anyone to base all their programming career on PHP.

For those talking about hackers - as a professional hacker, you need to master at least 5 strong programming languages - Being a JAVA expert alone is not sufficient.

1 Like

Re: Why PHP Should Not Be Your Primary Language by talk2hb1(m): 9:27pm On Jul 12, 2016
lipsrsealed

(1) (2) (3) (Reply)

The Best Programming Language Is... / C++ Vs Java (hilarious Gif) / Must Everybody Go Into Tech Or Learn Coding?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 73
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.