## Abstract

C++ has always been considered a language for mission-critical server-side functionality. Web development, although in part server-side based, is done using different software development languages. I try to analyse what caused this situation. Possibility to provide a portable pure C++ web development framework is explored.

## Target audience

This article is for people, who believe that C++ can be successfully used to build sophisticated web applications and are frustrated by the lack of basic tools to do so. It doesn't provide any kind of definite plan on how to create a C++ web development framework, but rather tries to share some thoughts, give an inspiration and some guidelines.

To make things clear, this article definitely does not claim, that C++ is better than other software development languages, or that it should be used for every project, or that it doesn't have problems of its own. It rather tries to describe a niche set of requirements and applications, where using a C++ web development framework would make more sense, despite all the issues involved.

## Current status

### Available solutions

Today there are 3-4 most popular platforms to do server-side web development. These include:

Java and Java-based technologies, such as Servlets/JSP, Java Face, Struts and so on. The multitude of Java-based frameworks is a little bit dizzying

ASP (legacy) and ASP.NET, together with all Microsoft-related technologies (ADO.NET and other .NET libraries, legacy COM+ etc.)

PHP (for smaller sites)

Perl (CGI – legacy, mod_perl)

I don't want to describe in detail all these and other frameworks, available on the market. Just to mention, the last two entries are actually scripting languages and their performance is even worse than that of bytecode-compiled ones, like Java. In terms of functionality, all of them provide enough tools to create flexible and powerful web applications. They can and have been used to solve real life problems. However, in my opinion, for some extremely demanding sites they are simply aren't good enough.

There are a few frameworks, using C++, most notably Microsoft's ATL sever . They are either Windows-only or quite limited in their functionality or both. Their specifications have not been updated for years and most of them do not enjoy any vendor or community support.

### Why C++ is not used?

One of the main reasons C++ is not actively used to do web development is the lack of standard tools and libraries. There is simply no feature rich library, which includes all the necessary boiler-plate code needed to write web applications.

The numbers of new C++ programmers, trained in universities and by the industry are falling, and some existing developers are converting to other more popular technologies.

## Why a new framework?

C++ is an extremely advanced and flexible language. Its performance is still unmatched by other languages, popular today – likes of Java and C# (for an interesting point of view on why many benchmarks, claiming that Java is faster than C++ are not applicable to the real world look here ). Even more important, it can be tightly integrated in most widespread web servers (Apache, IIS) to run in-process, and not as an external service, thus eliminating inter-process communication.

One of the main advantages of C++ is its tight management of resources, such as memory allocation. And indeed, although doing explicit memory handling properly can be a nightmare for an unexperienced developer, by using modern programming paradigms, it can be exploited to give a powerful and safe control over resource allocation and destruction. The predictable nature of C++ memory management, as opposed to concurrently run garbage collectors, is an important feature when squeezing every single flop from your CPU.

Also, using C++'s template system and rather sophisticated techniques, based on it, such as meta-programming, can help in creating sets of highly decoupled components, which can be assembled into complicated pieces of software easily.

### Economics: isn't hardware cheaper than development time?

This is the question, usually asked by project managers and those, who pay the bill. The idea is – take whatever solution is available already on the market, and if it is a little bit too slow, throw in a bigger iron or two and your bottom line will still be better than if you wrote the staff from ground up yourself.

This is a perfectly legal argument and it is actually applicable to many real projects. Hardware, especially Intel-compatible is quite inexpensive, so throwing in an extra G of RAM or a faster hard disk is usually a matter of few hundreds of dollars.

However, when we start talking about doubling performance of a very busy web site, with a lot of heavy activity, things could look a little bit different.

For example, imagine you are running an extremely successful advertising campaign. As an outcome, your current farm of 30 2U IBM xSeries servers does not provide you the performance you want anymore, and you think that it needs at least doubling. Therefore, in the end you will have 60 servers. Let's ignore their acquisition cost for a minute (but it will be a hefty $60,000-$100,000 or more). What if you don't have enough floor space in your data center to accommodate them? Will you have to move to a new one, increasing your rent bill, incurring the cost of removals and suffering service disruption? What about extra system administrators you might need to hire in order to support them? There are other components in your system, which might require upgrade, databases for instance.

The conclusion is that doubling a large computer farm is not as simple as buying two servers instead of one. Therefore, for large and business-critical application it makes sense to consider investing into performance, even if it means using less popular technologies.

I have already stated, that not every single web application should be written in C++. My intention is to give a powerful and flexible framework to those entities, which need to run extremely busy sites and which are prepared to invest in development of such sites a little bit more, knowing that the result will be much more powerful and scalable than any other alternative.

I consider high profile web sites, such as popular portals (Yahoo!, MySpace, AOL), blogging communities (LiveJournal, Blogger), relationship building (LinkedIn, OpenBC), popular on-line shops and others, receiving millions of visits regularly and delivering dynamic content to the users.

Naturally, I don't believe that all of them will ditch their current platforms and switch to the new toy of the month. But if a successful platform existed, over the time some of them would evaluate it and use it for some projects.

The following would be key factors, which could make a C++ web development framework attractive for potential users:

Highly dynamic site – large portions of the content cannot be cached effectively and need recreating on every view

Huge number of visits

Availability of necessary resources – developers, administrators and so on

Good project management procedures in place

## How to succeed?

I don't believe in writing code without well defined and detailed plan. Not only software design and implementation are important in such a project, but also the whole management of the development process and proper PR are essential in order to achieve success.

### Learning from other projects

It is important to learn from others and analyse their mistakes and achievements. A very interesting example of a successful major project is Subversion.

For years the only realistic option, available for version control in the open source world had been CVS. Although robust and well tested, it had a long list of shortcomings, which were never addressed by newer releases. A few attempts to build an alternative failed. Nonetheless, a few developers from CollabNet made an effort and created a hugely popular Subversion system. It fixes many problems in CVS, adds new features and provides a flexible and easy to use platform for extension and embedding.

