4 ms·
I appreciate side effect programming, but I really think the java criticism is unwarranted. The first thing I think of is: "How do you do a CRUD app in your fun
by ibsulon 18y ago
I appreciate side effect programming, but I really think the java criticism is unwarranted. The first thing I think of is: "How do you do a CRUD app in your functional language?"
I enjoyed ML when we were doing it in school. However, I've only worked on one application that could be translated easily to the functional paradigm. The rest have parts that would be well suited to functional programming, but the rest of the program is one giant side effect. Monads aren't the answer there, they're a workaround.
- joe_the_user 18y agoA LOT of "ordinary programming" is moving some messy bits of information from one place to another, taking into account some messy cases and occasionally putting information into a third, messy place. This kind of programming has little mathematical content and little similarity to the canonical factorial example that every functional programming language LOVES to give. Here, functional programming seems to lose its elegant minimalism. Indeed, when you have a bunch of arbitrary, (meaning random) cases and conditions, no language can make your code elegant and minimal since your code must contain the information in the cases and random information is incompressible. I mean, how would you write a WIN32 GUI in a functional language? Show me otherwise but I haven't seen the good argument for functional programming languages as general purpose languages and so the folks dumping Java don't really seem very much better.
- jrockway 18y agoI mean, how would you write a WIN32 GUI in a functional language? Just like you would in any other language? Functional programming is not different from any other type of programming. It makes some things easier, but other things are about the same. I think a GUI app would be easier in, say, Haskell, than Java, for a number of reasons. The lack of global state will make threading easy, which keeps the GUI responsive. Abstractions like functional reactive programming will make the app's implementation cleaner. Finally, if you do it right, most of your app won't depend on the GUI, and will be very easy to test. (You can do that last one in any language, of course.) Assuming your application does something useful, implementing the algorithmically complex part will be simpler as well. Anyway, you can't understand the advantages of functional programming from reading some comments on a social news site. You actually need to try writing the application -- then you can see exactly what the benefits are, and whether or not you care about them. If you don't want to invest any effort in learning, well, that's another issue entirely. (And is really the reason why many people don't all switch to Haskell. Learning something new is scary!)
- gamache 18y agoI mean, how would you write a WIN32 GUI in a functional language? F# seems like a good choice.
- jrockway 18y agoHow do you do a CRUD app in your functional language? I'm not going to give you a long tutorial on this, but it's not hard. You write it like you would anything else. You have some data that you want to manipulate. You define some way to store, edit, and retrieve that data. (Libraries can handle this for you.) Then, you make the web UI like you would in any other language. At the top is a function that takes a request and returns a response, which is entirely pure. Then you implement the helper functions as needed; Map URIs to handlers, map request parameters to data to interact with, interact with the data, generate a response, etc. Anyway, it is not that different from anything else. Why would it be? the rest of the program is one giant side effect. Monads aren't the answer there, they're a workaround. You are thinking about the problem wrong.