code

함수형 프로그래밍은 웹 개발과 관련이 있습니까?

codestyles 2020. 9. 16. 07:43
반응형

함수형 프로그래밍은 웹 개발과 관련이 있습니까?


최근에 함수형 프로그래밍에 대해 많이 보았고 Clojure가 특히 흥미로워 보입니다. 그것이 무엇인지에 대한 기본 설명을 '이해'하고 있지만, 가능하다면 웹 개발자로서 매일 어떻게 사용하는지 알 수 없습니다. 내가 읽은 많은 내용은 일반 OO에서 볼 수있는 일반적인 프로그래밍 상황보다는 함수형 프로그래밍의 수학 측면에 초점을 맞추고 있습니다.

스틱의 끝 부분이 잘못 되었나요? 함수형 프로그래밍은 웹 개발과 전혀 관련이 없습니까? 그렇지 않다면 '웹용'으로 사용되는 예가 있습니까?


내 머릿속에서 몇 가지 예 :

  • 야후! Store는 Lisp에서 제공합니다 (원래는 인수 전에 Viaweb으로 명명 됨 ).
  • Reddit2005 년 에 Python 으로 전환 했지만 Lisp에서 완전히 프로토 타입 화되었습니다.
  • Hacker News 는 전적으로 Arc (Lisp 방언)로 작성되었습니다.

함수형 프로그래밍은 웹 앱과 매우 잘 어울립니다. 웹 앱은 HTTP 요청을 받고 HTML 결과를 생성합니다. 이것은 요청에서 페이지로의 기능으로 간주 될 수 있습니다.

일반적으로 장기 실행 프로세스, 상태 저장 UI 및 여러 방향의 데이터 흐름이있는 데스크톱 앱과 비교해보십시오. 이는 상태 및 메시지 전달이있는 객체에 관심이있는 OO에 더 적합합니다.


표준을 준수하는 HTML을 브라우저에 제공하는 한 브라우저는 기능적 언어, 명령형 언어 또는 훈련 된 원숭이가 무엇이든 상관하지 않습니다.


순수 함수형 프로그래밍은 웹 프로그래밍 환경에 잘 매핑되지 않을 수 있습니다. 그러나 주요 장애는 인프라 (프레임 워크 및 API)의 부족입니다. 기능적 언어가 Java, Python 또는 Ruby와 같이 풍부한 웹 프로그래밍 환경을 갖기까지는 오랜 시간이 걸릴 것입니다 (정직하지 않을 것입니다).

즉, 몇 가지 옵션이 있습니다.

나는 이것들에 대한 경험이 없습니다. 댓글 작성자는 자신에게 잘 맞는 것이 무엇인지 평가할 수 있습니다.


Twitter는 객체 지향 및 기능 패러다임을 모두 지원하는 JVM 언어 인 Scala로 백엔드를 다시 작성했습니다 .

또한 Lift 웹 프레임 워크는 Scala로 작성되었습니다.


Clojure에게는 Clojure와 Google App Engine을 사용하여 개발 한 흥미로운 스타트 업 (TheDeadline)이 있습니다. 그들은 Slideshare에 대한 좋은 ppt와 InfoQ에 대한 인터뷰를 가지고 있습니다.

GAE를 사용한 Clojure 배포에 대한 좋은 토론 : http://news.ycombinator.com/item?id=1239788

내가 아는 한 Clojure에는 몇 가지 웹 개발 라이브러리가 있습니다. Compojure Ring Conjure

이것이 당신의 질문에 답하기를 바랍니다 =) (저도 시작하고 있습니다 ..)

베스트, 라이언


웹 개발과는 전혀 관련이 없습니다. 서버에있는 앱은 클로저, 고차 함수, 불변성, 참조 투명성과 같은 기능적 기능을 매우 잘 활용할 수 있습니다. 예를 들어 어떤 방식 으로든 변형하거나 조작해야하는 컬렉션이 있습니다. 함수형 프로그래밍은 여기서 도움이되며, 그 관용구가 주류 언어에 침투하고 있기 때문입니다. 기능적 기능은 간결성, 테스트 가능성, 병렬화에 도움이되며 패턴으로 해결할 수있는 문제에 대한 기본 솔루션을 제공 할 수도 있습니다.

업데이트 : 기능 언어에 대한 웹 프레임 워크도 있습니다. Common Lisp 용 Weblocks, Scala 용 Lift. 이것들은 내가 들어 본 것들이고, 더 많은 것이있을 수 있습니다 ...하지만 반드시 순수하게 기능 할 필요는 없습니다. 예를 들어 Scala는 순수하지 않으며 모든 Java 프레임 워크에서 작동해야하지만 여전히 가능합니다. 비즈니스 계층 등에 함수형 프로그래밍을 사용합니다.


Ur / Web을 확인하십시오 . 매우 빠르고 정적 유형 시스템은 HTML 및 SQL과 같은 것에 대해 알고 있으므로 보안에 대한 모든 종류의 좋은 것을 보장 할 수 있습니다.


Erlang은 확장 가능한 웹 앱의 일부 인프라에서 많이 사용되고있는 것 같습니다. CouchDB 및 Riak 데이터베이스는 RabbitMQ 메시지 대기열 서버와 마찬가지로 대부분 Erlang으로 작성됩니다. 성공의 열쇠 중 하나는 공유 된 변경 가능 상태없이 메시지 전달을 통해 동시성을 처리한다는 것입니다. 이것은 특정 함수형 프로그래밍 언어보다 유용한 문제에 대해 생각하는 방식입니다.

