Blog Posts

This space is for ponderings and news about code, music, games, meditation, life, and stuff. It's updated erratically.

Subscribe to new posts:

RSS

Multiple Conformances to Codable in Swift

(Note: This post uses Swift 5.4 and the iOS 14 SDK)

There may be some circumstances where you want to encode/decode a model in multiple ways, depending on certain conditions or use-cases. There’s a lot of potential solutions to this problem. Here’s some of them.

...read more...


Functional, Composable Swift Styles With UIKit (and Beyond)

(Note: This post uses Swift 5.3 and the iOS 14 SDK)

SwiftUI is the hot new kid on the block in iOS Development, but as most developers know, UIKit isn’t going anywhere anytime soon (and indeed, a decent chunk of SwiftUI utilizes it under the hood). Despite this, there’s still a lot of aspects of UI programming that can be pretty obnoxious with UIKit. However, there are some interesting ways that we can make it a little bit more usable by taking some nods from a more functional programming style.

...read more...


Functional-izing Swift Code

(Note: This post uses Swift 5.3 and the iOS 14 SDK)

In a recent post, we looked at using Combine to refactor networking code. Before that, I looked at refactoring bloated networking functions. Today I’d like to take another stab at refactoring. This time, however, we’ll be using a style that looks a lot like Combine, but uses a more “traditional” functional style without using Combine at all.

...read more...


An Alternative Type-Erasure with Swift Using Closures

(Note: This post uses Swift 5.3 and the iOS 14 SDK)

In a recent post, I described a method of type-erasure in Swift using a complicated, verbose system that took advantage of generics, private wrapper types, and subclassing. It turns out, however, that there’s a much quicker, Swiftier, and arguably simpler way to accomplish this that uses closures.

...read more...


Functional-izing Network Code with Swift Combine

(Note: This post uses Swift 5.3 and the iOS 14 SDK)

As I mentioned in my previous post, using the Combine framework might require somewhat of a paradigm shift. In some ways, the best way to accomplish this might be to jump all in feet first and use it for all your networking and reactive code. However, this may not be entirely necessary, as Apple has also made it easy to gradually transition your codebase over to using Combine.

...read more...


A Crash Course in Swift Combine

(Note: This post uses Swift 5.3 and the iOS 14 SDK)

Combine is Apple’s new-ish framework for functional reactive programming, a coding paradigm that specializes in working with asynchronous streams of values in a “declarative” style. That’s a lot of buzzwords that may not make a lot of sense until you see it in action. So let’s take a look at how we can use it to write more adaptable asynchronous code.

...read more...


How to Type-Erase Protocols in Swift

(Note: This post uses Swift 5.3)

Type erasure is what allows us types like AnyCollection. For any type that conforms to the Collection protocol, their interfaces will be exactly the same (except of course for the type of Element used). AnyCollection allows us to wrap up any collection and swap in one (e.g., an Array) for another (e.g., a Set, or even a custom collection type).

Unfortunately, writing a type-erased instance of a protocol is far more complicated than it has any right to be, and personally I avoid it where at all possible. Still, there are instances where it can be very useful, and it’s sort of interesting from a mere curiosity perspective. So let’s take a look at how we can write a type-erased implementation of a protocol!

...read more...


Using "Protocol" Witnesses in Swift

(Note: This post uses Swift 5.3)

I’ve been going through PointFree’s video backlog lately and have been learning a ton. The concept that’s stuck in my mind the most, though, is that of using a generic struct as a replacement for protocols. If you’ve ever been frustrated working with protocols, running into issues with associatedTypes and Selfs and type erasure, then you may have your mind blown a little bit.

...read more...


Lessons from Lambda School Labs

(Note: This post uses Swift 5.2 and the iOS13 SDK)

It’s been almost exactly a year since I started taking classes at Lambda School, and now I’m on the cusp of completing my time there and starting my job search in earnest (hit me up if you know a place!). As part of completing my “endorsement” (aka graduation), I need to write a “what I learned at school today”-style article. Once again you can probably read my hint of snarkiness, but also, again, I think this is a potentially useful exercise.

