7 ms·
It is great as a hobby project to try and right a C++ web framework but the reality is that in 2013 it would be laughable at best and outright fireable at worst
by blinkingled 13y ago
It is great as a hobby project to try and right a C++ web framework but the reality is that in 2013 it would be laughable at best and outright fireable at worst to write web apps in C++. You might have legacy reasons or have some portions of the code that are very performance sensitive and you can augment your non-C++ app with C++ code for those reasons - that would be understandable. But a full fledged C++ web app - tsk tsk. Let's see -
1) Programmer availability and economics. Ton of RoR/PHP/Java and hopefully soon Go programmers, but good C++ programmers - good luck finding and retaining one.
2) Security - However competent YOU are - it just isn't possible to write a complex web facing system that is also secure. I was part of a failed project to write an IdM system in C++. It was a huge pain when we hired a external org to do Penetration Testing. After they were done we were left with lot of damage. Part of this is language, part is a lack of lot of great framework/best practices/expertise.
3) You reinvent the wheel a lot. Want to talk to LDAP - write your own load balancing and failover aware C++ classes or maintain somebody's unsupported OSS one. Equally headachy. Or pay for RogueWave - a ton of money per platform plus annual support contracts.
4) Cross Platform Pain - Enough said. Take the myriad of compilers, linkers, versioned libraries and try to ship a product that supports plugin based extendibility. Tough job convincing the customers to use the same compiler/linker/libraries to build their plugins.
5) Performance monitoring, debugging and profiling tools. See how well those compare against Java's JMX, HPROF, Heap dumps with OQL, MAT, YourKit etc. Just no match unless you are extremely competent and can manage debugging complex production systems without these tools.
6) Lack of something like a widely used Application Server ala Weblogic, JBoss. The value these provide in terms of ready clustering, db access, thread pooling - that's just not easily doable in C++. Add the lack of various 3rd party frameworks (ORM, Rules engines etc.) and you are ready to give up on C++.
Now I am sure somebody will go clever and come up with solutions for each of the above but the point is when you pull all of them together - it's not hard to realize it won't be worth it.
- vanderZwan 13y agoDid you actualy even look at the framework, or just immediately drew conclusions and wrote this as soon as you saw the combination "C++" and "Web Toolkit"?
- blinkingled 13y agoI actually downloaded, installed and ran an example app - but from the other C++ Web toolkit that was on front page - CppCms. I was meaning to add this comment to that post but in between multiple open tabs, I ended up adding it on this one instead! But which one of my points are not applicable to this particular toolkit? Sure it seems to provide XSS protection and such but the fundamental issues with secure coding in C++ still remain. So do the points about cross platform pain, compiler/library versioning issues, reinventing the wheel, availability of debugging/performance monitoring/profiling tools.
- vanderZwan 13y agoOh, I wasn't trying to refute your points - it's outside of my area of expertise and they may very well be correct - but your style of writing gave a strong impression you were criticising the framework without even taking a closer look at it, which I wouldn't consider a proper way to criticise something or start a discussion.
- vmarsy 13y agoDid you try the example app on Firefox ? I tried some of the examples, on Chrome, Opera and Firefox, on http://127.0.0.1:8080/ http://127.0.0.1:8080/ , the 2 first browsers works fine but on Firefox all I see is a blank page.
- mh- 13y agodid you have anything to offer to refute his assertions? I don't have anything material; he's spot on.
- bandushrew 13y agoit turns out that there are some perfectly reasonable use cases for a c++ web framework. The fact you didn't take the time to find out what they might be, before expressing an opinion about the framework, is unfortunate.
- blinkingled 13y agoCome on, if we are having this conversation and you've already taken the pains to add a contrary comment - I was fully expecting you will elaborate on those use cases :) Are you thinking embedded web servers may be? What else?
- bandushrew 13y agoI was hoping to leave discovery as an exercise for the reader :) but yup, low memory/cpu/ram situations are one clear place where a c++ web app makes a heap of sense. Also things like routers, where there is an environment that doesn't change frequently (..or often at all for years..). There is also a bunch of use cases where the fact that installing/replacing/updating the web app is as simple as replacing a single binary is a real win. There just are a bunch of places where it makes perfect sense to use a c++ web app, and none at all to use frameworks like RoR. Its not a big deal, there are entire worlds of requirements and use cases that look and sound nothing like 'public facing web application', where the ability to provide an HTML interface is a win, and the ability to lower resource requirements from something like RoR is a win. The only reason I posted is that it just makes me sad when people are so utterly oblivious to the worlds that they dont know, and - because of that - are tracked into making definitive statements about things, when they should probably preface their comments with "to my knowledge..." or "Im not aware of" or even preface it with a genuine question "why is something like this useful?, I dont understand.." There is nothing wrong with admitting you do not understand something and asking for clarification :)
- blinkingled 13y ago>There is nothing wrong with admitting you do not understand something and asking for clarification To be frank, that's not something I don't understand. It's just a resource constrained environment use case that anyone can understand. What I don't understand is how common those use cases are today given my home router runs with 32Mb RAM and can use PHP instead of C++, never mind the fact that it doesn't need a full fledged C++ Web Framework to begin with!
- CCs 13y agoHere we go again: https://news.ycombinator.com/item?id=5996425 https://news.ycombinator.com/item?id=5996425 C++ is a tool just like any other language. It is not the answer for every question, but it is pretty good. Some companies use it heavily and they are pretty successful: Google, Microsoft, Oracle, Facebook, OKCupid etc. So C++ is useful, even for Web. BTW, it is used to implement PHP, Java Virtual Machine, Ruby, Windows and so on - that went reasonably well too.
- wdu 13y agoSo if that's how you feel, you use JWt ( http://www.webtoolkit.eu/jwt/ http://www.webtoolkit.eu/jwt/ ) instead of Wt. Same thing, different language. JWt is a native port of Wt to Java, not a set of jni bindings.
- raphinou 13y agoI know of someone who switched to cpp with wt because the java code he first developped to generate a pdf out of a big database ran out of memory after minutes of work. The cpp code generates the pdf in a second. Not everyone‘s situation, but this is an example, on a server, where efficient resource utilisation is important. Also, did you see wt is widget oriented and has a java version, which you can use with jruby if you want?
- RyanZAG 13y agoJust sounds like a mis-use of Java. Java is slower than C++, but it's a fairly small difference, ie. between 1x and 3x the speed. So if the cpp code did the work in a second, the Java version should have taken at most 3 seconds. The real reason for the difference is that the rewrite into C++ used all of the domain knowledge he had acquired in writing the Java version. If he has made a Ruby version next, it would likely have been similarly efficient (maybe 5 secs? Who knows). It's a key problem in these kind of anecdotes: a rewrite will nearly always be more efficient as it has more knowledge to work with during the architecture phase of the project.
- raphinou 13y agoFrom what i know the code was quite simple and even trivial, using existing java libraries as much as possible. The fact is that using corresponding cpp libraries let him get what he needed with much less fuss. I do not know why the java version was so inefficient and used all memory,it might be due to one ofnthe librariez, but this is illustrating an example where cpp was relevant , which was the point of my comment.
- RyanZAG 13y agoAnd if he now rewrote the code in Scala using even better domain knowledge and it ran in 0.1 seconds, would this be proof to you that C++ isn't relevant after all? The point of my comment is that your basis is flawed. The apples to chimpanzees reasoning you are using is not valid.
- papaf 13y agoI am a C++ programmer that agrees with most of what you say except: 5) Performance monitoring, debugging and profiling tools. See how well those compare against Java's JMX, HPROF, Heap dumps with OQL, MAT, YourKit etc. Just no match unless you are extremely competent and can manage debugging complex production systems without these tools. I find the C++ tools much better than the Java ones. I was recently tracking down memory use with a C++ client and a Java server (with help from a Java programmer). I found VisualVM kind of pretty but mostly useless for finding the source of memory use but with C++/valgrind/massif I got the guilty data structure and the calling function on the client side in a few minutes.
- ExpiredLink 13y agoYou are obviously an expert. Java EE programmers need more expertise from people like you.
- Skinney 13y agoHaven't used valgrind, but wouldn't you say this is mostly related to Java/JVM-languages being garbage collected? Since analyzing heavy memory use requires you to look at a lot of garbage as well. Forcing a gc does help, but not enough in my oppinion
- blinkingled 13y agoI bet you can't use Valgrind on Production C++ Server though. You are also limited to the platforms Valgrind runs on. There have been plenty of times I used Xeprof (HPUX) on Java server to profile CPU usage, GC logging parsed by JMeter, on demand heap dumps (MAT) - all in Production to successfully resolve issues. (Browsing the heap dump will tell you exactly where your memory is - duplicated String Buffers, leaked objects etc.) The point is JVM tooling has matured enough that you have plenty of choices - you'll find something that works well even for production uses.
- rayiner 13y agoI think it looks really neat. It abstracts away all that DOM/JS/HTML crap so you can write a web app like a program instead of the weird hybrid "document with programatic elements" model that seems to have evolved on the web as an accident of history. The use of C++ is a little questionable, but the nice thing about C++ is that you can create bindings to other languages reasonably easily. I would have preferred to see it in pure C to make it easier to write bindings for, but I can see why they chose C++.
- dinkumthinkum 13y agoSo, you're number one is about the availability of mediocre programmers, is that you're argument, just so I understand it properly? I think that's the direct implication here, that you have an enormous pool of less technical people to perform some sort of Mythical Man-Month body shopping program with ... That's fine but that's not an argument against doing web programming with C++. That's sort of a whiny "I can't find monkeys to code at $9/hr on C++ so I'm not using it," which is not very interesting. Some people prefer competent programmers, whether the development is done in PHP, RoR, or whatever; I know I would find it pretty boring to work with people scared of C++. As well, most of the other arguments are a bit hard to take seriously .. In #1 you talk about RoR and PHP but now in #6 you want me to pay Oracle or RedHat for these EE application containers and imply that without such containers we have big problems ... I mean, which one is it? As for connecting to LDAP and all these myriad of other things which you seem to being mistakenly thinking are unconnectable from C++, leave alone the fact that most of these services you aspire to integrate with were, themselves written in C or C++, do you really think that you connect to these things with PHP and not C++? I find that to be pretty interesting ... maybe even worthy of a "citation needed]." For #4, so is everyone on here that does Web development, shipping products in binary form? Really, is the Web portal that you work on for ConAgra foods or whatever a product you shipping and selling? So, what you're saying is JBoss and all these others you want perform swimmingly well in a "cross platform" environment ... really, is that really you're argument? I think that's a fantasy. I think you're lobbing a lot of inconsistent criticisms all over the place against native programming. By the way, people build, deploy, and manage complex native applications all over the world without Java or the JVM. It's a real thing, I promise. Not everyone is making employee portals for the DMV or whatever projects your talking about ...