RSSAmplifier

Blog

Nicholas Kariniemi

Source code for blog

blog.ndk.ioRSS feed ↗10 posts

Latest posts

Talk: JavaScript and Self Deception

JavaScript and Self-Deception: Why TypeScript is not enough JavaScript is often derided for callback hell and for quirks around equality, number handling, type coercions and the “this” keyword. This is largely a straw man argument. Developers work around these shortcomings through conventions, tools, and libraries and problems caused by these kinds of quirks come up infrequently. This talk instead…

Fear, trust and PureScript

In my previous post I argue that JavaScript is by default a low trust environment for programming, that ideas that build trust like optional typing, functional transformations, and immutability have severe trade-offs in JavaScript, and that choosing one of these ideas often means rejecting another. Despite that, JavaScript is a better environment than most popular languages for building trust, and…

Fear, trust and JavaScript

As developers, we want to reduce fear of our code failing and increase trust in our code working well. Many developers working with JavaScript borrow useful ideas from functional programming and strongly-typed programming languages to reduce fear by transferring trust from developers to tools and the code. Ideas like optional types, functional transformations, and immutability can all help to…

Refactoring 30000 lines of JS with types

30000 lines of client-side JavaScript. No tests. Two difficult TV deployment platforms with poor tooling. Strong dependencies on poorly documented external APIs. The task: add support for a third TV platform to the two supported platforms and switch to a new backend with a different API. How can we do this without breaking things? One approach is to add tests incrementally- end to end tests to…

Wrapping JavaScript for PureScript

How do I wrap a JavaScript API to use from PureScript? I had a chance to think about this while wrapping the Screeps game API so I could play Screeps using PureScript . Screeps is an MMO strategy game for programmers. You play by writing a JavaScript AI to control your minions. Everyone’s code runs 24/7 across hundreds of rooms in the same world. PureScript is a small strongly typed language that…

Why CSP matters II: How do I know sync works?

How does one know if their synchronization algorithm works? I have a real-time synced grocery list app. In the last post I attempted to scrape by on synchronization by implementing differential sync based on an intelligent-sounding paper. In the end my implementation had subtle bugs and was difficult to debug. I hoped to find a better approach to the problem using the CSP language. One challenge…

Why CSP matters I: Keeping things in sync

The core.async library is a well known library in the Clojure community for managing asynchronous programming. It is based on CSP or Communicating Sequential Processes, originally introduced by Tony Hoare in a 1978 paper . The fact that core.async is based in CSP is oft-mentioned in core.async introductions. But why should we care? CSP as a mathematical modeling language has a long and rich…

PureScript on Android

I’ve been playing around with PureScript on Android via React Native. Here’s what a TodoMVC-style app looks like: And here’s what the guts of the code look like: render :: forall props eff . Render props AppState eff render ctx = do ( AppState state ) <- readState ctx return $ view [( style "container" )] [ text [ style "title" ] "todos" , view [ style "newTodoContainer" ] [ textInput [ style…

The state of Clojure on Android

Note that this post was written in April of 2015, based on experiments run on relatively current Android devices of the time. The situation may be different now. Clojure on Android suffers from the slow startup times of the Clojure runtime. The Lean Clojure compiler projects promise fast startup times and performance at the cost of dynamism and complexity. Does it work? How do you know if anything…

Solving Clojure Boot Time

Clojure programs start slowly because they load the clojure.core namespace before doing anything useful. Loading the clojure.core namespace loads the Java class files for all of the functions in clojure.core and sets up Vars to point to new class instances corresponding to each function. This is slow. Simple desktop Clojure programs start about 35x more slowly than their Java counterparts. Clojure…