Live data from Hacker News

Web development in C: Crazy?

medium.com

61–70 of 213 posts

Re: Web development in C: Crazy?

#61
post #58

Earlier quoted context omitted.

I suppose a response to the spirit of the remark as a whole rather than one exemplary detail would be asking a lot.

The spirit of using C for web applications is: it'd be faster and simpler just to publish your root password and IP address to the web.

Insights like these are so rare. You must have worked really hard for them.

Re: Web development in C: Crazy?

#62
You missed to mention Duda I/O:

   http://duda.io
On this case this framework target web services, you can do web development but the goal is to be a fast HTTP/Websocket stack instead of a friendly MVC renderer.

Even is do in C, i tries to present a friendly C API as you can see in http://duda.io/api, if you think into a fast big data server front-end, Duda I/O fits pretty well. A few slides:

    http://duda.io/slides/

Re: Web development in C: Crazy?

#64
post #4

A lot of embedded systems have web configuration interfaces written in C. For example, your wireless router's configuration page is probably written in C.

True that. I've written a few Web interfaces for embedded devices in C. That being said, I now try to use Lua along with C for projects of this type. It all really depends on memory and performance requirements.

I was once part of a team on a project that we wrote an embedded webserver that we compiled in all the html, images(converted to c arrays), css and js, into a single binary so that we wouldn't have to read from flash to load those resources for speed boost and less flash access.

I've learned now, that given the target hardware and resources, that wasn't really necessary...

Re: Web development in C: Crazy?

#65
post #50
post #42

Earlier quoted context omitted.

During the years we worked on Viaweb I read a lot of job descriptions. A new competitor seemed to emerge out of the woodwork every month or so. The first thing I would do, after checking to see if they had a live online demo, was look at their job listings. After a couple years of this I could tell which companies to worry about and which not to. The more of an IT flavor the job descriptions had, the less dangerous t…

That's using language choice as a proxy for developer talent. It's a proxy, not a real metric of the language itself. I'd note that pg ultimately sold to Yahoo, who a) wrote a fair bit of C in house themselves and b) were severely trounced by a competitor that initially was primarily using C++ (Google).

Google still does primarily use C++.

Re: Web development in C: Crazy?

#66

i been working with ntop, its a web interface written in C, the HTML is embedded within the C code. As a rails/php developer this is kind of crazy :P Heres the source https://svn.ntop.org/svn/ntop/trunk/ntop/httpd.c

Hehe, this looks similar to some stuff I've worked on with embedded devices.

Re: Web development in C: Crazy?

#67

WHYYYYYYYYY No, seriously, why ? As far as I can tell, his entire argument is "web development in C is terrible and limiting, but not as quite as terrible and limiting as you might think." I guess that's good news if terrorists are forcing you to write websites in C, but I don't see even an attempt at explaining why you would choose to do this.

I've done it. The use case was settings web pages on an small wifi audio device. Using a few hundred lines of code more was in all respects preferable to trying to fit some other language runtime into a 6 MB budget.

And I don't know why it would need to be so horrible to program web in C, once you have abstracted out common web tasks, using them is as simple as using them in any language, just call a function.

Re: Web development in C: Crazy?

#68
post #50

Earlier quoted context omitted.

That's using language choice as a proxy for developer talent. It's a proxy, not a real metric of the language itself. I'd note that pg ultimately sold to Yahoo, who a) wrote a fair bit of C in house themselves and b) were severely trounced by a competitor that initially was primarily using C++ (Google).

Google still does primarily use C++.

Google is so huge now, I'm not sure if that is really something that you can state unequivocally. The search engine and a lot of the plumbing that everything is built on top of is written primarily in C++, but there is a TON of both Java and Python code there (and that's not counting things like Go and specialized languages like the infamous Sawzall).

Back in the day (particularly before they started doing ads), almost everything was C++.

Re: Web development in C: Crazy?

#69
Why C? Performance. I wrote a C webserver on a PIC32MX795F512L (80 mhz/ 128kB RAM), and it was _screaming_ fast (for what it was running on). Easily handled ~100 clients making 2-3 requests/sec continuously to a JSON based API (I really don't know how far you could push it before it got slow), which is respectable for that chip ... but this was written to the bare metal with no OS (did use libraries for IP/TCP/HTTP/JSON, though). C isn't my first choice for web development either, but there's absolutely no way you could pull that off in a higher-level language.

Re: Web development in C: Crazy?

#70
A language like Python or Ruby gets you ease of coding and a moderate level of safety; a language like C gets you speed but at a high safety risk.

Haskell could get you often similar speed benefits, and there are even a couple of rather interesting frameworks for it (with even things like compile-time template checking), but the barrier for entry is unfortunately high.

Thus a language like Rust really comes into its own: speed kin to C with safety significantly exceeding that of Python and Ruby. Users of Python and Ruby may find the parts of its type system which must be specified explicitly arduous, but it does make it ever so much more likely that code that you write just works, correctly, which (as primarily a Python developer) I have found marvellous.

Rust isn't there yet for web development, but solid support for the HTTP layer is well in progress: https://github.com/chris-morgan/rust-http. When that's far enough along, then I'll get on to the framework I have in mind.

Post reply on HN