RSSAmplifier

Blog

[Thinking inside a large box];

Recent content on [Thinking inside a large box];

blog.benjamin-encz.deRSS feed ↗47 posts

Latest posts

My Five Favorite Books for Engineering Leaders

I recently got asked a lot about book recommendations for engineering leaders. Here are the five books that I’ve found most helpful so far.

Engineering Process Is Overvalued

Many engineers and managers focus too much on process and overlook much more important aspects of a successful engineering team. Here’s a quick reminder about what really matters and what engineering managers should spend their time and energy on.

Flavors of Engineering Management

What is like to be an engineering manager vs. an individual contributor? Should engineering managers code? What do engineering managers actually do? The correct, yet unhelpful answer is: “it depends”. The (software) engineering management role comes in many flavors. This means that the day-to-day work can be vastly different. If you’re trying to learn from engineering manager…

Modeling one-to-many in SQlite using the JSON1 extension

I’m currently reading a great book on designing data intensive applications . In the earlier chapters of the book the author (one of the main contributors to Apache Kafka) discusses the history of database models and tradeoffs between document, relational and graph databases. He touches on interesting trend: Some of the most popular database systems such as PostgreSQL and SQlite now offer…

Quick Thoughts on Prototyping Software

It’s almost the end of July and I’ve tried to keep up a schedule of blogging at least once a month. So I decided to pull a topic from the long pile of potential blog posts I’ve accumulated: prototyping . This posts focuses on using prototypes to validate technical ideas, not on creating prototypes for user testing.

Another Small UIKit Debugging Adventure

Working with closed source APIs sometimes requires us to use advanced debugging techniques to track down issues that cannot be explained by our application code alone. This week I had an interesting debugging session in which I learned more about the behavior of apps with multiple UIWindows . These kind of posts are mostly useful for me as an attempt to retain some knowledge. But I hope this story…

A Simple Undo/Redo Implementation in Swift

NSUndoManager is a powerful API, but it is geared towards Objective-C code and relies on runtime features. This post demonstrates a simpler alternative that is better suitable for idiomatic Swift code.

Safely migrating millions of database records across thousands of devices

This is a cross post of a piece that original appeared on the PlanGrid R&D blog

Surprises in Profiling Multi-Core Performance with Instruments

Short version: When profiling code that should run on multiple cores in parallel, CPU utilization of multiple cores isn’t a good indicator as a single thread might utilize multiple cores at (almost) the same time.

Bridging Swift Types to Objective-C

At PlanGrid we started adopting Swift prior to the 1.0 release. Despite the tooling problems you’re probably familiar with, we’re still excited Swift users and have written almost all new code since the summer of 2014 in Swift. We are doing that within a large legacy codebase so more than 50% of our application code is still in Objective-C. As in many projects Swift and Objective-C…

Why I don't Believe in Uber's Success

I wanted to write this blog post for well over half a year. I don’t believe Uber will be a successful business . I’ve been making my points in individual conversations over and over again - with this post I’m creating a writeup of my arguments that I can share in future. Since I’ve had a lot of discussions about Uber in person, it makes the most sense to write this piece in…

Understanding Data Race Detection by Implementing it in Swift

TL;DR: In order to learn more about how Thread Sanitizer’s data race detection works I’ve implemented a very simple version in Swift. You can find it on GitHub. We all know concurrency is hard. It’s easy to make mistakes when attempting to synchronize access to shared resources and the resulting issues are often extremely hard to reproduce and debug. So I was very excited when I…

Apple Isn't Doomed Quite Yet

The outcry in the Apple community after the latest Apple event has been huge. For many of its loyal customers it seems that the last bit of the remaining magic of the Jobs era has vanished. I personally have only been following Apple more or less closely since 2012. From this position I feel like I’m able to view the state of Apple from a mainstream consumer’s angle. From that vantage…

Declarative API Design in Swift

In my first real job as an iOS developer I built an XML parser and a simple layout engine - both had in common that they had a declarative interface. The parsers was driven by a .plist file that mapped XML elements to Objective-C classes. The layout engine allowed you to describe layouts in an HTML-like language (this was before AutoLayout & CollectionViews existed). Though neither of these…

Broken Toolchain Post Mortem

