How I Learned to Stop Worrying and Love the State Machine
“Any sufficiently complicated model class contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of a state machine.”–former colleague 1
Reg was always my ‘secret weapon’ for getting a new initiative off the ground. He understood our code and our product and what it was capable of, and he understood our customers and their needs.
Visit raganwald.com → RSS feedOn Hacker News Apr 2013 – May 2023
Software Engineering 15Math & Algorithms 4Programming Languages 4Career & Management 2Tech Industry & Business 1
“Any sufficiently complicated model class contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of a state machine.”–former colleague 1
In this essay, we are going to look at recursive algorithms, and how sometimes, we can organize an algorithm so that it resembles the data structure it manipulates, and organize a data structure so that it resembles the algorithms that manipulate it.
In theory , JavaScript does not have classes. In practice , the following snippet of code is widely considered to be an example of a “class” in JavaScript:
In computing, “laziness” is a broad term, generally referring to not doing any work unless you need it. Whereas its opposite is “eagerness,” doing as much work as possible in case you need it later.
In this essay, after a brief review of the work we’ve already done on the Mockingbird, we’ll derive the Why Bird, known most famously as the Y Combinator . The why bird provides all the benefits of the mockingbird, but allows us to write more idiomatic JavaScript. We’ll see that one of the benefits of writing…
“Proud to say I work with a team of developers who value explicit code over clever code”– Michael R. Bernstein
“The Carpenter” was a JavaScript programmer, well-known for a meticulous attention to detail and love for hand-crafted, exquisitely joined code. The Carpenter normally worked through personal referrals, but from time to time a recruiter would slip through his screen. One such recruiter was Bob Plissken. Bob was…
A trampoline is a loop that iteratively invokes thunk -returning functions ( continuation-passing style ). A single trampoline is sufficient to express all control transfers of a program; a program so expressed is trampolined, or in trampolined style; converting a program to trampolined style is trampolining…
Very roughly speaking, functional programming (“FP”) and object-oriented programming (“OOP”) have similar levels of expressive power and similar abilities to encapsulate programs into smaller parts that can be combined and recombined.
As discussed in Pattern Matching and Recursion , a well-known programming puzzle is to write a function that determines whether a string of parentheses is “balanced,” i.e. each opening parenthesis has a corresponding closing parenthesis, and the parentheses are properly nested.
In “ How I Learned to Stop Worrying and ❤️ the State Machine ,” we built an extremely basic state machine to model a bank account.
Arrays are JavaScript’s “native” representation of lists. Lists are important because they represent ordered collections of things, and ordered collections are a fundamental abstraction for making sense of reality.
This essay discusses how to separate JavaScript domain properties from object behaviour, without prototypes . This is deliberate. By examining four basic ways to have one object define the behaviour of other objects, we gain insight into what we’re trying to accomplish at a very basic level.
As many people have pointed out, if you turn your head sideways and squint, the following JavaScript can be considered a “class:”