One of distinctive features of the Subversion project is their superior documentation, good development plan and reliable release schedule. Also, they deploy an interesting business model, discussed later in the text.

### Learning from other frameworks

From technology point of view we shouldn't ignore experience, gained by other frameworks. Many of them were created by listening to real world feedback from web developers, and learning which issues were raised and how they were resolved is important.

Of particular interest would be the J2EE and ASP.NET platforms since a lot of serious and complex applications are built on them and they were designed by dedicated and highly experienced teams.

### External applications and libraries

Wherever possible, existing libraries and tools should be used. Examples include:

Apache/IIS – HTTP server platform

ICU – Unicode and locale library

Apache apr library – for platform-independent functionality, when not provided by boost or others (DB and other stuff)

Boost (threads, regular expressions, general C++)

log4cplus (or log4cxx from apache) – logging

Adobe open source – extra algorithms

### Orthogonal components

The following components are essential pieces of any modern web development platform:

Integration into containing HTTP servers/application servers, such as Apache/IIS

Abstracted HTTP request/response framework – handles of different HTTP request types

Configurable session management – preferably using cookies. Session storage should be easily changeable (shared memory, file, DB etc.)

Configurable authentication (reuse server’s services)

Centralized resource configuration (database connectivity, start-up parameters, logging)

Simple template system – for clear separation between business logic and visual representation

Common DB layer (using existing libraries like arp), an ORM library, similar to Hibernate

When developing such a project, it is important to look at the whole picture. This includes the business approach, taken by the development team. There are basically two approaches, which can be considered.

### Volunteer development

Development is done on voluntary basis – the code is open source, and people who find the project interesting join and contribute. This is a powerful approach, and a lot of popular projects have been developed this way or are being developed as you read this article. The problem, of course, is in keeping enough high quality developers and other professionals interested in the framework. Many good open source projects died because of lack of interest.

Under this topic I would file any form of development, done by salaried or otherwise paid developers. The result can be closed source or open source and in later case can even enjoy contributions from voluntary developers. However, there is always a dedicated core, willing to develop and support, for money if not out of love of writing software.

Subversion project is developed using this approach and is quite successful. Other major software packages include Sendmail, Fedora Linux distribution and many others. This model is quite flexible and allows some cost saving by using voluntary contributions, high popularity and trust due to the source being open and also income in form of money contributions, consulting services and paid-for support.

### Project management

Whatever business model is eventually selected, I believe that there must be centralized leadership for the project, be it in form of core open source development team or management of the sponsoring company. Otherwise the project will never succeed due to never ending arguments.

Design needs to be clear and flexible, and there must be an organized development plan with release schedule. As much as possible and realistic, the code should be covered by automated tests. And no releases should be made without documentation, otherwise no one will know how to use the software.

## Applications

It is important to provide applications together with the framework. Also, it would be very important to actually try the ideas, built into the platform in some real world code, so it would be nice to see some of the applications listed below, being created in parallel with or as part of the main development process.

### Message board

A real-world example – should be extremely fast and robust. I would think about using Berkeley DB as the data storage, as opposed to a conventional relational database. This way the application would be really fast, especially if proper caching is built into it.

The data storage layer should be abstracted, so can be easily replaced.

Another nice feature would be single installation – multiple independent message boards, so one could provide hosting to different unrelated boards, all configurable and manageable independently.

### Blog

Feature-rich and fast – the application should share a lot of code with Message board.

### Web Mail

Feature-rich, similar to Gmail, Yahoo! beta e-mail system. Such application can be used to provide free or commercial web mail services for large communities.

### Catalog / on-line shop

Tags: None
Categories: None |

88 comments have been posted.