Dependency managers, IDEs, continuous integration, automated tests - all these tools are created to supercharge a developer team’s productivity. While modern development tools are amazing in many ways, they unfortunately also add maintenance burden to a project. Ask me about migrating our Bitrise & fastlane CI workflows to Xcode 8. The goal of this post it not to blame any individual party.…

Bridging Existentials & Generics in Swift 2

We are back to another episode of discussing generics, protocols with associated types and some type system limitations in Swift 2. This time we will dive into an interesting workaround that the infamous jckarter has taught me. We will also discuss how this workaround might become unnecessary through enhanced existential support in future Swift versions. But what are existentials anyway?

Real World Flux Architecture on iOS

About half a year ago we started adopting the Flux architecture in the PlanGrid iOS app. This post will discuss our motivation for transitioning from traditional MVC to Flux and will share the experience we have gathered so far. I’m attempting to describe large parts of our Flux implementation by discussing code that is in production today. If you’re only interested in the high level…

WWDC 2016 5 Minute Update: Opening Up iOS, Xcode Extensions, Apple Filesystem, Swift Playgrounds on iPad

A very brief summary of changes & impressions from WWDC 2016 Day One.

GCD's Main Queue vs. Main Thread

The correct way to ensure that code runs on the main thread / main queue is a recurring issue that causes some confusion among Cocoa developers. The topic came up again this week as part of an issue with ReactiveCocoa and MapKit: Apple DTS “explicitly stated that main queue and the main thread are not the same thing, have subtle differences”. https://t.co/YxAbqkvtse — Ole Begemann…

Beware the UIKit Visitors!

Investigating the Cause of Quadratic Time Complexity When Adding Subviews in UIKit Yesterday Two weeks ago we identified a performance regression in the PlanGrid app, when entering a view that dynamically adds a large amount of subviews. I started this blog post back then, but was recently motivated to finish it quickly by seeing other developers running into this issue as well: My discovery for…

Decoding Heterogeneous Collections in Swift

The problem of decoding Swift types from an outside data source, such as JSON, has been mostly solved. Since Swift’s release we’ve seen more than a dozen popular JSON mapping libraries pop up. However, most of the libraries I’ve seen so far deal with decoding individual types, not entire collections of heterogeneous types.

Compile Time vs. Run Time Type Checking in Swift

At some point, when learning how to use Swift’s type system, it is important to understand that Swift (like many other languages) has two different forms of type checking: static and dynamic. Today I want to briefly discuss the difference between them and why headaches might arise when we try to combine them.

Squashing Commits With Git Rebase: A Very Quick Guide

Git’s interactive rebase is extremely useful for keeping a somewhat clear commit history. Here’s a very brief guide on how to squash multiple commits into a single one.

Validated: A Swift μ-Library for Somewhat Dependent Types

Today I built & published a μ-library that makes it easier to leverage Swift’s type checking system for program verification: Validated .

How I Write Swift Specs With Quick

I’ve recently tweaked the way I write Quick specs. I came to realize that I was placing a majority of my testing code inside of it blocks. This seems to be common among many code bases that use Quick/Nimble .

About

Hey there! My name is Benjamin Encz and I currently live in San Francisco. I moved here from Germany in 2013. Currently I spend most of my time writing software, with a strong focus on iOS development. I’m working for PlanGrid where we are building software that makes the construction industry more efficient. In the past I’ve been focused on building enterprise software & teaching…

Projects

I’ve worked on quite a few things in the last couple of years…

Speaking

I enjoy sharing things I’ve learned and spreading ideas. Here are the talks I’ve given in the past & the upcoming ones I’ve got scheduled. Upcoming On a speaking break 🙂 2017 Workshop: Unidirectional Data Flow on iOS Swift Aveiro, Aveiro June 2017 GitHub Repo The Art of Stealing MCE, Warsaw May 2017 Slides Recording Flux & Redux on Mobile Craft Conference, Budapest April 2017…

Writing

I’ve spend a fair amount of my time on different writing projects.

Introducing ReSwift

For the last two months I have been actively working on Swift Flow with the goal of bringing the ideas of the Flux and Redux libraries to Swift developers.

Convenient Error Handling in Swift

Swift 2 introduced an error handling mechanism that includes backwards compatibility with Objective-C . This is great news, the new mechanism is a lot stricter. Long gone are the days in which one could ignore errors by lavishly throwing nil at methods that expect a pointer to an NSError variable.