...read more...


Using the Coordinator Pattern in iOS13+

(Note: This post uses Swift 5.2 and the iOS13 SDK)

The coordinator pattern is probably my favorite “unofficial” design pattern in semi-common usage in the iOS community.

There’s a lot of great articles out there about what it is and why it’s beneficial1, so that’s not my purpose here today. As of iOS13 and the introduction of the SceneDelegate, the way to implement it has changed a little bit, so I thought I’d write a bit about what needs to be done to make it work.

  1. Here’s just a few articles about it: 

...read more...


Testing Code Challenge Solutions in Swift

(Note: This post uses Swift 5.3)

Lately I’ve been doing a lot of “code challenges” as part of the conclusion of the computer science portion of my time at Lambda School. Testing my solutions using the often clunky web “IDE” interfaces of these code-challenge websites quickly becomes a subtle source of pain when I’m doing a lot of these every day.

So naturally, I wrote some code to solve this.

...read more...


Optional Protocol Methods & Properties in Swift

(Note: this post uses Swift 5.2)

I remember when I first learned about protocols, I often got annoyed that we couldn’t make optional methods or properties without bridging to Objective-C, which came with its own set of limitations. However, it turns out there’s a fun workaround for this!

...read more...


Non-Generic Initializers on Generic Types in Swift

(Note: This post uses Swift 5.2 (and a bit of 5.3 at the end))

One of my favorite things about Swift is how it balances type safety with hidden power, such as in its implementation of generics. In certain scenarios where you want to use this power alongside an enforced type-safety, however (especially if you’re coming from a more “loosey-goosey” language like Objective-C or Python), things can seem to get a little bit obnoxious.

...read more...


Creating Conway's Game of Life in Swift

(Note: This post uses Swift 5.2)

Conway’s Game of Life is a classic programming concept that I was tasked with implementing as part of the computer science curriculum at Lambda School recently. This is the sort of task I really enjoy; not a ton of practical use, but a lot of fun!

...read more...


Refactoring Bloated Functions

(Note: This post uses Swift 5.2)

I recently completed time as a Team Lead at Lambda School, where I was responsible for reviewing and offering feedback on students’ code. One of the biggest benefits I took away from this experience was the value of writing readable code. To that end, I thought I would share some quick tips that, in my opinion, can help improve the organization and readability of your code.

...read more...


Abstracting Away Your Persistence with Swift

(Note: This post uses Swift 5.1)

Most tutorials I’ve seen out there that have to do with local persistence (i.e., saving your app’s data on the device) end up with the framework’s tendrils wriggling all throughout the app’s codebase. This isn’t an issue in a tutorial app, or even in smaller apps, but in a larger app, it can become a problem especially if you want/need to switch to a different framework.

...read more...


Writing an Atomic Property Wrapper in Swift

(Note: This post uses Swift 5.1.)

This weekend I was working on a framework for fetch operations, and was wanting an easy way to make access to a property atomic in order to prevent race conditions where multiple things try to access or change something at the same time, which could cause all sorts of issues.

After doing a bit of research, this ended up being a two-step process, but in the end it makes both creating and accessing this property easy and succinct.

...read more...


Super Countdown Tracker: Sorting and Filtering Objects in Swift

Happy New Year! I realized recently that I haven’t written in awhile and I never really wrote about Super Countdown Tracker, so I’m now taking care of both of those things.

...read more...


Two Others' Songs

In September I released two covers as a single called Two Others’ Songs, featuring electro-pop-ish arrangements of “Here Comes a Thought” from Steven Universe1 and Radiohead’s “How to Disappear Completely”2 from Kid A. You can listen to it on all of your favorite music platforms…

  1. Here’s the original version of “Here Comes a Thought” in its episode, “Mindful Education.” 

  2. Here’s an especially transcendent performance featuring several Ondes Martenot players. 

...read more...


Why Lambda School?

