I have been learning C++ for 2 years now, i want to learn web programming..
which language should i start with?
i know very basics of PHP, do you think i should learn JAVA?
please i have very little knowledge about web programming and i would like to increase it
Regards
@rapidcoder - Why would you only recommend php for tiny websites?
If performance is an issue, facebook has published the HipHop project which compiles php into C++ code for faster runtimes. The now native APC in php also makes quite a difference.
Not running PHP as an apache module also makes quite a difference in the server load.
Just curious if there is anything else you're basing that statement on which I'm not aware of.
PHP has excellent cheap hosting support. If you need to create a simple website with a few dynamic elements, PHP is also the easiest one to start with, and perfectly sufficient. Using a full MVC framework for such a thing is an overkill - it would take more time to setup than real coding.
I'm afraid I don't quite follow you - sorry.
Do you mean to say that PHP is not efficient for large projects because you would feel obliged to use an existing MVC framework?
So what would be the advantage of other languages, you could just opt to not use the MVC framework and write your own stuff in PHP, could you not?
Again, I'm not criticising you - just trying to understand.
PHP is not efficient for large projects because it was never designed to be used in such projects. Even the acronym originally was "Personal Homepage Preprocessor". It is slow [1], has poor memory management, crappy database drivers, no consistent naming / API design conventions - it feels like built by 13-year old kids.
But it really rocks at small things - it is installed on almost every webserver out there, hosting is cheap, it is very easy to learn, it has an extremely simple and clean execution model [2], and it is very easy to add some dynamic content in PHP to a static website. Don't try to shoot mosquito with a bazooka.
[1] automatic translation of PHP to C++, according to Facebook gives only 2x-3x speedup, so it is still 50x slower than Java written by an average corporate programmer. Actually Facebook realized that PHP doesn't scale, but it was too late.
A few years ago I applied for a job as a web dev for my university. They strongly recommended proficiency in Javascript, asp.net, PHP, SQL, HTML and XML. Mind you their code base was one gigantic kludge with some some server side perl scripts acting as glue. But, that skill set can't hurt in any web-dev job and some combination thereof will likely be expected of you if you're doing client side coding. I'd recommend getting a footing in SQL, PHP, XML and HTML. It's what I'm doing now, so that I can reapply for that job. Because I didn't have those skills before.
and on a side note, I'm hoping they offer a full time web-dev position, full time employees get 12 free credit hours.
@rapidcoder,
Technically a bazooka would be more effective against a mosquito than a smaller weapon because bazookas have an area of effect; with a smaller weapon you'd have to actually hit it which would be really, really hard.
automatic translation of PHP to C++, according to Facebook gives only 2x-3x speedup, so it is still 50x slower than Java written by an average corporate programmer
Could you refer me to some benchmark data? I'm having a difficult time believing that PHP is between 100 and 150 times slower than Java. I ask because most of the time I've found that benchmarks are unfairly biased in Java's favor by its brainwashed over-zealous disciples.
It seems they made the interpreter better now, because median is "only" 23x slower. But this is for computational heavy tasks, and it is not relevant to what websites do. Add to that poor memory management[1], lack of good database connection pooling [2], lack of in-memory object caching, lack of threading support, lack of non blocking IO / mmap support and you are good 200x slower for any serious work.
[1] This is by design in PHP: every request = separate execution of the script. Separate execution means loading all the libraries in memory, so if you use a complex MVC framework, you can waste several milliseconds just for loading stuff instead for real work. This also means, that the same MVC framework stuff is loaded several times if you have concurrent connections. Each connection can easily take a few MBs. On the other in Java most of the things are shared in memory, and while a framework can easily take a few hundred MBs or RAM, this RAM is reused by all connections. I've seen Java serve 500,000 concurrent connections with ease from a middle sized server, I seriously doubt even 10,000 concurrent connections is possible with PHP.