A Flux Inspired Architecture for iOS

This year I spoke at 360iDev about “Safer Swift Code with Value Types”. The goal of the talk was to explore an architecture that uses immutable value types for the model layer.

Swift Error Handling and Objective-C Interop in Depth

For the impatient reader: TL;DR The ErrorType protocol has hidden requirements that are automatically fullfilled if you use an enum to implement the protocol Objective-C methods can only be translated to Swift’s error handling mechanism if they return Objective-C objects or boolean values Swift will invoke the catch block if the Objective-C method returns nil / false , independent of whether…

iOS 9 Detects Cycles in Layout Trees

A couple of months ago I was faced with an issue that was fairly hard to debug: Hackathons are a great place to see noteworthy issues. Yesterday's highlight: endless recursion in Storyboard @LAHacks — Benjamin Encz (@benjaminencz) April 5, 2015

Talk: Introduction to FRP on iOS

Back in April I gave a talk at NSMeetup in San Francisco on Functional Reactive Programming on iOS.

Breaking Swift with NSObject and Generics

Today, while trying to implement a generic data source in Swift, I ran into my first Swift compiler segmentation fault, yay (looking at Open Radar there seem to be many out there)!

"I didn't know that" is the best way to learn

This is no original thought. Nevertheless I’ve been thinking about it often enough to make it worth spending a few minutes framing it in my own words. I’m currently working as a Software Engineer. According to Wikipedia that makes me a Knowledge Worker .

Switching iOS devices and the Keychain

Unfortunately some of my MovieLoggr users ran into the following issue: After switching to a new phone and restoring it from a Backup MovieLoggr would behave unexpectetly (and in some cases crash) because the App could no longer access the user’s password and unfortunately did not handle this gracefully.

Using SSH for private and work account on a Mac

Disclaimer: I’m not a huge fan of configuring software; I’m primarily writing this to remember it for the future. Using SSH instead of HTTPS to authenticate against services such as GitHub, Bitbucket or Heroku is very convenient, instead of typing a password for every interaction Mac OS simply exchanges SSH keys behind the scene. However, one can run into trouble when trying to use…

The downside of Web APIs

Web APIs have done a lot for the world of technology. Services that have formerly been isolated islands can now be connected through a few simple HTTP Requests. Posting to Facebook on every GitHub commit? Printing a Postcard as soon as a new Photo is uploaded to a Dropbox folder? Basically anything is possible through Web Services.

Arithmetic Expressions in Swift

While I still cannot fully understand how the release of a new programming language didn’t leak before WWDC, most of us got surprised by the announcement of Apple’s new Programming Language Swift . Like most iOS Developers I immediately took a look at the new language. Most language details seem fairly straightforward - however, arithmetic expressions were the first small pitfall for…

Objective-C: Accessing backing iVars of properties in subclasses

Most Objective-C developers have a fairly good understanding of properties and instance variables and how these two work together. Today I want to discuss an interesting case that will force you to understand the details of the relationship between instance variables and properties. In case you already know these details, this remains an interesting example of how complicated Objective-C can be…

Automatic serialization in Objective-C

Recently I worked on a tutorial that required me to serialize a large amount of objects. This is a common use case in many games - if the user quits the game and reopens it you want to restore the entire game state.

When You Can't Avoid Email

Don’t get me wrong, Email is a great tool and an evergreen in everyone’s communication stack. I use it, among many other things, to stay in touch with friends, receive food delivery confirmations and to consume newsletters. Emails are an essential part my everyday life.

(untitled)

What I did in the past & what I’m looking for next The goal of this page is to go beyond a resume and hopefully provide useful context on my past experience and on what I’m looking for in a new role. For my work history, check out LinkedIn. For open source contributions, GitHub. The sections are: Highlights and numbers How I see myself What I care about in my work Personal values [WIP]…

(untitled)

Projects scheduled onto platform teams via agency model tend to balloon in scope Once I have engineers; might as well get a ton of stuff done!

(untitled)

Personal Values Some of these are not fully fleshed out, I still want to share them as they give a useful view into what I care about. 1. Ownership Within your realm of capability I can trust you to own your work. This entails clearly stating commitments, proactively communicating surprises, being able to understand the context of the work and autonomously making sensible decisions (escalating…