Showing posts with label functional. Show all posts
Showing posts with label functional. Show all posts

23 May 2013

A Short Survey on the State of Functional Reactive Programming in ClojureScript

In the Object-Oriented world of JavaScript, architectures like MVP, MVC, and their brethren are well established. But when I started using ClojureScript to build rich user interfaces on the web, I was naturally interested in finding ways to architect my site that are friendly to a functional programming language like Clojure. This led me to functional reactive programming, or FRP.

FRP, probably the best-known user interface paradigm for functional programming, models UIs as dataflows, where changes (user actions or data source changes) propagate through the system using purely functional operations and eventually end up as visual changes back in the UI. In short, FRP is similar to how changes to a cell in a spreadsheet propagate to other dependent cells.

Though the ClojureScript ecosystem is still fairly immature (or perhaps because it is), there are many libraries which support the FRP style of programming. If you are looking for an alternative to faking object-oriented styles of programming in ClojureScript, jump in and give one or more a try!

(By the way, if you want my personal recommendation, I have had a lot of luck with the simplicity and power of widje.)

Native ClojureScript libraries

acute (wrapper around AngularJS)
rx-cljs (wrapper around RxJS)
Yolk (wrapper around Bacon.js)
Clang (wrapper around AngularJS)

Using JavaScript libraries directly

30 November 2011

Non-Locking Concurrency Control

At work this week I have been working on implementing a concurrency control strategy on a system. During the discussions, software transactional memory (STM) came up, as we want to develop a solution that does not involve locking, and since my primary experience with it is Clojure's built-in STM, I brought that up.

The world seems to be helping out today with a link on Hacker News to an old discussion involving Clojure's creator Rich Hickey: Clojure: STMs vs Locks. Good food for thought.

It is great to see that my Clojure knowledge is proving to be surprisingly useful at work. Those years of being a closeted functional programming nerd are paying off!

I also re-watched Rich Hickey's talk "Are We There Yet?" and reread "Equal Rights for Functional Objects" by Henry G. Baker, which are both great resources for really thinking about state in a functional manner.

11 May 2011

Mirror of the Joy Programming Language

I have been working on a pet project recently which was greatly inspired by fascinating little programming language called Joy. If you can, imagine combining Scheme with Forth, and that is basically what Joy is. It is a wonder of minimal, yet functional, programming language design, and a mind-bender to boot.

In any case, a couple of days ago, the original homepage for Joy went down. Considering that the language was created by a retired professor and maintained at his old university, there are any number of reasons why it went down, and seems likely never to come back again. With the hope that this language will not disappear from the web, I have mirrored the complete contents of the original Joy programming language homepage on my personal site.

16 December 2008

Industrial Strength Application Development in JavaScript

Inspired by the work of Douglas Crockford, I have been developing a JavaScript application using full blown development techniques. JavaScript is definitely a misunderstood and underestimated programming language, and I have found it to be a pretty good hybrid of object-oriented and functional techniques. I have even done some cool things with it that would not be possible in a statically typed language. I have found that with proper unit testing and debugging tools, its dynamic typing has caused me few problems.

So what tools can I recommend for industrial development in JavaScript? Everything below is an absolute must for my needs:

jQuery
  • What it does: Ajax, DOM-modification, and general utility functions
  • As Jeff Atwood pointed out, there is no good reason to write low-level JavaScript to manipulate the DOM with today, now that there are tons of high quality JavaScript libraries to help out.
QUnit
  • What it does: Simple unit testing, compatible with jQuery
  • I tried out a few other unit testing frameworks, but QUnit is the simplest one by far and just gets the job done.
JavaScript Lint
  • What it does: Identifies most textual errors in JavaScript files.
  • Indispensable tool to find that missing semicolon that is causing that weird error.
  • Note for TextMate users: Use the JavaScript Tools bundle instead of downloading it from the official site.
Firebug
  • What it does: Firefox plugin. In addition to excellent DOM manipulation, it makes a great JavaScript debugger.
In Addition, Mozilla's JavaScript Reference is a must for any serious JavaScript developer.

Well, I hope this gets you started. If you have any other suggestions, let me know!

07 November 2008

F# and Functional Language Respect

I have been experimenting with Microsoft's F# language, their version of ML / OCaml for the .NET Framework. Microsoft recently announced that F# will become an official part of Visual Studio, up there with C# and Visual Basic. I had never really used an ML-based language before, so I was not sure how big the learning curve would be, but I find that my knowledge of Haskell gets me far enough to feel comfortable writing simple programs after looking over the documentation for a few minutes. On top of that, the current pre-release version of F# has near perfect integration with Visual Studio, including an interactive REPL, debugging, and syntax completion. If you are in the market for a good functional language and are in the Microsoft developer ecosystem, F# seems like a great choice.

I'm not sure how much I will use F# at work, if at all, but it is good to see that functional languages are being taken very seriously at Microsoft now. Not only are the developments of F# encouraging, but each new version of C# adds more functional features, and I find myself using those features daily in my work.

Recommended Sites:

24 May 2007

Functional Languages on the Horizon

The usefulness of functional languages is really starting to go mainstream now. In the past, I've learned Haskell, Scheme, and Ruby, and I'm studying Scheme again now. Trying to learn every technology is impossible so I'm going to stick with Scheme right now because of the great books that are available for learning it.

Practical reasons for learning some functional languages:

Scala
Haskell
Scheme/Lisp
  • Great books: "Lisp in Small Pieces", "The Scheme Programming Language" (by Kent Dybvig), and "The Structure and Interpretation of Computer Programs".
  • Good, cross-platform IDE: DrScheme
  • Ability to leverage knowledge for Arc (Paul Graham's language which will almost certainly have a large following due to his popularity)