TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Functionnal programming for UI?

4 pointsby yogsotothover 14 years ago
Hello,<p>I wanted to make a complete javascript web client. The standard usage with imperative language is to use the MVC pattern. I used object oriented programming but the javascript syntax for OOP was a really poor experience. I had the feeling that using a functionnal paradigm would had fitted better with js.<p>I know HN was done with Ark a functional programming language. So I wonder if an MVC pattern was done under the hood? May be there is a good recommendation or a known pattern that help making UI under a functional programming paradigm?

2 comments

demallienover 14 years ago
I'm not sure what your problem is with the "syntax for OOP". At any rate, I have just finished building an MVC framework for Javascript without any major difficulties. Perhaps you could share an example that has posed you problems?<p>One thing that I will say about functional programming and UIs is that they can be somewhat antithetical - to get good performance out of UIs, you often need to cache pre-computed results, which is just another way of saying that your code is going to have a boatload of state. Incidently, if anyone knows of a functional solution that overcomes this difficulty, I'd love to hear it.
评论 #2079416 未加载
评论 #2079309 未加载
jhuniover 14 years ago
Programming in a paradigm that your language is not made for is indeed a poor experience. JavaScript is not made for OOP or FP, it is made for prototype-based programming so if you want a good experience that is what you should use.<p>As for FP/MVC UI have you ever heard of tangible values? <a href="http://www.haskell.org/haskellwiki/TV" rel="nofollow">http://www.haskell.org/haskellwiki/TV</a>