Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UI based on functional programming

Tags:

I am learning functional programming concepts now a days, and professionally I am an Asp.net developer. But asp.net makes you to change properties of objects too often in code behind. Functional programming is based on immutable objects. And apply this concept to change the value of a textbox will be very painful. Also in some event handlers like FormView's ItemInserted arguments are made available to the developer like KeepInInsertMode which developer can change to true/false, and in this case we are modifying the input arguments which is against the FP. Your thoughts frnds. Which is the correct way of UI handling in software world ? FP or OOPS.

like image 663
pokrate Avatar asked Jul 24 '09 14:07

pokrate


1 Answers

You ask for the "correct" way, but this is an engineering problem, not a mathematical problem. There are trade-offs, some form of taste comes into play, and it is unlikely that there is a one-size fits all perfect solution.

Also, just because asp.net does something in a certain way, does this mean that all OO frameworks have made the same design decisions. Have a look at Ruby on Rails, or the Smalltalk Seaside web framework for a different, but still OO approach. Even ASP.net MVC for example takes a somewhat different approach than vanilla ASP.net.

The same is true for FP frameworks for UI handling, with the additional caveat that they currently seem to be more experimental - i.e. I don't think all the design options have been explored as much as for OO frameworks. If you want to have a look, I recommend looking into functional reactive programming (mostly for interactive animations), Links (academic - has aspects in common with LINQ), or LiveLab's reactive framework - each emphasizing a different aspect of the problem.

There is much to learn here, the most important thing probably that there is no easy answer...

like image 73
Kurt Schelfthout Avatar answered Oct 11 '22 11:10

Kurt Schelfthout