This week I started orientation at Lambda School, where I’ll be studying primarily iOS development (and macOS & related techologies). One of my assignments during orientation is to write about why I’m here. Although the cynical part of me rolls my eyes at the very typically “first-day-of-school” style of the assignment, I thought I’d take it at least relatively seriously and make my thoughts public in the case that it happened to be helpful to someone else down the line.

...read more...


A Change of Career

This is a decision I’ve been wrestling with for awhile now. For the past few years at least I’ve been developing a “backup plan” to attend a coding school and transition into software development if I found my current path wasn’t working out for me for one reason or another.

Well…

...read more...


Trying Meditation

Dr. Peter Attia on meditation:

…there are just going to be some people who guide in a way that you’re willing to be guided, and you shouldn’t be put off if someone’s listening to this thinking, “You know, every time I try meditation it doesn’t work for me,” or something like that. I don’t want to name the apps I went through, but there were many apps that I went through that just didn’t resonate for me. Just the way they talked about this didn’t make sense to me. Then, when you find the ones that do, and there are several that do for me, including Sam [Harris]’s Waking Up [app]… it really resonates with me, and there are others that do so the same. Jeff Warren is also one of the guides on Dan Harris’s 10% Happier [app]… I just love the way he explains stuff. So, I would say to anybody who’s listening to this, who’s feeling sort of bearish on meditation, try a different app, try a different guide, try a different book, try another way. Keep going until you find someone who can walk you through how to do this in a way that resonates.

I can also vouch for both Sam Harris’s Waking Up as well as Jeff Warren’s style of teaching meditation on the 10% Happier app, which, despite the kitschy name, has a lot of really high quality stuff from some real master teachers.

...read more...


On Suffering

Considering that all living beings are subject to pain and suffering, it is morally incumbent upon us to endeavor to refrain from causing any avoidable and unnecessary pain and suffering to any living being. Furthermore, we should undertake, through positive action wherever possible, to prevent the avoidable and unnecessary pain and suffering of living beings.

— Culadasa, in a retreat handout from 2012

...read more...


'Evocations' Sampled in Lamarr Family Values's 'Polar Bear'

A couple of years ago, my friend Silas Stewart recorded an EP of classical music featuring percussion. He wrote one of the pieces, I wrote two, and he performed on everything with a slew of friends. One of the engineers for that session recently asked if he could sample one of my pieces, Evocations for alto saxophone and percussion, for a track by his hip-hop group Lamarr Family Values. I’m pretty stoked about how it turned out! Check it out.

...read more...


What's Going On?

I want to use this space to give a bit of an update on where my life and career are at, for anyone that happens across this for any reason.

...read more...


“Why Do You Meditate?”

This is a complicated question to answer, but I think it’s worth answering for those that care.

...read more...


Film/Game Scoring = Writing Accompaniment

The other day, I was giving a lesson on writing music to picture, and I came across an analogy that I thought illustrated well the way that I approach scoring games & films.

...read more...


Free Work

I’ve done a fair amount of work that I haven’t been paid for. Some of this was work for friends that gave me great experience and that I’m grateful to have been a part of. Some, looking back, was blatantly exploitative and it’s obvious now that those I was working for (not with) didn’t value my time or expertise.

...read more...


Uprooting Bitterness

When someone you know gets a cool gig, there are a lot of emotions and thoughts that might come up and play through your mind. I could have gotten that gig, or on the flip-side, I’m never going to get a gig like that. Maybe something like They don’t deserve that job any more than me, or The gig probably sucks anyways, or one of several other mental rabbit holes we can fall into.

...read more...


How I Compose

Music is, in short, organized sound.

...read more...


Being Better

I recently resigned from my “day job” as Program Coordinator for the WWU Music Department. I’m now spending all my time trying to be a one-person music/sound-making business.

...read more...


To Be "Secularly Spiritual"

The word “spiritual” has a really icky connotation among folks that consider themselves to be any matter of skeptical, agnostic, atheist, serious, secular, scientific, or even just modern.

...read more...


Make It Smaller (+ make space)

