tl;dr: don’t use performance as an unsubstantiated excuse to write convoluted code

A lot of people on responded to what we wrote about performance:

Performance is never a justification for anything if you haven’t measured it

I stand by what we wrote 100%, but to add some color:

In my experience, people often write code in convoluted ways so it’s not slow. The problem is, when they do this, they’re often wrong about what’s slow. There’s lots of superstition about performance, and many people (myself included) have bad intuition about performance. There’s a real cost to this premature optimization: much of the advice encourages convoluted code.

We hated bad code quality…

Orthodox: the API was set down in the specification generations ago. Even if it’s wildly out of date and doesn’t make sense anymore, we’re still going to support it. There can be no new APIs; if you want new features, figure out a way to get them through the most convoluted combinations of the old APIs

See: Websites supporting IE6

Reform: We broke your APIs. They weren’t good anymore. Here’s some new APIs. Some APIs have the same name, but work completely differently; just deal with it, it’s better now. …

If you’re using Figma for UI/UX design, Pagedraw can now turn those mockups into React code for your developers

We are super happy to announce that Pagedraw now supports Figma designs!

Our mission is to help companies build delightful products. The key to that is speed of iteration and efficient collaboration between the Design, Development and Product teams.

With the new Pagedraw<>Figma integration, you can help the Design team focus on the design of the product and Development team focus on building business logic, instead of spending time bringing designs to life in code. Pagedraw particularly shines when your team is iterating quickly on the designs.

The import process is now very simple:

With these 4 steps you can…

Originally posted at This is Pagedraw’s Launch HN post, preserved here for posterity. Click the link to see the original comments.

Hi HN! We’re Jared and Gabe (YC W18), the founders of Pagedraw ( Pagedraw is a UI builder that turns mockups into React code.

Pagedraw lets you annotate mockups with extra information (like how to connect to the backend, resize for different screens, etc.) to get full, presentational, React Components. They’re React Components just like any others, so they can be interleaved freely with handwritten ones. …

Like developer tools? Web development? Compilers?

Join us at Pagedraw, a startup that gives designers the superpowers of developers. Founded by Harvard undergrads, Pagedraw solves the problem of time wasted writing HTML and CSS code. At the core, we are a compiler that takes as input drawings like this:

Pagedraw is a free-form UI builder for React. It’s used like Sketch, but emits flexbox code like I’d write by hand. You can check it out at or try a demo.

The Pagedraw team is all compilers people, unlike WYSIWGs before us. At its core, it works because we’re approaching…

Netflix has a program called “chaos monkey” to make servers, processes, and requests fail at random, even in production, to force themselves to reliably handle the failures inherent in distributed systems. In distributed systems, things will sometimes fail at random, so robust error handling is required. Chaos Monkey itself does not make their systems more robust; technically it makes them more fragile. However, Chaos Monkey reminds engineers that failure is inevitable, and they must design for it. Consequently, Netflix’s engineers design robust systems, and their site is very reliable.

I propose making functions throw exceptions at random. Even though single-process…

In C, and thus Objective-C, a switch statement only works with integers, and the case labels all need to be constant. Strings seem like a natural thing to switch on, especially for command line interfaces. Unfortunately, they cannot be reduced to integer constants, so we cannot use them. Now that we have blocks in the language, we can create a dictionary where we associate any object, such as an NSString, with a block, and call the selected block after a simple dictionary lookup.

The syntax

//get a string from standard input
char str[256];
fgets(str, 256, stdin);
*(char *)memchr(str, '\n', 256) = '';

In Objective-C, you can only call an overridden implementation of a method from an immediate subclass of that method’s class. This works well to provide encapsulation, and based on the way super is handled, a super method implementation cannot be called from any but the immediate superclass (inheritance notwithstanding). This is a good thing, as it would break large bits of encapsulation if subclasses could call arbitrary super implementations, or worse, if other objects could call super implementations of methods on foreign objects.

What we’re going to do

Keeping in mind that you should never do this, let’s implement a way to call arbitrary super…

Note: This is not an original idea of mine. For a good explanation of what Higher Order Messaging is, see this paper.

The Idea

There are some great implementations of higher order messaging, but this is not one of them. Instead, this is an implementation of a HigherOrderMessage object, which is designed with the goal of extensibility, by forgoing subclasses for blocks. This is obviously very straight forward, with an external interface of just

+ (id)HOMWithGetSignatureForSelector:(NSMethodSignature *(^)(SEL selector))_sig
capture:(void (^)(NSInvocation *message))_forward

This way, we can put all of the higher order messaging logic in one place, allowing us to (for example) implement…

Jared Pochtar

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store