6 ms·
C++ isn't suitable for Web programming.
by ExpiredLink 13y ago
C++ isn't suitable for Web programming.
- kryten 13y agoHalf of eBay used to be a massive ISAPI dll plugged into the back of IIS. It did a fine job at the time!
- Impossible 13y agoOKCupid is written in C++ as well. (http://www.okcupid.com/about/technology http://www.okcupid.com/about/technology)
- tomjen3 13y agoThat seems really strange. I mean I get why their database is written in that, but I would imagine that their matching algorithms, at least, were written in something more easily adapted to change. It is one of the cases where I would want to write it in Lisp.
- CCs 13y agoGoogle is C++ (the part which actually brings in revenue)
- PommeDeTerre 13y agoYou do realize that the most widely used Ruby, PHP, Python, Perl, JavaScript and Java implementations all rely very heavily on C and/or C++ in one way or another, right? Even when using JRuby, for example, it's still running on a JVM that's very likely implemented using one or both of C and C++. Don't forget that the major web servers and web browsers are all implemented in C and/or C++, or in one of the many scripting language or other runtime implementations implemented using C and/or C++. And that's ignoring all of the other infrastructure, like server operating systems, router software, and so forth that's implemented using C, or C++, or both. Every line of code executing in your non-C or non-C++ web development language of choice likely depends on many thousands of lines of C and C++ code, even as you malign them here.
- betterunix 13y agohttp://pypy.org/ http://pypy.org/
- PommeDeTerre 13y agoPyPy may someday be a viable replacement for CPython, but that day is not today. The viability becomes much more questionable as more and more of the Python community moves to Python 3, which PyPy basically does not support.
- betterunix 13y agoThat's not the point. The point is that the argument that modern languages are written in or depend on C/C++ is fallacious: there is no need for C or C++ there, nor is there any technical advantage to their use. CMUCL and SBCL are almost entirely self-hosted, and things like PyPy and JikesRVM stand as strong examples in other languages.
- PommeDeTerre 13y agoNobody here has said that C or C++ are absolutely needed. I merely pointed out the reality of the current situation, which is that both C and C++ make up a big part of basically any web app around today, even those written in some other popular languages. Also note that I referred to "the most widely used" implementations of those languages. Yes, we know that PyPy exists, but CPython is still used far, far more often. Yes, we know about Common Lisp implementations like those you listed, but the reality is that they basically aren't used in practice. PyPy, CMUCL and SBCL are essentially irrelevant when considering the big picture. C and C++ are involved in one way or another in pretty much every other case. If you refer to the original post in this thread, you will see that it was about the supposed unsuitability of C++ for web development. When we look at the entire picture, however, we do see that such sentiment is quite wrong. C and C++ play an absolutely huge role in modern web development and web applications, regardless of what some people may think.
- nicholassmith 13y agoFacebook was running a C++ based PHP interpreter, I'd say that's Web programming in an extreme capacity.
- cgag 13y agoThat sounds like saying assembly is well suited to web programming because Ruby compile down to it eventually.
- CCs 13y agoNot exactly. Now about half of the Facebook developers use C++ (the other half PHP)
- betterunix 13y agoIs that the rest of some technical feature or set of features, or just that most college graduates can be expected to have some minimal competency with C++ coupled with the fact that the PHP interpreter was written in C? I am inclined to think this is more a pragmatic decision than a technically motivated one.
- CCs 13y agoIt was technically motivated: https://developers.facebook.com/blog/post/2010/02/02/hiphop-for-php--move-fast/ https://developers.facebook.com/blog/post/2010/02/02/hiphop-... https://github.com/facebook/hiphop-php/wiki https://github.com/facebook/hiphop-php/wiki https://www.facebook.com/notes/facebook-engineering/folly-the-facebook-open-source-library/10150864656793920 https://www.facebook.com/notes/facebook-engineering/folly-th... Edit: From the 1st link "[...] I started my first piece of code transforming PHP into C++. The languages are fairly similar syntactically and C++ drastically outperforms PHP when it comes to both CPU and memory usage."
- betterunix 13y agoIt sounds to me like they wrote a PHP compiler that leverages GCC's optimizer. I am not seeing the technical motivation to use C++ for that; it would have been just as good to just produce GIMPLE. It looks like C++ was just chosen because it is what the developers knew, which is not all that far off from what I said. (Edit: it is also worth pointing out that the motivation for this tool is to avoid having to write C++ code)
- pothibo 13y agoI'll reply at all the above here. When you have load/concurrency that needs you to move to C++ there's no doubt C++ is right. When you reach that level though, you will usually have the resource to build infrastructure specifically designed to your need, dismissing any "general" purpose C++ framework. All the example mentioned here are using in-house products for the most part.
- betterunix 13y agoI am not sure it is ever true that there are no doubts about C++ being "right." It might be "good enough," but it is a generally bad language that would not be my first choice for anything (I would sooner use C, but even that's not my top choice).
- pothibo 13y agoWell, I might have over-emphasize on what is "right". Blame this on the language barrier :)
- alexchamberlain 13y agoAnd I would sooner use modern C++, it is personal preference and experience.
- betterunix 13y agoIt's not about experience, it is about the language. Modern C++ is basically a motorized stone hand-ax. Even experienced C++ programmers are surprised by undefined behavior and unexpected semantics.
- pbsd 13y agoA significant amount of undefined (and unexpected) behavior in C++ is inherited from C, for compatibility. You'd sooner use C, and fall into undefined behavior quickly as well. C++ is large and hard to master, but I don't think UB is the best reason to choose C over it.
- allan_s 13y ago(shameless plug: my projects based on cppcms) https://github.com/allan-simon/tatowiki/ https://github.com/allan-simon/tatowiki/ I've made a complete wiki engine (with also search engine integrated), which is easily skinable etc. (it's still at an early stage) , you can find an instance here http://en.baike.jisuanjiwenti.com/ http://en.baike.jisuanjiwenti.com/ You can check the line of code and the architecture of it, to have also developed with some PHP framework, I didn't find anything "weird" or to far from my old habit (and I do prefer compile-time check and possibility to run my server in gdb) In order to help me create faster application with cppcms, I've started to create a framework upon cppcms here https://github.com/allan-simon/cppcms-skeleton https://github.com/allan-simon/cppcms-skeleton