Live data from Hacker News

Web development in C: Crazy?

medium.com

71–80 of 213 posts

Re: Web development in C: Crazy?

#72
post #68

Earlier quoted context omitted.

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), almo…

Not only that but the scale of Google drives decisions that may not make sense for the rest of us.

Re: Web development in C: Crazy?

#74
post #5

So, people can't hardly write safe web apps in PHP without spraying XSS and auth bypasses and arbitrary shell executions and arbitrary SQL injections everywhere, and you also want to hand the attackers the ability to segfault your server or possibly even straight-up run arbitrary code? Anyone smart enough to truly safely code a website in C is smart enough to learn a language to create that website which doesn't get…

This makes me wonder, are there any decent (military grade?) web frameworks for Ada?

Are you aware of Ada Web Server (AWS)?

http://www.adacore.com/adaanswers/gems/gem-29/

Re: Web development in C: Crazy?

#76
Reasons not to use C for web dev: 1. Maintenance costs will go through the roof with C. C developers are not cheap, and most people who use C have are not web developers. 2. Hiring will be exceptionally painful. Again, most C devs are not web devs. Put another way, most web devs use other languages. 3. Some C developers are so good that very few people can understand their code (Linus talks about this, and I've seen it happen at a prior company)

By way of personal experience, in '99 we had an outstanding developer who was a rock star in C. When he left, I remember sitting in a meeting when an A+ developer (he really was good) was asked by the VP Eng, "Can you support his code". The response, "No". VP Eng: "Why is it not commented?". Response, "It's commented. In fact it's the best code I have ever seen. But I cannot support it, it's amazing, but its way beyond my skill level."

I have never seen a repeat of this experience in a 4th gen language. I'm sure it can/may happen, but have not yet.

Re: Web development in C: Crazy?

#77
post #59

Earlier quoted context omitted.

I don't see it as a talent filter proxy. More of a "Does this company understand what it is getting into and therefore what it needs" proxy. e.g. You run a skyscraper building company. If you see job ads for competitors with things like "must have excellent woodworking knowledge" you are probably less worried than those with "must have excellent metallurgy knowledge".

> I don't see it as a talent filter proxy. That's fine. I was characterizing how pg was using it. > Does this company understand what it is getting into and therefore what it needs? I think it is actually a much poorer proxy for that. Maybe if they are a small company or don't have any engineers, that would make sense. As a company gets larger, job descriptions start to represent very small, specific parts of what a…

Ah I considered the second bit in the historical context.

The poly-lingual software related company seems to be a more modern trend IMO. At the time PG is referring to I would have been very surprised to see that going on in the web industry.

Re: Web development in C: Crazy?

#78
I don't want to start a language war here but as a phd student working on distributed systems, choice for "C" as a language for developing high throughput web applications has some rationale. For instance, when you read most of the articles in HS.com or C10K at least, web development at large-scale requires every performance bit out of machine. Indeed, some -caugh-google-caugh- still use C++ at backend (even not in the frontend) or we see twitter switched to JVM from RoR for performance.

For regular earthlings, RoR, Py, PHP and alike are still more feasible than C for "getting the job done".

But the article's point of view is a bit shallow in that sense, since it's looking a way of replacing conventional frameworks (RoR etc.) for C. If you gonna develop a high-perf application in C, you probably use more wide variety of specialized libraries for focused tasks(like json processing, I18N, handling SSL, developing nginx/HAproxy modules,extensions for load balancing, etc.) rather than using a single "C framework".

Re: Web development in C: Crazy?

#79

I've done a number of projects that were web-oriented in C and C++ over the years, and they are by no means my primary language. It wasn't that bad, especially if you take the time to learn how to do string manipulation properly (which isn't really that hard). Come to think of it, even though we consider C to be "low level", that's really only a temporary problem that solves itself the longer you work with it and the…

> It wasn't that bad, especially if you take the time to learn how to do string manipulation properly (which isn't really that hard).

It's hard in the way that counts: It's tedious and prone to precisely the kinds of errors humans make when a task is tedious. Worse, string manipulation is precisely where all of the potentially dangerous bugs can live in the average C program, especially if you're accepting data from untrusted sources.

> Come to think of it, even though we consider C to be "low level", that's really only a temporary problem that solves itself the longer you work with it and the more you build with it.

Aside from the fact you can say the same about assembly, this is another reason to disfavor C: Reinventing the wheel. Over and over again.

I say all this as someone who actually likes C, and even somewhat enjoys doing string processing in C. I even know about strstr(3), which never seems to get mentioned. The main thing I know, however, is that it isn't worth it unless you live in a contrived circumstance.

Yes, you can go really fast by strapping yourself to that rocket, and if you remove the helmet you'll reduce your weight and go even faster. Nobody's doubting you. However, very few people want to stand downrange of you.

Re: Web development in C: Crazy?

#80
post #20
post #5

So, people can't hardly write safe web apps in PHP without spraying XSS and auth bypasses and arbitrary shell executions and arbitrary SQL injections everywhere, and you also want to hand the attackers the ability to segfault your server or possibly even straight-up run arbitrary code? Anyone smart enough to truly safely code a website in C is smart enough to learn a language to create that website which doesn't get…

I once wrote a website (a search engine for a specific set of websites) in C. It actually worked, once I spend 20 hours in valgrind. I've grown since then, in two important ways. First, I'd probably do a better job now, and not have to spend any time in valgrind at all (I still use C quite frequently). Second, I'd never, ever, try to pull that stunt again.

> It actually worked, once I spend 20 hours in valgrind

Thia is exactly the main problem with C.

You need to rely on tolling outside the language to be able to write safer code.

While languages like Ada and Modula-2 and their descendents, offer the same hardware capabilities as C with stronger type checking.

Post reply on HN