I’ve been in a rather massive creative rut since roughly the start of this year (though I think the problem’s roots go back further than that).

...read more...


Bringing a Bit of Mindfulness to Social Media

When I wake up in the morning, I often find myself somewhat mindlessly picking up my phone and scrolling through social media. I don’t think this is terribly uncommon.

...read more...


The Value of Friends -- a love letter

In the past, I’ve found it very difficult to speak openly about how much I appreciate people without my tongue planted firmly in my cheek.

...read more...


On Synthwave

Lately I’ve been listening to ungodly amounts of synthwave. It’s not something I expected to get really, really into, but now that I’m here in the midst of this obsession, I can start to trace where this all came from and why I’m digging it so much.

...read more...


Insults As Motivational Speech

Today I came across this video.

...read more...


Don’t Wait for Inspiration

A series of reminders for myself that you may find helpful:

...read more...


Diminishing the Shame of My Mental Health

As I think I’ve mentioned before here, I struggle with ADHD, but have only had a formal diagnosis for just over a year.

...read more...


Grieving in 2016

As with every year, a lot of folks died in 2016. This year, however, the consensus seems to be that fate has been especially cruel in taking away beloved artists and other public figures from us.

...read more...


A Universal System

A lot of this post is going to be me merely thinking on paper, or attempting to follow ideas to their logical conclusions, even though they may seem a bit wacky at first.

...read more...


How Did You Fail Today?

…and other questions I should ask myself more often.

...read more...


The Joys of Fiddling

I’ve been spending a lot of time letting my mind go off the rails and, for lack of a better term, just fiddle.

...read more...


Open-Source Music

I am an abashed (no pun intended) fiddler—and I don’t mean I play violin. Recently I’ve been tipping my toes into the water of open-source development for fun, learning basics of git, CLIs, SQL, Emacs Lisp, various bits and pieces of various programming languages and frameworks, along with music-related languages and frameworks like Csound, PureData (I’m fairly competent already with Cycling 74’s Max, which shares a common ancestor with PD) and then, finally Lilypond.

...read more...


Metaphysics as Metaphor

Being an active reader of literature on personal-development, productivity, Buddhism, and related fields, it’s hard to avoid pieces that stray into topics that are unsubstantiated or pseudoscientific at best, through the ‘metaphysical’ middle, and down to being absolute horse-shit at worst.

...read more...


Teenage Empathy Builder: The Game — A Review of “Life is Strange”

Lately I’ve been much more interested in games that don’t feature dudes shooting guns and saving the world from evil bad guys (or on an extra special occasion, a lady will shoot guns and save the world!). This has been a slowly growing trend for me (as evidenced by my (sort of) recent Undertale blog). I’m well aware that there are a ton of great games out there with these sorts of stories (and indeed, there’s still some that I’m really looking forward to), but I’m just getting a tad worn out on the ubiquity of them.

Life is Strange is the perfect antidote to this disillusionment.

...read more...


Mindful Composition

As a composer (and, I’m sure, in any creative endeavor), it’s extremely, deceptively easy to fall into a rhythm and habit and just write without thinking too much about it. We simply write what we think sounds like it should come next in that moment alone; where the melody “wants” to go. Often, this leads to a very natural, effortless style of music that flows out of the composer as if it just had to.

...read more...


What Makes Undertale So Wonderful?

A few months ago I finally gave in to peer pressure and bought & played Undertale.

...read more...


We Can Do Better

This is another post adapted from an extended Facebook post, this one from (I think) early December 2015. I think this was one of those rare, exceptionally lucid moments where I captured what I was feeling fairly well, and I stand by it now. I know two kinda political posts from me in a row is a little bit weird and probably slightly uncomfortable and maybe even not what you were looking for following this blog? But, you know, you get a little bit of everything with me, I suppose!

...read more...


2015 In Review

Just as it was in 2014, 2015 was a year where things happened. Here’s a list of some of those things!

...read more...


Music is Meaningless

There is no such thing as sad music.

There is no such thing as happy music.

Music has no inherent emotional value or meaning.

