9

I've been looking around and came across the WT toolkit, Is it stable? Any good? I was stumped on how to go about this in C++, given the lack of libraries and resources concerning web developement. (CGI/Apache)

The purpose of my application is to populate some data from a Sybase ASE15 database running GNU/Linux & Apache Hence allow some user interactions.

I am going to use Sybase open client library (libct) to retrieve columns from the Server, feed this data back to wt model/view.

My requests:

Is there any more practical solution rather than using other scripting languages? I mean by practical, an interface with ODBC retrieving, and MVC mechanism?

If not available in C++, any alternative in Java?

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
ZeroCool
  • 1,490
  • 4
  • 19
  • 33

13 Answers13

11

C++ isn't a very popular choice for web applications - probably because it's too easy to leave security holes, and development time tends to be a lot slower than for the scripting languages.

Dynamically typed scripting languages convert compile-time errors to runtime errors. Detecting those might not be as easy as reading through the compiler output. Scripting languages may be OK for quick-and-dirty simple projects. Beyond a certain level of complexity one needs strongly typed, well-structured languages. Such as C++, or Java.

Most scripting languages encourage sloppy programming.

As to the "security holes": if you refer to buffer overruns, allocation/deallocation errors, the answer is "STL". And proper training of course :-)

András Aszódi
  • 8,948
  • 5
  • 48
  • 51
7
  1. http://www.webtoolkit.eu/wt#/
  2. http://cppcms.sourceforge.net/wikipp/en/page/main
  3. C++ web service framework

For starters. There are certainly more I'm sure - a healthy google search probably wouldn't hurt. Also, you could try the #C++ channel on freenode - they have an offtopic channel that you can ask about if you want to talk about non STL C++ and the people there would happily answer your questions I'm sure. Good Luck.

Community
  • 1
  • 1
4

tntnet (http://www.tntnet.org) is great for creating web applications with C++.

Tommi
  • 91
  • 1
  • 2
2

CGI programs are pretty damn easy to write in both C and C++ - you don't really need any special library, though having one will obviously make development a little faster. Do you really understand how CGI works? Basically, your program reads environment variables with getenv(), does some processing, and then writes some HTML out to the program's standard output.

  • Absolutely Yes, actually the program already achieves what it was intended to do, but with some extra overheads. I'm not a JavaScript/AJAX guru, but seen some tools (WT ie) that do the whole stuff under the hood, hence keeping you unaware of the implementation. – ZeroCool Aug 09 '09 at 23:48
2

You might want to check out klone:

http://koanlogic.com/klone/index.html

Basically, it's a framework AND server that makes writing C++ web backends easy...

dicroce
  • 45,396
  • 28
  • 101
  • 140
2

Give this one a look. I never much liked Wt's design. But then, I'm kind of an anti-framework guy.

http://cppcms.sourceforge.net/wikipp/en/page/main

Shaun
  • 3,928
  • 22
  • 21
  • Yeah I knew about it misterMatt suggested this before, it's a good choise though, but now I'm writing a small framework to suit the needs. Concerning Wt's design I think it's kinda slow for a cgi oriented application. – ZeroCool Aug 12 '09 at 17:49
1

The best web toolkit for C/C++ would be Apache httpd. Just write a module and you can use libct to access your database.

There is MVC modules out there like mod_spin but I don't have any experience with it.

ZZ Coder
  • 74,484
  • 29
  • 137
  • 169
1

C++ isn't a very popular choice for web applications - probably because it's too easy to leave security holes, and development time tends to be a lot slower than for the scripting languages. I'd say 99% of web applications don't need the speed that C++ brings.

So this leads to a lack of good frameworks.

From my fairly light look at the area I'd say Wt is probably your best bet, although it's more of a library of useful things (like page templates) than a framework.

I'd seriously consider not doing this in C++ though. Even Java (I prefer C++ myself) has much stronger support for web development.

Colin Coghill
  • 1,549
  • 15
  • 18
1

Qt is going to grow day by day. And Wt is the trying to stand for web tool kit based on Qt. C++ the powerful language and the best in my opinion. If you like gnu projects and independent tech. I really suggest to use them. I used PHP, Phyton, C#, VisualBasic, Fortran etc. but I did not like as much as C++ among of them.

randyboy
  • 11
  • 1
1

I gave Wt a try and really liked it. I will not give you any cons or pros for using it from scratch, but when you have a backend written in C/C++ with millions of API entries then Wt is an obvious choice. There are some very powerful features that is easier to use for example dynamically loaded tables. Signal processing on the server etc.

One thing I really disliked at Wt is that it is not compatible with Apache on Windows as of time of this writing. You either have to use Unix, or IIS on Windows. Wt also offers its own http server, that is very convenient for developing your applications but I would not trust it in the role of production server as I am not sure of its security.

user2555515
  • 779
  • 6
  • 20
1

Another alternative may be the "FastCGI / CGI C++ Library" that is aimed for Boost integration at someday: http://cgi.sourceforge.net/

Christian
  • 1,017
  • 3
  • 14
  • 30
0

My personal choice for web development is Ruby on Rails, but if you have to chose between C, C++ or Java for web development, my suggestion is to use Java with JavaServer Faces

hiena
  • 935
  • 1
  • 8
  • 9
0

Apache Celix looks like a promising active project that meets the requirements of this (albeit old) question. See: http://celix.apache.org/

From the Apache Project description page:

Celix is an implementation of the OSGi specification adapted to C. It will follow the API as close as possible, but since the OSGi specification is written primarily for Java, there will be differences (Java is OO, C is procedural). An important aspect of the implementation is interoperability between Java and C. This interoperability is achieved by porting and implementing the Remote Services specification in Celix.

Jev Björsell
  • 891
  • 1
  • 9
  • 25