views:

220

answers:

6

I am a C programmer and new to web development. Which web-C-technology (open source) suits me to learn quickly for web-development?

Update: my question is based on both client and server technologies.

A: 

A lot of "web programming" nowadays happens client-side. Unless you investigate (or invent) a cross-compiler from C to Javascript, you're not going to be running a lot of C code in people's browsers.

Server-side, of course, you're free to write stuff in C if you feel like it, and some people do.

unwind
I think it's more or less clear, he's talking about server-side part.
Michael Krelin - hacker
my question based on both client/server side. i am updating the question.
Avatar
A: 

Before someone comes to suggest that you use language substitute-fashionable-one, I'd like to tell you that what you need to do the web development with c is to know how to do development in c and understand the nature of protocols, markup, etc. Library needs are minimal here. And no one will tell you which one suits your needs and your perception of beauty.

Michael Krelin - hacker
Careful of accidentally using <html> tags in your posts.
Chris Lutz
Thanks, Chris. I had no idea it's allowed ;-)
Michael Krelin - hacker
Library needs are only minimal if you are willing to write your own URL dispatching, authentication, DB layer, template processor and lots of other stuff you *will* get wrong for the first time (and second, too). Writing it all by yourself is a great way to learn, but a very unfortunate way to create a professional web application.
zoul
It is, indeed, more common to use the library that has already got it wrong and blame it on that. The fact that you mentioned DB layer means that you haven't read my answer — it is not a part of *web* development.
Michael Krelin - hacker
+3  A: 

I'm not aware of any present-day heavy use of C (not C++) for web development, much less one that could be "learned quickly". It's not the right language for the task at large, though some specific modules in a web application could certainly be written in C for performance - and even then C++ would be most likely.

Pavel Minaev
Yes- memcached being an example of something written in C
RichardOD
memcached is not exactly web thingie, although it is heavily used for web. And while we're at it, I support the idea of going c++ instead.
Michael Krelin - hacker
+3  A: 

I know this is going to sound arrogant, but instead of saying that you are ‘a C programmer’ you should say that you are ‘a programmer’ and learn some language better suited to web programming. It will be fun, you will become a better programmer and the applications are very likely to be better, too.

I know that in theory you can write a good web application in any language, but in practice there are lots of aspects that make writing in a more popular (in the ‘webapp sense’) language easier. Lots of examples, if nothing else.

zoul
This is definitely the best answer.
RichardOD
+1  A: 

On the client side, you have little choice. You need to know your way around HTML/CSS/Javascript.

On the server-side, you have a ton of options.

I was a C programmer before I got into web development, and when PHP came along, I was attracted to it because it has syntactical similarities with C, and (even better), a lot standard C library functions are there too ( sprintf, fread, etc).

PHP is also a decent place to start as it performs just fine as procedural language, and if you've never done anything remotely OO, you might find that it provides a nice way to get your feet wet.

This is not to say that PHP is the most wonderful language on the planet. There are plenty of issues. But as a "first web-oriented language" for someone coming from a heavy C background, I'm hard-pressed to think of anything significantly better.

timdev
"php" originally meant "personal home page". This is exactly what the language is good for ;-)
Michael Krelin - hacker
Yeah, that's exactly what PHP was originally good for. It grew, so they changed the name to "PHP Hypertext Preprocessor", which is a pretty good description of a lot of what people do on the web. If there's another web-centric language that you think would be an easier transition for a straight-C (jokes write themselves) programmer, please do suggest it.
timdev
As for "php", I don't think it's grew enough to justify the name change, but my opinion is not the only one and to my surprise subject and (to my even greater surprise) argumentative opinions aren't welcome here, so I better don't go further into it. And I'm not sure there's a real need for transition further than c++.
Michael Krelin - hacker
I agree it's not the right venue for such a discussion. But I think I get you - there's a soft spot in my heart for people who think any language that doesn't involve performing arithmetic on addresses or collecting one's own garbage just isn't manly. They're typically very sharp folks, though the machismo is kind of a turn off :-)
timdev
Well, a friend of mine once said that using GC feels like going to the toilet and not being able to wipe one's rear end in timely manner. And I share the sentiment. But this is absolutely not what I meant. It's hard to explain what's wrong with php in full, but I'd say the fact that `'0x0'=='0'` evaluates to true is a show-stopper ;-)
Michael Krelin - hacker
LOL. GC is like living on in Star Trek. You ever see a WC on the Enterprise?
timdev
I'm this strange kind of geek that can't watch star trek for longer than 2 minutes without being bored aswoon.
Michael Krelin - hacker
A: 

On the client side, you can do nothing in C. On the server side one could argue that it's still possible to create a set of cgi's in C and these cgi's together with some cleverly crafted client code (html+css+javascript) could result in a state of the art web application.

This is, however, based on my experience, a very hard road, and one that's virtually impossible to follow without having a good insight in the very special environment that a web application is. Plus, the end-result will be a Frankenstein-like beast at best. Trust me, been there done that.

My suggestion to you would be to start studying web development as such. That is, client side html+css+javascript and a server side scripting solution. You'll probably benefit from choosing a scripting solution like php, because of its syntactical proximity to C, but IMHO that's the easy part of the job. Understanding how the client side (html+css+javascript) works together to create beautiful, reliable and user friendly web applications is where you need to focus on. Because of your background in C programming, the scripting side will be easier to get started in.

Good luck!

fvu