Reg Braithwaite (raganwald) writes about JavaScript, functional programming, combinators, and programming theory with practical examples.
Commenters praise how it mixes theory with application, and one calls him the only writer covering idiomatic, dynamic JavaScript patterns.
Jim Duey's blog post on the State Monad was helpful to me[1].
I agree that one shouldn't reach for monads just because one finds them interesting or neat, or challenging for that matter.
An analogy: consider that in many cases, `while` and `for` loops are great when looping is what's called for. But there are many times when recursion is more attractive still. But what to do if your language doesn't have TCO, and blowing the callstack is a real concern? Well, then you can use trampolines![2]
Now, trampolines are great, but you don't need to always reach for them. An analysis should be done of the problem at hand, and "the right tool chosen for the task", which may be a simple `while` loop. The same goes for monads. Are there cases where the State Monad makes the most sense among other programming patterns? Yes, I think so. Particularly, when you are trying to model a multi-step and nested-steps computation where the steps are intertwined in such a way that one can easily identify "global state" at work. In that case, the State Monad is a tool that will let you thread the global state through the steps and levels of computation without having to twist yourself into knots doing it some other way AND without relying on unfettered mutability.
[1] http://www.clojure.net/2012/02/10/State/
[2] http://raganwald.com/2013/03/28/trampolines-in-javascript.html
[&] http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/trampoline
Way back when Joel Spolsky was a high-profile blogger in the "starting your own software business" genre, I asked him for advice about my blogging, and he replied "Stop what you're doing and get your blog onto your own domain."
I had procrastinated because other platforms made everything so damn easy, and hosting my own blog meant being a part-time web admin. But I took his advice, and set up http://raganwald.com.
Some years after that, Posterous launched on HN, and I gave it a try. It was great, so very convenient! But I carefully kept copies of everything I posed there, and sure enough... One day it closed its doors, and I republished evrything on raganwald.com (some of my urls are raganwald.com/posterous/xxxxx.html, this is why).
But what about all the links to the old posterous articles? All dead, so some threads right here on HN point to dead URLs. This is bad for me and for HN. For this reason, I personally reject the strategy of posting on my own domain and republishing it simultaneously on some other platform. Everything I write is on a domain I control, and if I get less traffic, so be it. Running my own blog on my own low-traffic domain is like running a store in a building I own. The mall is very attractive, but I'm done with landlords.
p.s. There are hosted solutions that respect you your own domain. Some are free, like... Github Pages. And that's what I use. It is not essential that I own the server, just the…
> Programs are not designed to be readable, they are designed to solve a problem.
No. Code should be readable. When a code is fresh only you and God knows what it does and how it does. 6 month later, only God knows how your code works. You need to re-read and understand it to grasp it again.
Unless you marked all magic with big comments blocks or you wrote your code explicitly, it'll take some headache-inducing hours to re-understand it.
> The first goal is to get the correct program, and only after, it is important to make the code readable. A readable code that doesn't work is not worth much.
Again no. You can leave a non-working but readable code overnight and understand the problem tomorrow morning. You can't remember random noise after a good night's sleep (unrelated: This is why regex is hard for our brains).
Related read: http://raganwald.com/2013/04/02/explicit-versus-clever.html
Why over complicate it? FRACTRAN is a Turning complete language based on only one operation: multiplication. It's Wikipedia entry gives a short FRACTRAN program that finds all primes. https://en.wikipedia.org/wiki/FRACTRAN
In the words of it's inventor, John Conway:
Makes workday really easy! FRACTRAN needs no complicate programming manual. It's entire syntax can be learned in 10 seconds, and programs for quite complex and interesting functions can be written almost at once. The entire configuration of a FRACTRAN computer at any instant is a single integer - no messy "tapes" or other foreign concepts to be understood by the fledging programmer. What's not to like? This is a good introduction for someone seriously considering doing their next project in FRACTRAN: https://raganwald.com/2020/05/03/fractran.html
Overly complex algorithm questions (that the interviewer expects an immediate, near-optimal solution to -- even though they were open in the literature for several years before these solutions were found); or reasonably enough questions that just aren't articulated properly (this happens amazingly often); gratuitous brain teasers, or "Carnac the Magnificent"[1] question so any sort; or just the sheer duration of some of these one-way, "prove to me you aren't a liar or an idiot, while I play with my cellphone" sessions (6-8 hours over multiple visits); and then, quite often, dealing with the candidate in a desultory fashion afterwards -- all qualify as borderline hazing, in my book.
[1] https://raganwald.com/2015/05/08/carnac-the-magnificent.html
"Does anybody know a widely used and open source project using literate programming? (Edit: please include only programs expressed "as a web of ideas" that Knuth mentions - apparently otherwise it's not literate programming, just loads of inline documentation?)"
Funny you ask this, I ran across a @raganwald post mentioning a great example of ^literate programming^ (mixing code and documentation), "Literate CoffeeScript" [0]. You can read about how CoffeeScript does this at http://coffeescript.org
[0] blog post: http://raganwald.com/2013/03/27/literate-coffeescript.coffee.html
[1] raw text: https://raw.githubusercontent.com/raganwald/raganwald.github.com/master/_posts/2013-02-27-literate-coffeescript.litcoffee.md