3 ms·
> This is like 99% of web development today. You've claimed this several times now and I fundamentally disagree. In my 11 years of experience working across so
by Tainnor 2y ago
> This is like 99% of web development today.
You've claimed this several times now and I fundamentally disagree. In my 11 years of experience working across some 7 companies, web development has always been more than just 99% side effects. Obviously your experiences may be different, but this generalisation is silly.
- ninetyninenine 2y agoMy 15 years of experience web development, gaming, embedded systems, and High performance computation has always been 99% side effects for web development exclusively. 99 is an exaggeration but it is not far off. For web it's more like 70 to 80. My point is, it's the overwhelming majority and anyone who is smart and experienced would know this. There are few places where functional can really be the entire stack and unfortunately those in those places the technological ecosystem surrounding those areas are just not well equipped for FP for historical reasons. For example CUDA in HPC or AI. It's a very functional process of inputs and outputs. Or gaming, which is also very CPU and graphic intensive. Both are great candidates for FP, but the ecosystem surrounding them is focused on C++. Web is the opposite. It's literally a style of meta programming. Your web server is stateless. It mostly just does authentication and functions as a thin security and routing layer. You are creating a program that takes a route path and translates it into ANOTHER high level language that's used against a database and that's web in a nutshell. That database is doing most of the work in your system. That is the main thing you are programming. So you write server programs that write programs for databases and those servers spend 20% of their time constructing strings in the query language and 80% of the time waiting for the query to complete. Your database is doing all the computation and the server just waits on it. Why else do you think we don't use rust or C++ for servers? Why can we use a slow ass language like python to do server work? Because the database is the one doing all the work and the servers are just waiting. If you're going purely stateless with no db, the only thing I can think of in web is chat. But then chat is very IO based which is also not suited for FP. I guess Big data number crunching streams can be thought of as "functional" but those things don't really make up the majority of web either. Maybe video streaming? I feel decoding videos is very library based to be honest. >Obviously your experiences may be different, but this generalization is silly. No the only thing silly here is your opinion. I doubt our experiences are that different. In fact I'm willing to bet, if you lay out your experience you'll see it's almost entirely as I said. Servers are meta programmers weaving code in a query language that is forwarding computations to databases which are inherently mutating and IO by definition. All your servers do is just wait for external databases to finish and databases are the engines that drive the web. Databases are mutating IO freaks of nature which makes them not amenable to FP and as a consequence most of web is not amenable to FP either. You can have any constellation of micro service architecture it doesn't matter. If you forward a call to a server, and that server forwards a call to another server and all those servers are in the end waiting on something that does the actual computations. Usually a database. I know this because I've worked on things where functional programming is almost 99% applicable even on the smallest scales. Basically if you're programming the computation itself. Intensive high CPU, and high GPU computations which is more rare in web. You'll see for these applications most of your code is a giant composition of pure functions. It becomes so modular that it's almost like legos if you try to follow the FP paradigm in this arena. It just sucks that it's mostly C++, though rust is making big moves in this area. You'll basically never encounter HPC in web. But you would know this if you had the experience you claim to have. And you would know that at the macro scale, web is not functional... It's imperative and mutation based.
- Tainnor 2y ago> In fact I'm willing to bet, if you lay out your experience you'll see it's almost entirely as I said. I don't know how to respond to something like that. You can trust me that I know and understand my own experience better than you do.
- ninetyninenine 2y agoEasy. No one knows this but In science and therefore reality proof is impossible. Proof is the domain of mathematics and logic. But disproof is possible in reality. It can be done by a single counter example. So if I’m wrong about your experience. Why don’t you lay out a single example in web development in your experience where what I said is utterly incorrect because I literally cannot even imagine a counter example. One counter example is all it takes to disprove my “bet”. Even better if the example is extremely common. But this is up to you to you decide if you want to debate this. I’m certainly willing to tell you about my entire experience and all I’m asking for is a single counter example from you.
- Tainnor 2y ago* Take a complicated tree structure representing a document management system and transform it into some different tree structure, e.g. by filtering out elements or fields due to missing permissions, or by rewriting it in the way that the elasticsearch index expects it, or a bunch of other reasons. * Generate a TOC of an HTML document by parsing all the header elements. More generally, anything that's related to parsing (something which I've had to do several times). * Run a complex (> 50 LOC) validation on some user input. * Generate a word document or PDF. Conversely, parse a word document or PDF. * Financial computations, such as calculating totals of an order made up of multiple line items with discounts, taxes, additional charges, etc. (I'm purposely leaving out more non-standard applications, such as pre-LLM chatbots, or an entire mathematical problem solver that doesn't even use a database, but just so you know, they exist too.) There's also the much more immediate counterpoint that it's of course possible to write web applications in Haskell (or OCaml, Scala, ...), otherwise all these frameworks wouldn't exist.