...read more...


In Defense of Homebodies

I hear a lot about the benefits of travelling the world, from blogs and books and good friends who love to travel.

...read more...


New Job

As of today, I’ve officially started work as the Program Coordinator of Western Washington University’s Department of Music. After a long summer of waiting for the position to open up, applying, interviewing, and finally being offered the position, I’m extremely excited to be able to serve the very people that I was among just last year, helping young musicians find their way in the department on a full-time basis.

...read more...


Listen to People You Don’t Like

I recently listened to an interview with Glenn Beck. As you might guess, I’m not a huge fan of the guy, and I was expecting that the interview wouldn’t change my perceptions of him.

...read more...


PAX 2015 Highlights

PAX is one of my favorite times of year, primarily because up and until recently, it’s where all of my real-life interaction with game industry folks happened, and every year it manages to reinvigorate my love of games and the people that make them. This year was no different.

...read more...


Making a Custom Kontakt Instrument

Inspired by Junkie XL’s intriguing video series on his studio and film work (especially on Mad Max: Fury Road), I decided to make some custom instruments using Native Instruments’ excellent industry-standard sampler Kontakt (don’t buy it at full price; it and Komplete go on sale at least once a year) and some drums I had access to; so far, one small bass drum at the nearby university, and one small bass drum at home that I got for free a few years back.

...read more...


Success is Overrated

For the past several months (years maybe?), I’ve been reading a lot (and attempting to implement) about how to better promote myself and market myself and network and all the weird Silcon-Valley-etc-online-entrepreneur mumbo-jumbo that goes along with that. Some of the folks that do it seem to get along fine with it but I’ve decided that I’m just… done with it. I’m not interested anymore in trying to convince others that what I’m doing is worthwhile.

...read more...


Participation in Music

Participation in music can sometimes get kind of a bad rap. My tendency is to associate it with somewhat patronizing practice of having the audience clap along or do some kind of call-and-response thing, which in practice usually only goes to show how little said audience remembers from the meager music education many of them probably had.

...read more...


On Art, Commercialism, and Elitism

Art and capitalism have a very dubious relationship.

...read more...


On Expectations in Music

I remember a conversation I was having with a couple of friends a few years ago about a particular jazz(-esque) artist (I honestly can’t remember who it was). One friend was a big fan of their interesting take on jazz. The other, not so much. When asked why he wasn’t as into them, he mentioned his experience seeing them live.

...read more...


Getting Over Self-Esteem

I, like probably most people in creative fields, have struggled with self-esteem issues at times. Perhaps the most potentially dangerous attitude I’ve adopted along these lines is one that I think started when I was a teenager: that having low self-esteem is the only preferable alternative to becoming an arrogant egomaniac.

...read more...


Why Composers Should Break Free of Genre Constraints

I write music. Some of it is more electronic, some of it is written for instruments, much of it is a combination of the two. Some of it is light-hearted and off-kilter, some of it dark and immersive. It kinda runs the gamut, for better or worse.

Notice I didn’t even mention a genre in that paragraph.

...read more...


What Makes the Score to Mad Max Fury Road Work

Mad Max: Fury Road surprised me. I had watched Thunderdome and parts of the other two movies growing up, and I was mildly, skeptically optimistic about the new movie when I saw the trailers and promos. I certainly was NOT expecting it to be one of the best action movies I’d ever seen.

...read more...


Habitual Composition – commit to writing one measure of music every day

Since deciding to become a composer my sophomore year of college, back in 2010, composing consistently has been a pretty constant struggle for me. Every break, be it spring, winter, or the several-month summer break (even long weekends), I’d tell myself, “Alright, this break I’m going to compose more than ever!”

Spoiler alert: it never worked.

...read more...


2014 – It Was a Year

Well, it’s the end of the year. It’s been… a year. Many ups and downs, though mostly ups! Here’s some of what happened in 2014:

...read more...


Neverending Nightmares – a review

Let me get the general ruling out of the way first: this is a great game from a new and promising voice in the indie horror game scene.

...read more...