###### June 22, 2015, 1:45 p.m. - Corvusoft  ¶
Great article, couldn't agree more. I think Restbed (https://github.com/corvusoft/restbed) would be of some interest to yourself and your readers. We have an active community and are looking to implement HTTP 2.0 within the next few months.
###### April 30, 2011, 4:59 a.m. -   ¶
http://www.webtoolkit.eu
###### May 11, 2011, 3:57 p.m. - Andre  ¶
I think I've seen this one already. So far a number of toolkits for web development in C++ have been developed. Unfortunately, they enjoy almost zero exposure, tiny communities and no serious enterprise backing. Thus they are quite doomed.
###### April 19, 2011, 11:55 p.m. -   ¶
TreeFrog Framework is a high-speed and full-stack C++ framework for developing Web applications. http://www.treefrogframework.org/
###### Feb. 26, 2013, 1:45 p.m. - Thomas  ¶
Hi, I am huge fan of the C/C++ web development idea. :) So I looked at this discussion and the treeFrog website [1], mentioned in the entry above. There seems unnormal overhead in this good C++ web framework, but I do not know why. Let me summarize, maybe my conslusions are wrong and you can help me: In the intro the author of the TreeFrog framework introduces the high speed of a C++ web framework [1]: "Because the sever-side framework was written in C++/Qt, web applications can run extremely faster than that of scripting language." But in his own benchmark with different PHP Frameworks and TreeFrog (1st place: TreeFrog with 1000 trans/sec; 2nd Place: CodeIgniter with 500 trans/sec, ...), he mentioned his experiences with pure PHP [2]: "FYI, Measuring the code written by Plain PHP, the result was 1261 trans/sec. Amazing! I found simplistic PHP code is awfully fast." A simple C++-Framework is in this simple test slower than pure PHP? What? Any ideas why? Best regards, Thomas [1] Homepage http://www.treefrogframework.org [2] Benchmark from www.TreeFrogFramework.org: http://www.treefrogframework.org/documents/comparison-of-performance
###### Oct. 13, 2013, 6:57 a.m. - Michael  ¶
C++ is not only good from a speed point of view, but also in terms of what the language offers: template classes and algorithms, multiple inheritance, reduced memory footprint. In my experience, C++ is one of the best languages available and is suitable for a huge range of purposes - but the two core reasons it is so unpopular for web development is exactly as stated in your article: 1) a lack in "batteries included" frameworks (Wt is very much designed from a GUI perspective); and 2) the need for recompilation for a simple change of output. I actually started work on a C++ web framework many years ago. I think the idea formed in my mind around 2007-ish, but I haven't had the time to develop the framework as much as I would like. In relation to point 2 above, I have implemented a reasonably sophisticated template language to allow the separation of business logic and display logic from C++ code. It's a light-weight programming language called WCTL. It has loosely-typed variables defined and accessed in a JSON-like syntax, conditionals (if/elseif/else), loops (foreach) and user-defined functions. I threw together a video this morning, as one of my friends was asking where it was up to. Check it out if you've got the chance. http://www.youtube.com/watch?v=bsqoTNX71eo&feature=youtu.be Note that in the video above, both PHP and WCTL are used without any caching. http://www.michaelainsworth.id.au/
###### March 23, 2011, 12:40 a.m. -   ¶
You should checkout the Hip Hop compiler which compiles PHP scripts into C++ binaries. It was developed by Facebook and is open source and downloadable from github.
###### March 27, 2011, 2:03 p.m. - Andre  ¶
PHP is a scripting language, therefore it has both advantages and disadvantages of such. I believe, that for large systems the later outweigh the former, therefore it doesn't matter if PHP is eventually compiled into C++, which may or may not give performance improvements.
###### Oct. 17, 2010, 1:19 a.m. - CharlesTheActuary  ¶
I have used AtoZed's Intraweb C++ environment along with TMS's web controls....but they are not well integrated and need a lot of attention... I would die for a C++ web development environment---where do I send the check???? I would also volunteer mightily.....
###### July 28, 2010, 8:44 a.m. - Sumeet  ¶
I have been working since quite a time now on such an idea and have successfully implemented it in the form of ffead c++ application framework (http://code.google.com/p/ffead-cpp/). It has a lot of other features like in-built Reflection ,Serialization, Interpreter, Controller pattern, Ajax, Web-Services to name a few.
###### March 4, 2010, 2:10 p.m. - Sean  ¶
Is there any progress about the proposed project? I do believe it'll be a great thing if most of the ideas can be realized and I'm looking forward to the good news. Sean W. Liu
###### March 9, 2010, 5:03 p.m. - Andre  ¶
No, not much at the moment
###### Feb. 9, 2010, 6:18 p.m. - Antonio  ¶
> Another issue one should consider is licensing. Last time I looked into it QT had no free license for its Windows version Mmmm... that last time was in 2005 or before.
###### Oct. 2, 2009, 7:51 p.m. - doc  ¶
ppC++ is another framework for embedding C++ in web pages. - Erik
###### Oct. 2, 2009, 2:39 p.m. - doc  ¶
Why not take a good, decent scripting language and then build: - a C/C++ translator - a command-line tool that "compiles" the script - a mode that allows auto-compilation in real-time of scripts that have been changed You could probably start with PHP pages (or whatever) and compile each page into a ".so" Oh wait... after I wrote that I saw that it's been done. http://www.phpcompiler.org/ So you *can* have your cake and eat it too. Sigh, now I need to write a compiler for my favorite language (SMX).
###### Dec. 21, 2011, 7:30 a.m. -   ¶
"most of the slowness.." its about server energy expenditure not the speed. in the long run humanity faces labour surplus and energy shortage.
###### May 23, 2009, 12:04 p.m. - ProspectiveEngineer  ¶
I know only c++.My friends learned languages like PHP.But I had doubt that why don't we use c++ for webdevelopment.I searched on Google and came across your site.It's really fantastic.Thanks!!!
###### March 7, 2009, 11:47 p.m. - Kornel Lehocz  ¶
It is - in theory - possible to make a JIT compiler that runs code faster than native C++. (eg. it can optimize for the characteristics of the current CPU) We are not quiet there yet, but I think we are going that direction. Right now C++ is typically faster than eg. Java or C#. I managed to get 10x speed improvements using C++ over C# in some cases. But these were in special cases, where SIMD optimizations could be used. In typical web applications there won't be too much of a difference. Also, garbage collection can be done very efficiently - capable of competing with smart pointers and typical memory handlers in C++. So, I think little would be gained by such a C++ framework, considering the current trends.
###### Feb. 17, 2009, 4:59 p.m. - Gaurav Sharma  ¶
Although I'm not a .NET / Microsoft patriot, but what makes their framework intuitive to use is the development environment (IDE) they sell. Again, although highly priced & full of MS specific conventions - VS 200x series have helped .NET web developers become children again & sit on a couch with legs on the desk & code :-). If we can also have custom wizards to create a C++ Web App Project - just like in Visual Studio 200x series, maybe we can configure NetBeans / Anjuta to use our wizards. That ways the popularity of our framework would be widespread.
###### Feb. 17, 2009, 4:48 p.m. - Gaurav Sharma  ¶
Maybe you should also check - http://www.codeproject.com/KB/mcpp/helloworldmc.aspx If I understand the problem correctly, than this is similar to what you are discussing here. My take on - http://www.micronovae.com/CSP.html haven't we already decoupled the client HTML code & server side code that actually is glued to the HTML markup. Frameworks / environments like ASP.NET + C# (or C++ - as the link mentioned above proves the point), already provide a decoupled environment for developing more robust web-apps. Not to mention that is we are to start a C++ Web Framework project, we should not overlook the idea of extensibility & portability.
###### Dec. 30, 2008, 3:46 a.m. - Frank Malina  ¶
You are looking for <a href="http://art-blog.no-ip.info/wikipp/en/page/main">CppCMS</a>. It is a C++ web framework including some basic applications such as a wiki, blog and CMS.
###### Dec. 30, 2008, 10:58 a.m. - Andre  ¶
I'm aware of the product. It seems pretty new and not mature yet, but there is definitely a promise.
###### Feb. 11, 2009, 9:29 p.m. - artyom  ¶
Actually, this framework already released as stable version, it has quite complete documentation and high perofrmance applications. More important that it is much more apropriate in terms of salability and web oriented design in comparison to Wt and others.
###### Feb. 12, 2009, 1:33 p.m. - Andre  ¶
Thanks for the update, maybe I will revisit it
###### Oct. 1, 2008, 11:36 a.m. - Anonymous  ¶
You know, you could just write an apache module with the above functionality. You would definitely run into portability issues with IIS and other servers, but it would certainly make the task easier
###### Sept. 16, 2008, 6:35 a.m. - ASKI  ¶
I am happy finally someone is seeing things my way! I have been advocating using C/C++ for everything as it just requires a one time learning curve for developing any kind of application. For web programming in c/c++ i use HTML/CSS/JavaScript AJAX/JSON with C/C++ server side programs. Once again Javascript is a one time learning effort. Writing a small client side framework for boiler pate AJAX coding is very easy. For an ORM I use OODBC //http://www.garret.ru/oodbc/readme.htm For GUI programming I use the FOX toolkit http://www.fox-toolkit.org For other cross platform stuff I use BOOST http://www.boost.org My two cents!
###### July 31, 2008, 11:21 p.m. - Emir  ¶
Hi Andre, Thanks for an interesting article. I don't entirely agree. I think C++ is best kept isolated to speed/efficiency critical sections of a web application. I think overall program workflow is not a processor or memory intensive task. I think a dynamic language such as Python is more appropriate for workflow expression because it is more flexible and therefore allows more time to be spent on defining the logic concisely.
###### Aug. 1, 2008, 6:26 a.m. - Andre  ¶
I have to disagree with you on some points. You are right, that many times web applications don't consume much resources, or hardware costs are lower, then development. In such cases a simple language similar to Java or C# would be more suitable. The tasks I have in mind are extremely busy web sites, where the cost and logistics of running a computer farm of required size becomes an obstacle. As to using Python, or any other scripting language, I must tell you I don't believe in using them for large-scale projects. Compile-time verification is, in my experience, a valuable check reducing the number of bugs considerably. Unit tests are not an adequate replacement.
###### Aug. 1, 2008, 2:01 p.m. - Emir  ¶
Hi Andre, Many big sites including google, youtube, yahoo, facebook and sourceforge would disagree with you in that they attract massive traffic but use C++ only in components whilst relying on dynamic languages for workflow and to glue components together. YouTube was written largely in Python. FaceBook and SourceForge in PHP. I think its a different story with P2P applications or servers running on an embedded device. C++ is standard in these areas. Even with ultra high performance web apps chances are the most memory used is for caching and most processing is carried out around the database. Emir
###### Aug. 2, 2008, 12:11 a.m. - Andre  ¶
Yes, Google and many others use scripting language, mainly because they were developed from ground up to be suitable for web development (PHP) or have an extensive set of appropriate libraries added (Python, Perl). That by itself doesn't mean they wouldn't do it in pure C++ if the right framework was available and they had the skills in-house... Also, think about YouTube and Facebook - they were developed as "hacks" - get out something quick and working, think about performance later. So now they just have legacy, maybe they would have chosen a different technology under different circumstances.
###### July 23, 2008, 4:31 p.m. - Sondre  ¶
This is what I have been waiting for. Why re-invent the wheel? As far as I can see, the easiest is just to copy Qt. Just make it all renders as html elements. Keep the Signal Slot concept. The second best would be to copy Ruby On Rails. It rocks. It is the best framework for web applications the world has seen. But the speed of Ruby sucks. Just imagine: The ease of Qt or the speed of development of Ruby, both with the runtime speed and possibilities of C++. If we don't do anything now, C++ will loose it high time. I will guess that 80% of all new applications developed now and in the future will be web applications. C++ could win back its popularity with an easy to use framework. We need this to be able to continue promoting C++ as a great programming language. We have no rich company behind us to hype C++. We can only proof C++ greatness by what is produced by C++. Take C++ to the web and C++ will be among the main choices for coming generations of programmers.
###### July 24, 2008, 7:09 a.m. - Andre  ¶
There are many ways to create the framework. I don't know how easy it would be to adapt QT for the purpose, after all there are substantial differences between what can be done on the desktop or on the web. As to Ruby-on-Rails - I don't know much about the technology. But many frameworks can be a source of inspiration for this one.
###### July 18, 2008, 6:54 p.m. - asad rana  ¶
currently a CS and software engineering student. Willing to help in anyway if the project were to be started by experienced programmers! just the idea gets me excited
###### July 16, 2008, 9:36 p.m. - barcaroller  ¶
Have you considered Wt ("witty")? Here's a synopsis, taken directly from their website (http://www.webtoolkit.eu/wt): Wt (pronounced 'witty') is a C++ library and application server for developing and deploying web applications. It is not a 'framework', which enforces a way of programming, but a library. The API is widget-centric, and inspired by existing C++ Graphical User Interface (GUI) APIs. To the developer, it offers complete abstraction of any web-specific implementation details, including event handling and graphics support. Page-based frameworks (such as based on PHP or JSP/JSF (+ servlets + struts)) for developing web application do not make abstraction of the peculiarities of the underlying technologies (HTML/XHTML, JavaScript, CSS, AJAX, Forms, DHTML, SVG/VML/Canvas). As a consequence, a developer must gain familiarity with all of these (evolving) technologies. Moreover, when choosing to use a technology (such the currently popular AJAX), the developer is responsible for graceful degradation when AJAX or JavaScript are not available or disabled. The structure of the application follows mostly the page-centric paradigm of early day HTML. This means that when using advanced AJAX techniques, as a developer you will need to design and maintain manually your client-server communication. Generating HTML code or filling HTML templates is prone to security problems such as XSS (Cross-Site-Scripting), by unwillingly allowing JavaScript to be inserted in the page. But this cannot be avoided by template frameworks, because as a developer you need to be able to insert self-written JavaScript to improve your web application. In contrast, a web application developed with Wt is written in only one compiled language (C++), from which the library generates the necessary HTML/XHTML, Javascript, CGI, SVG/VML/Canvas and AJAX code. The responsibility of writing secure and browser-portable web applications is handled by Wt. For example, if available, Wt will maximally use JavaScript and AJAX, but applications developed using Wt will also function correctly when AJAX is not available, or when JavaScript is disabled, reverting to a plain HTML/CGI mechanism for communication between browser and server.
###### July 17, 2008, 6:13 a.m. - Andre  ¶
Yes, I'm aware of its existence, thanks to previous comments, submitted to the article.
###### July 7, 2008, 10:17 p.m. - SoftJunkie  ¶
i'm on the same wavelength as what is being described here. what comes to mind is Qt, since it is a robust C++ framework designed to be portable to all the major OS', along with embedded environments as well. in my view, this page describes Qt for the browser (and server). not so much literally, but conceptually. such a framework should allow widgets to be drawn, an event model to trigger actions, database support, threading, ... most importantly, it could reuse existing c++ libraries, be type-safe, be portable and run close to the metal (in-process, if desired).
###### July 8, 2008, 6:50 a.m. - Andre  ¶
QT is definitely a possibility. I've never used it, so can't say whether it is more suitable for this task than, say, plain boost, which also contains many useful classes. The GUI part of QT won't be very useful since its all "direct" PC-based GUI and not related to web. Another issue one should consider is licensing. Last time I looked into it QT had no free license for its Windows version, which is not very good for my project.
###### July 14, 2008, midnight - ocean  ¶
Why not to start with WT (Witty) ?. It is open source project and widget centric c++ library (also has application server ). It completely provides abstraction from underlying tehnologies such as HTML .XML, AJAX, Java Script. It sounds similar to QT but as you said QT renders GUI which is PC-BASED whereas QT renders in form of HTML/JAVAScript. At least , some ideas can be taken from WT and some can be taken from C++ Server Pages. Further more , need to start with some ideas from WT and C++ SP at earliest. Project can be keep on evolving as time goes and will get more support. Need to form forum . message board related to starting project.
###### July 3, 2008, 3:04 p.m. - Andrew P  ¶
I'd be interested in developing this, though I have other priorities (mainly school), which limits my time severely. However, I'd be available to do code review, for example, or other isolated tasks. Is there a development page or wiki set up for this project?
###### July 4, 2008, 10:09 a.m. - Andre  ¶
Andrew, at the moment there is no active development going on, related to the project. I'm interested in gathering opinions from a wide range of developers, as well as observing the current state of the web development frameworks. I won't start any development until I have a solid core team of at least 3-4 high-level C++ programmers with considerable Web experience, otherwise the project is doomed from the start. Any extra part-time involvement is, obviously, more than welcome.
###### June 30, 2008, 2:22 p.m. - Alan Gutierrez  ¶
Unfortunately, you are going to fail. Why? Because the developers you tap will come from desktop UI programming. They first thing they are going to do is develop a set of widgets, a widget hierarchy, and attempt to make the entire project C++ only, with no XML, HTML or JavaScript. You're going to be so busy working on abstracting these concepts, that you're always going to be behind the people who are actually developing these concepts using Ruby, PHP and Perl. Java, no, Javans have the same problem. Wicket is this up and coming framework for Java who's stated goal is to solve the problem of statelessness, as if this was 1996 and statelessness was still considered a problem. By trying to hide statelessness, the developers of the framework are unable to use design patterns that design for the stateless experience of the web. I want to carefully maintain state on the server side. As a developer, I want to be aware of the fact that a visitor left with a full shopping cart after his credit card number was incorrect. Maybe he went to find his reading glasses. Maybe he left them at his office. Maybe he forgets about my website until a month later. I still want him to pick up where he left off. Treating HTML, XML, JavaScript as a problem to be solved has already been posited in this thread, which takes it even further than the statelessness. This potpourri of different languages is the enabling technology of the contemporary Internet. Why would you want to shield yourself from it? Why would you want to express JavaScript in C++? I'm sure you could try, and come up with some marble-mouthed, inflexible frameworky class library, that renders web interfaces like a mittened four-year old with a box of crayons. If you do build this, give C++ the job where it can excel. Create an action framework. Create a class to respond to a particular RESTful action and generate a streaming result. Use a templating language to generate your HTML and XML, but write out these templates in their own language, HTML or XML. Look at Java's Stripes for an example of a Java framework that knows it's place and does what it does extremely well. I'd happily use a C++ framework, if someone would develop one that didn't require that I write HTML in C++.
###### July 1, 2008, 6:18 p.m. - Andre  ¶
Thanks for your detailed comment. While you have a valid point, trying to explain, why previous attempts to create a C++-based framework failed, I think you are making wrong conclusions from my article. I definitely don't want to eliminate HTML/JavaScript/CSS from the development lifecycle. The framework should not dictate a single approach to the creation of the web GUI, therefore a variety of paradigms is possible. One could be indeed a rather rigid C++ only hierarchy of widgets, which would generate some simple tight HTML, probably not giving you much options in creating pretty looking AJAX interfaces etc., but which will abstract all the weirdness of modern web development from an uninterested programmer. Such set of widgets might be extremely useful in, say, embedded world - when you want to create a simple GUI for your router or other device, where nothing fancy is required, but memory/CPU constraints are tight. Another library on top of the framework could be much more flexible, doing something along latest versions of JSP tags (or whatever they are called). Yet another one could follow Google's approach of compiling Java into HTML/JavaScript. All in all, I don't see my framework as an all-purpose one, it fits more in different niches, such as either exceptionally high loads or constrained hardware.
###### May 22, 2008, 2:46 a.m. - Craig  ¶
I would kill to be able to write a web application using only C++ I would love to help with this, but (without going into the boring and obvious details) my current employment prohibits this. That being said, I've been thinking about the same things mentioned in the paper and I would like to offer a couple of thoughts: 1. Although I am a fan of the major frameworks mentioned under "learning from other frameworks", one thing I would change about ASP.NET would be a way to use much of the "base" functionality and ditch the page model in favor of a "more" template-based system. Essentially, I would like to get Apache to port Velocity to ASP.NET :) 2. Code-generation and/or reflection/introspection are going to be needed for things like ORM. I would also suggest that one or both will be needed for a "full" URL-based MVC framework. E.g. http://foo.com/bar/add?a1=100&b2=hello translates to something like (new bar())->add(100, "hello"). When you consider leveraging open source, you might want to look at Qt. Obviously, the GUI widgets would be completely ignored, and you would be introducing a compile step, but you would be getting introspection and some cross-platform help. Just my .02 - which isn't worth much with the current exchange rates :)
###### May 22, 2008, 1:48 p.m. - Andre  ¶
You've got interesting ideas. However, I don't think a URL-based MVC, the way you describe it, is a good idea, since I don't see any obvious dividends and the security exposure could be significant. Code generation is another matter. Using something like Aspect C++ is, probably, the only way to implement reasonable ORM framework. QT is an option, but I've never looked into it's pre-compiler.
###### April 17, 2008, 8:05 p.m. - Michael  ¶
I've been working on a web framework in C++ for the past few months in my spare time. It's based on a lot of ideas from Django, but tries to migrate all repetitive coding into code generation. It uses a YAML configuration file to keep track of all the models (ie, tables in the database) and views. There's no documentation yet, it's not done, and plenty of the code is ugly, but if you're interested in seeing something, you can look at the git repository: <a href="http://git.snoyman.com/cppweb.git">http://git.snoyman.com/cppweb.git</a>. Let me know if you like it (or even if you don't).
###### April 9, 2008, 12:08 a.m. - Mr. Potatoes  ¶
so i was looking to see if there was a C++ based web framework and found this article. this is very wel written and a great read. i used to be a C++ developer and went over to PHP because it was less hassles. right now though i am planning to go back because of speed, power and performance. you propose some great ideas. mostly that it was the tools and the specifications that made Java great for web programming. C++ would be immensly faster and it is what i would rather use. i am writing some documentation on writing my own C++WF but wanted to see other implimentations, writeups or white papers. very little is what i found and it is dumb founding once you realize how many OPEN SOURCE C++ libraries there are out there. putting them together as an ad hoc WF would work but a complete and concise WF would be best. thank you for this write up. it was a great read and i thoughly enjoyed it. -Taters
###### April 10, 2008, 10:18 a.m. - Andre  ¶
Thanks for your comment
###### Feb. 6, 2008, 4:37 p.m. - kt  ¶
Stumbled upon this post when I started thinking about using C++ to create a web framework largely based on the principles of Rails. I've been doing Rails for almost a year and absolutely love the motivations behind Rails - MVC, Convention over Configuration, Plugins, Generators, etc. And I totally agreed that its the TOOLS behind a web framework that makes life easier for the developer..although the language plays a part too. But this is a really interesting initiative and I'm looking to contribute if this gets more traction.
###### Dec. 29, 2007, 3:17 p.m. - artyom  ¶
I think, this project may interest you http://cppcms.sourceforge.net/ Development blog: http://art-blog.no-ip.info/cppcms/blog
###### Dec. 30, 2007, 9:40 a.m. - Andre  ¶
Thanks, looks interesting indeed. However, very little information about the actual design is given. Hopefully we will see more documentation in the future.
###### July 12, 2008, 3:48 p.m. - artyom  ¶
Beta version of CppCMS Released: http://art-blog.no-ip.info/cppcms/blog/post/25 I think this may interest you
###### July 12, 2008, 10:24 p.m. - Andre  ¶
Thanks, I'll have a look
###### Dec. 30, 2007, 8:57 p.m. - artyom  ¶
This project is very new, and is still in the beginning of its way. I had described there some major architectural points: http://art-blog.no-ip.info/cppcms/blog/post/3 However it is too eary to talk about the stable API or some basic documentations...
###### Dec. 6, 2007, 1:36 p.m. - Ambrose  ¶
Hi Everyone , I am a C# programmer , currently started to explore open source. Is there already existing C++ web frameworks
###### Dec. 14, 2007, 7:42 p.m. - Anonymous  ¶
Wt ( http://www.webtoolkit.eu/ ) is the only decent one I know.
###### Dec. 5, 2007, 10:11 p.m. - Dave Courtois  ¶
I agree whit you Andre, it's a lot of work. The visual part is not essential at begin, but we have to consider it at design time. All i wanna give in the last discution is couple of idea for the whole framework. Mabey the ORM i do at this time can give us a better idea of the application of this principles i explain in my last post.
###### Dec. 5, 2007, 9:26 p.m. - Andre  ¶
David, it is all sound and good. Many popular frameworks are based on the same principles and it makes sense to reuse them. But it is a lot of work, obviously. Especially the visual design part. Anyway, discussion is necessary. My e-mail is in the contact section (bottom of every page), feel free to write.
###### Dec. 3, 2007, 4:02 a.m. - Dave Courtois  ¶
I begin to write a c++ Object Relational Mapper base on JDO architecture. I made use off c++ template meta programming for implement the heart of the system. Soon i am finish to write the base line of the system i will made it available on the web. At this time there's to much to do to have a good idea of the project. I use eXtreme programming approach for this project, agile method, and i am pretty proud of the results.
###### Nov. 23, 2007, 9:49 p.m. - Jose FM  ¶
Ruby on rails is a successful framework, and a reason for that is that it has tools that help you to develop fast. I like to much your ideas about make a web framework based on C++, also, I would like to help. It is necesary to make tools that let people to develop fast, not only to make a very fast framework. The proccess of development in the framework must be fast to be accepted by the people and we cant take ideas from the existing frameworks to do that. And example of that tools are the Ruby Standard Library, very diferent from the C++ Standard Library. I do not suggest to re-implement Ruby o something like that, but to implement the tools that support the framework and the other libraries. By the way, sorry for my english. I'm mexican. Saludos.
###### Nov. 29, 2007, 8:50 a.m. - Andre  ¶
I cannot agree with you more regarding the solid foundations required for the success of the framework. It should be relatively easy to do the required basic stuff, so that the developers can concentrate on business logic implementation and not on the boiler plate code, required by the toolkit. And this is the reason I think it's quite a complicated task in the first place. Recently I can see more and more people who are to contribute. If I have more spare time, I will start writing some design documents and eventually something might come to life.
###### Nov. 19, 2007, 5:57 a.m. - Trinadh  ¶
What about C++ server pages? http://www.micronovae.com/CSP.html Let me know if it has some potential
###### Nov. 20, 2007, 2:09 p.m. - Andre  ¶
Sounds like an interesting idea, especially the "templates". Need more reviewing in order to understand whether the thing does everything I want. One major problem is that the project is closed source. I am not a zealot of Open Source in general, but I believe that otherwise such system has no chance of getting sufficient market share and therefore has no future.
###### Oct. 28, 2007, 11:45 p.m. - Dave Courtois  ¶
The best way to contribute is to give idea and opinion... (that's my opinion)
###### Oct. 28, 2007, 11:28 p.m. - Dave Courtois  ¶
At first view, in JDO, i don't see a lot of use of reflexion. But wen the type to pass to a function is unknown, the generic Object type is use. So the framework doesn't care about the type of the object. In counter part the client side have alway to know the true type of the Object and made explicit casting before use it. So the boost type Any is all we need here. For Hibernate, thats a well know ORM, he came before JDO specification and participate in many way of her elaboration. For performance issue take a look to this web cite, http://www.jpox.org/docs/performance.html (Jpox is an implementation of JDO). JDO was part of the J2EE specification, is in fact the persistence tier of EJB 3.0, if we plan to build a container style application like EJB (JBoss or GlassFish) that can be a good architecture to use. There not enough space here to describe in detail JDO but the most important question i try to answer is how i can made code enhancement in C++. Code enhancement is the way JDO works to made object persistent, that's is completely transparent to the application developer, To make long story short, an application from the JDO implementation, get the byte code an object and add persistence functionality. The application developer have to write a configuration file in xml that tell the JDO enhancer what class and field need to be persistent. Another approach available to JDO implementors is enhance the source of the client application itself. The JDO implantation user write her class and a program written by the JDO implementor modify the source code of the class directly, (that's can be made in c++) but we lost transparency, in counter part the code is more verbose, easiest to debug. That's a sample of the consideration we have to look before made decision. A web framework implement the MVC pattern, so the model part the ORM is the first step to do. One of the powerful aspect of JDO is the abstraction of the underlying technologies storage. So it can be file system, ORDMS, RDBMS, or DB Berkley engine directly. I propose to take idea from successful framework and implement it in C++. On the way we probably find her way, that's agile!!! The discussion is not over... Another consideration is Unit test Bug tracker Version control ...
###### Oct. 29, 2007, 7:38 a.m. - Andre  ¶
Regarding tools for development - version control etc., I think that the most popular choices will do, such as svn/bugzilla etc.
###### Oct. 29, 2007, 7:36 a.m. - Andre  ¶
Dave, bytecode manipulation is a popular technique in Java, but it is not available in C++. So I don't know how we can make transparent persistence, using the language. Probably we will have to do some sort of hand-mapping, either in code of the object or some external mapping. An option to consider is Aspect Programming for C++ - see http://www.aspectc.org/ for instance. The problem is that it introduces an external tool dependency for the developers, which is always not very good...
###### Oct. 28, 2007, 8:02 p.m. - Dave Courtois  ¶
Hi Andre, I begin to read about JDO, Java Data Object. For a good WebFramework there a need for a good ORM, so the JDO specification give a nice architecture starting point. Java and C++ have alot of similarity. JDO use JDBC for RDMS i plan to use ODBC. The Oject type in java can be easly replace by Boost.any type. All is there to start the projet... What do you think about Cargo as a name?? Think about it
###### Oct. 28, 2007, 10:24 p.m. - Andre  ¶
Any name would be fine. I don't remember enough about JDO (but other Java-based ORM systems come into mind, such as Hibernate) in order to make any conclusions about creating a similar C++ framework. Java and C++ are similar in many ways, but they are different in many as well. One particular thing lacking in C++ is reflection, and I wouldn't be surprised if a considerable bit of JDO's functionality depended on it...
###### Oct. 27, 2007, 8:59 p.m. - DaveM  ¶
I like the sounds of this. How can help contribute?
###### Oct. 13, 2007, 9:38 p.m. - Dave Courtois  ¶
That's can be a starting point... <a href="http://www.dre.vanderbilt.edu/JAWS/research.html#intro">http://www.dre.vanderbilt.edu/JAWS/research.html#intro</a>
###### Oct. 13, 2007, 9:54 p.m. - Andre  ¶
Thanks - I'll have a look
###### Oct. 12, 2007, 2:34 p.m. - Dave Courtois  ¶
C++ is my favorite language, is fast, portable and he have a lot of nice tool for development. So at this time i work in aerospace sector and i develop a quality management system. I do it whit Jboss seam. The main idea is nice but when it come the time to write and debug the code, the nightmare just begin! each line is a new adventure. The problem is this one, J2EE is base on to many different source, JSF (myface ...), EJB3(glassfish, jboss AS), (seam, to made easy the link between the first tow framework i mention) and for a nice looking interface you can use (RichFace, IceFace, ajax4jsf...). If you need help there a lot of good book, each book have 500 pages, more or less. Why Ruby on Rail is so popular? It's because there's only one Rail!!! At my opinion if you wanna beat Java you have to follow the rail approach, I don't think you have to copy rail, like many project try to do, whit out success. At my opinion the requirement are that one, - ORM tool in c++ - Ajax easy integration - Crud generator, (And the generated code must be highly reusable! Not a what you see is all you get class!) - Dynamic debugging tool, not message base html page, that very frustrating, - Easy to configure, there annotation in Java, the pojo approach work pretty well. Since there is no annotation in c++ we need to rely on another approach. Ruby use syntactic signification rule. Another approach is to propose default value, so the user change value only when he need it... There a place for innovation here. One tool you forget to mention is CORBA, one of the most powerful tool. CORBA is portable, fast, maybe a little bit complex but very powerful!! There anything needed for distributed application on it. The protocol IIOP is ten time faster one the network than any other text-based protocol like soap for example. CORBA is secure, there are encryption functionality build in it. All is needed is a way to write a simple client using a CORBA reference in JavaScript. So if you need my help, i will very open to this project !-)
###### Oct. 12, 2007, 3:02 p.m. - Andre  ¶
Dave, thanks for the detailed response. I am well familiar with web development in Java, and this is one of the things which led me to write the paper. I agree with you on most of the topics in general. What's important is that a good and detailed discussion is essential. In the end of the day I don't want even start top level design before I have a team of at least 2-3 people in addition to myself, otherwise there is no future for the project.
###### April 4, 2007, 2:20 p.m. - Anonymous  ¶
You should also look at <a href="http://www.tntnet.org/">Tntnet</a>.
###### April 5, 2007, 7:14 a.m. - Andre  ¶
Thanks for the link. From a <strong>very</strong> brief look at it, the framework seems to be a "C++-based JSP" (or PHP, or ASP). While JSP-like approach, I would be ideally interested in greater separation between logic and presentation.
###### March 29, 2007, 11:01 p.m. - JT  ¶
I want to help in this anyway I can. C++ has the power in both language and libraries -- they just need to be pulled together.
###### March 30, 2007, 8:16 a.m. - Andre  ¶
Great to hear! If a few more people join the party, we can start the project! Can you write briefly about what you can do/want to do?
###### March 21, 2007, 9:02 p.m. - Anonymous  ¶
You forgot about the use case of having an embedded system with a web-based user interface. I work for a company who sells a piece of hardware that has 2 MB of compressed code space and 8 MB of RAM. We can't afford PHP, Perl, Java, etc. So, a C++ web application framework (that is not tied to Linux OR Windows) would be a great help.
###### March 21, 2007, 9:11 p.m. - Andre  ¶
Thanks for your comment. I must tell you, that I don't see embedded systems as my primary platform. Although I wouldn't mind deploying my hypothetical C++ web development platform in embedded environments, my main target are actually large servers for very busy web sites. In order to satisfy popular development needs and to provide a useful alternative to other frameworks, mine needs to include quite a lot of stuff, and might become relatively large, probably too large to be deployed in 2M. That said, if the framework is kept "modular enough" it might be possible to compile/deploy only the necessary subsets of it, making it quite useful in the scenarios you describe.
###### Jan. 23, 2007, 3:38 p.m. - Anonymous  ¶
Good initiative ! I applaud in creating web applications in C++. Especially for scientific applications this makes a lot of sense, or in any situation where some C++ library is already available for the business logic. Perhaps you should also take advantage of the transformation that AJAX is causing in web application design. A clean plate for a web framework here is an opportunity, given that many successfull page-based frameworks (like PHP/JSP/etc... but also the fashionable Ruby-on-Rails) have the almost impossible task of putting AJAX support in their page oriented approach somewhere. In that respect, perhaps you should get some inspiration in some innovative projects like <a href="http://witty.sf.net/">Wt (C++)</a> or <a href="http://www.nextapp.com/platform/echo2/echo/">Echo2 (Java)</a>. Also consider that some of the most successfull and recent web applications (like GMail) are not using any of the existing frameworks at all, so there is clearly a lack of decent solutions !
###### Jan. 23, 2007, 10:24 p.m. - Andre Bar'yudin  ¶
Thanks for pointing me to Wt - it is quite an interesting project which goes into the right direction. Yes, indeed, despite the large number of web frameworks, many of them have different drawbacks. But only big companies, such as Google, can afford creating a brand new framework in-house. For others the only option is to stick with the crowd. Here is where open source developers can come to rescue :-)
###### Jan. 22, 2007, 8:24 p.m. - Anonymous  ¶
Waiting for a C++ WEB development platform to happen on LINUX! Windows ATL is awesome, wish we have an equivalent for opensource. There are lots of powerful concepts in C++ which are unfortunately rotting away if we don't put into practice and keep doing projects in other languages.
###### Jan. 22, 2007, 10:32 p.m. - Andre  ¶
I would say that ATL is far from perfect and too Windows-specific, but it would definitely be great to have a generic (Unix/Windows) template library. <a href="http://www.boost.org" target="_blank">Boost</a> is a very good and promising project. My document actually talks about the web development part of ATL - but I would like it to be "better" in many ways.
###### Jan. 10, 2007, 9:51 p.m. - Dragos Ionita  ¶
Yes, I would definately get involved in developing what you are describing here, a C++ web development env with tools, because the system would run very very fast. All the users could adopt the system and not necesarely just those interested in speed improvements over java/php/ruby/perl. From my point of view as a web developer, any scripting language wouldn't make any sense I were able to do the same things in C++.