5 ms·
CGI in C (well, not CGI itself, but web apps) is super annoying. I spent 3 months writing web apps in C, took forever. There's a lot of convenient web app stuff
by throwawaaarrgh 3y ago
CGI in C (well, not CGI itself, but web apps) is super annoying. I spent 3 months writing web apps in C, took forever. There's a lot of convenient web app stuff in other languages that C doesn't make easy. Do not recommend.
- giantrobot 3y agoSeemingly a million years ago I tried making a CGI application in C. It was a complete pain in the ass. I'm no C wizard (and was even further from that 25 years ago) but it was just an awful experience. Not only did it take me an inordinate amount of time to write it had memory management issues and inexplicable crashes. Total shit show and a waste of time. I redid the whole project in a weekend in Perl and it was not only a better development experience but worked more reliably and was all around better. I miss CGI for developing web apps. It's straightforward and can easily (or at least in a straightforward way) be tested the same as a CLI tool. A lot of the problems were my deficiencies in C and just general inexperience. I'm sure today there's a lot of nice CGI helper libraries that would make the process a lot easier. I also have a lot more experience in C so I'm confident I'd just do a better job writing such an app. I have no interest in it though. I'd rather "waste" cycles in a higher level language and solve problems in the domain rather than the tooling. But more power to the crazy diamonds writing web apps in C.
- marcus0x62 3y agoOnce, I somehow got roped into writing a CGI application in C that I was supposed to write and test on a Linux system but that was going to run on a SunOS 4 system that I had no access to. That was...fun.
- giantrobot 3y agoI see many 500 errors in your past.
- marcus0x62 3y agoOnly after all the compile-time errors. The development process, such as it was, involved me writing and testing some part the program, then emailing it to someone (who had access to the sunos box) who would try to compile/run the program and who would email me back any errors, often several hours later. I recall imagining that what I was experiencing must have been similar to what early programmers submitting batch jobs went through. 0/10. Do not recommend.
- sitkack 3y agoYou should have made your first test program take a post request with the URL of the actual binary to run and have it fork-exec that. Now you have a "testing" service. :)
- gloryjulio 3y agoI agree. In no situation that I would use C for webapp. Just use some framework like Rails or Django, or use Spring Boot or Go if you really want performance It's a nice practice I guess
- lenerdenator 3y agothis particular stack - bchs - sounds great in a world where the following never happened: 1) transistor density and memory cost never advanced past what they were in 2000 2) no one ever took the Linux kernel project seriously Your second to last sentence validates this: Cycles are computing power, and power is cheap. It gets cheaper every day. The person who can write flawless C code, including the boilerplate, is expensive.
- binary132 3y agoAt scale a few % efficiency can make a big difference.
- giantrobot 3y agoAt the scale where the savings is meaningful, like millions of dollars meaningful, you should be able to afford a million dollars of efficiency refactors. You need to make a product that is fast/efficient enough to do the job. It needs to be delivered on a schedule that is probably really stupid from an engineering point of view. Efficiency can be patched over by throwing extra resources at the problem (up to a point). Functionality and market timing can't be patched over in the same way. I think it makes sense to throw resources at inefficient code to get yourself into a position where that efficiency has a meaningful consequence. Customers aren't buying your product/service based on the number of instructions or memory used to do a task.
- binary132 3y agoI’m not taking an issue with “prioritize time to market”. I’m taking an issue with “processor cycles and memory are actually meaningless now compared to engineering hours”. That is simply not always true.
- kikorin 3y ago[dead]
- alberth 3y agoWasn’t Amazon.com a massive C web app for a surprisingly long time.
- onlyrealcuzzo 3y agoThe majority of all of the code is likely still C. The "web framework" might have changed - but it's not like that's the majority of Amazon.com
- wvh 3y agoDidn't they run Mason and Perl at some point?
- sitkack 3y agoI think it was C++ and Perl in the early 2000s, afaik.