또는 MapReduce를 살펴보십시오. 맵 및 축소 함수가 내부적으로 상태 저장이 되더라도 계산을 보는 매우 기능적인 방법이며, 이러한 이유로 내결함성, 분산 방식으로 대규모 데이터 세트를 쿼리하는 데 매우 적합합니다.

꼭 가장 실용적인 것으로 보이는 것을 선택하십시오. 그러나 함수형 프로그래밍은 언제 유용할지 결코 알 수 없기 때문에 항상 염두에 두십시오.


그들은 Edinburgh University 에서 웹을위한 함수형 프로그래밍으로 꽤 멋진 일 을하고 있습니다.


언어와 패러다임은 웹 앱에서 중요하지 않으며 모두 똑같이 좋고 나쁩니다. 새로운 패러다임을 배워야 할 이유를 찾고 있다면 바로 들어가십시오. 제 조언은 해결하려는 문제를 분석하고 적절한 도구 세트를 선택하는 것입니다.


자바 스크립트 (웹의 FE 부분의 언어 및 점점 더 BE로 사용되는 언어)는 그 자체로 작동하지 않지만 기능은 1 차 기능입니다.


백엔드가 완전히 Erlang으로 작성된 온라인 스프레드 시트를 방금 시작했습니다.

http://hypernumbers.com

어떤 표준에서든 이것은 정신적 복잡성을 지닌 거대한 GUI로 구축 할 수있는 가장 복잡한 웹 앱 중 하나입니다.


다음은 Haskell을 사용하여 웹 앱을 빌드하는 웹 개발자 경험입니다 . 함수형 언어는 매우 형식이 안전하고 동시성이 우수하지만, 오랫동안 학계에서 사랑을 받아 왔지만 현실 세계에서 강력하게 수용되지 않았기 때문에 항상 최고의 API가 부족했습니다. 너무 멀지 않았 으면 좋겠어요. Erlang은 이미 그것에 참여했습니다.


함수형 프로그래밍이 웹 프로그래밍에서 인기있는 이유는 공유되고 변경되는 상태를 명시하고 프로그래머가 순수하게 기능하는 부분을 순수 함수로 표현할 수 있기 때문입니다. 순수 함수는 부작용이 없기 때문에 병렬 실행이 매우 간단하다는 장점이 있습니다.

적어도 그게 내 이유입니다.


Another short answer: http://www.mlstate.com -- a full web development platform, based on FP. The clean semantics of the language permit all sorts of automated safety and security analysis, optimizations, etc.

Caveat: I work there.


Functional languages may not be directly useful for building great apps but we use functional programming paradigm heavily for building our Apps. Pure functional programming puts the constraint of "no side effects". This ensures that pure functional calls will yield same result in what ever order they are called. This is not ideal for web-development but if functional programming is combined with a state-changing system, a robust web app can be built. Have a look at my paper for more details: FAST Server Also these slides.


Yes, as functional programming can be done in any language, you can use it as a web developeron a day to day basis.

Should you? it depends upon the problem you are solving. Functional programming is a programming paradigm and where you should use it depends upon the problem you are solving.

To make the decision simpler, think whether it is easier to solve some problem by using OOPs concepts, where encapsulation, polymorphism, inheritance like features can make your life easier?

If yes, do not go for functional programming there and simply use OOPs. If your application is going to perform complex computation / calculation / business logic and involving heavily concurrent processing, Functional programming can offer lots of tools and advantages in such cases.

These are just different styles of building the structure and elements of programs, so it’s all about using right tool for the right job.rest anything can be done using anything.

Functional programming in web development:

JavaScript supports functional programming and it is very much supportive when we are in context of web development.React framework is heavily influenced by functional programming principles and used in many web applications out there.

Also, you can find many web applications built and running with frameworks developed on functional programming languages listed below:

• WebSharper (F#)

• Snap (Haskell)

• Lift (Scala)

• Ocsigen (OCaml)

• Chicago Boss, Zotonic (erLang)

Hope So my answer will help anyone.


You probably won't use it and shouldn't use it but when you say that someone will always find an exception to the rule (Viaweb, etc.). Basically there is no "super language" there are only working lines of code, usually in "Blub." Even Paul Graham says that the main (in fact only) benefit to a Lisp is one's ability to rapidly prototype.

Also "super languages" usually impinge rather than increase code readability, meaning that the one "genius" who wrote it has to maintain it forever since no one else can understand it, especially since he is likely to write it in his own modified dialect. This decreases the possible scope of any project, which means that even if new, innovative things can be done, they are not extensible and so remain at a relatively small scale (like Hacker News in Arc).

That's not to say that someone can't have a genius idea and implement it in a incomprehensible style that then can be re-written in Blub and extended so that lots of people can benefit from it. Actually, that's exactly what has happened in all of the Lisp success stories, not to mention every famous philosopher that's ever lived. But of course, if you are a "genius" you might also be able to prototype your product some other way.

As for FP on the JVM, there are limited but cool things possible. Although I would personally use it for prototyping only, it is possible you might have a use case (usually something to do with multi-threading) where it provides some improvement.

참고URL : https://stackoverflow.com/questions/292033/is-functional-programming-relevant-to-web-development

반응형