This space is for ponderings and news about code, music, games, meditation, life, and stuff. It's updated erratically.
Subscribe to new posts:
RSSMultiple Conformances to Codable in Swift
posted Saturday, May 29, 2021 2:46 PM
(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.
Functional, Composable Swift Styles With UIKit (and Beyond)
posted Tuesday, October 27, 2020 5:12 AM
(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.
Functional-izing Swift Code
posted Wednesday, October 21, 2020 7:26 AM
(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.
An Alternative Type-Erasure with Swift Using Closures
posted Thursday, October 15, 2020 6:34 AM
(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.
Functional-izing Network Code with Swift Combine
posted Friday, October 9, 2020 12:29 PM
(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.
A Crash Course in Swift Combine
posted Monday, October 5, 2020 5:03 PM
(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.
How to Type-Erase Protocols in Swift
posted Wednesday, September 30, 2020 8:25 AM
(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!
Using "Protocol" Witnesses in Swift
posted Friday, September 25, 2020 7:34 AM
(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 associatedType
s and Self
s and type erasure, then you may have your mind blown a little bit.
Lessons from Lambda School Labs
posted Wednesday, September 23, 2020 12:40 PM
(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.
Using the Coordinator Pattern in iOS13+
posted Thursday, August 6, 2020 8:31 AM
(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.
-
Here’s just a few articles about it: ↩
Testing Code Challenge Solutions in Swift
posted Wednesday, July 29, 2020 2:09 PM
(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.
Optional Protocol Methods & Properties in Swift
posted Wednesday, July 22, 2020 1:29 PM
(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!
Non-Generic Initializers on Generic Types in Swift
posted Wednesday, July 15, 2020 8:06 AM
(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.
Creating Conway's Game of Life in Swift
posted Wednesday, June 24, 2020 8:15 AM
(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!
Refactoring Bloated Functions
posted Thursday, June 4, 2020 9:21 AM
(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.
Abstracting Away Your Persistence with Swift
posted Monday, March 9, 2020 10:54 AM
(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.
Writing an Atomic Property Wrapper in Swift
posted Sunday, January 26, 2020 3:48 PM
(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.
Super Countdown Tracker: Sorting and Filtering Objects in Swift
posted Thursday, January 2, 2020 11:50 AM
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.
Two Others' Songs
posted Thursday, November 7, 2019 4:55 PM
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…
-
Here’s the original version of “Here Comes a Thought” in its episode, “Mindful Education.” ↩
-
Here’s an especially transcendent performance featuring several Ondes Martenot players. ↩
Why Lambda School?
posted Friday, September 27, 2019 1:32 PM
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.
A Change of Career
posted Thursday, May 9, 2019 2:46 PM
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…
Trying Meditation
posted Wednesday, February 27, 2019 6:58 PM
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.
On Suffering
posted Tuesday, February 19, 2019 3:53 PM
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
'Evocations' Sampled in Lamarr Family Values's 'Polar Bear'
posted Tuesday, February 12, 2019 3:11 PM
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.
What's Going On?
posted Friday, December 7, 2018 12:00 AM
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.
“Why Do You Meditate?”
posted Thursday, August 16, 2018 8:14 PM
This is a complicated question to answer, but I think it’s worth answering for those that care.
Film/Game Scoring = Writing Accompaniment
posted Tuesday, February 6, 2018 2:24 PM
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.
Free Work
posted Thursday, January 18, 2018 4:18 PM
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.
Uprooting Bitterness
posted Friday, October 27, 2017 12:38 PM
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.
How I Compose
posted Tuesday, August 15, 2017 2:54 PM
Music is, in short, organized sound.
Being Better
posted Monday, June 26, 2017 7:11 PM
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.
To Be "Secularly Spiritual"
posted Friday, March 24, 2017 12:00 AM
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.
Make It Smaller (+ make space)
posted Thursday, March 23, 2017 11:42 AM
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).
Bringing a Bit of Mindfulness to Social Media
posted Sunday, March 5, 2017 12:00 AM
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.
The Value of Friends -- a love letter
posted Monday, February 13, 2017 12:00 AM
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.
On Synthwave
posted Thursday, February 9, 2017 9:45 AM
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.
Insults As Motivational Speech
posted Wednesday, January 18, 2017 7:00 PM
Today I came across this video.
Don’t Wait for Inspiration
posted Wednesday, January 11, 2017 9:05 PM
A series of reminders for myself that you may find helpful:
Diminishing the Shame of My Mental Health
posted Saturday, January 7, 2017 12:00 AM
As I think I’ve mentioned before here, I struggle with ADHD, but have only had a formal diagnosis for just over a year.
Grieving in 2016
posted Wednesday, December 28, 2016 12:00 AM
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.
A Universal System
posted Wednesday, November 30, 2016 12:00 AM
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.
How Did You Fail Today?
posted Monday, November 28, 2016 12:00 AM
…and other questions I should ask myself more often.
The Joys of Fiddling
posted Sunday, November 13, 2016 12:00 AM
I’ve been spending a lot of time letting my mind go off the rails and, for lack of a better term, just fiddle.
Open-Source Music
posted Saturday, October 29, 2016 10:51 AM
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.
Metaphysics as Metaphor
posted Sunday, October 16, 2016 12:00 AM
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.
Teenage Empathy Builder: The Game — A Review of “Life is Strange”
posted Friday, August 19, 2016 4:30 AM
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.
Mindful Composition
posted Monday, June 27, 2016 3:45 PM
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.
What Makes Undertale So Wonderful?
posted Saturday, May 28, 2016 12:13 PM
A few months ago I finally gave in to peer pressure and bought & played Undertale.
We Can Do Better
posted Sunday, January 31, 2016 4:00 PM
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!
2015 In Review
posted Sunday, December 20, 2015 4:00 PM
Just as it was in 2014, 2015 was a year where things happened. Here’s a list of some of those things!
Music is Meaningless
posted Tuesday, October 13, 2015 5:00 PM
There is no such thing as sad music.
There is no such thing as happy music.
Music has no inherent emotional value or meaning.
In Defense of Homebodies
posted Monday, October 5, 2015 5:00 PM
I hear a lot about the benefits of travelling the world, from blogs and books and good friends who love to travel.
New Job
posted Tuesday, September 22, 2015 5:00 PM
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.
Listen to People You Don’t Like
posted Monday, September 14, 2015 5:00 PM
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.
PAX 2015 Highlights
posted Monday, August 31, 2015 5:00 PM
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.
Making a Custom Kontakt Instrument
posted Tuesday, August 25, 2015 5:00 PM
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.
Success is Overrated
posted Friday, August 14, 2015 5:00 PM
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.
Participation in Music
posted Tuesday, July 28, 2015 5:00 PM
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.
On Art, Commercialism, and Elitism
posted Tuesday, July 14, 2015 5:00 PM
Art and capitalism have a very dubious relationship.
On Expectations in Music
posted Monday, July 6, 2015 5:00 PM
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.
Getting Over Self-Esteem
posted Tuesday, June 30, 2015 5:00 PM
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.
Why Composers Should Break Free of Genre Constraints
posted Thursday, June 18, 2015 5:00 PM
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.
What Makes the Score to Mad Max Fury Road Work
posted Wednesday, May 27, 2015 5:00 PM
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.
Habitual Composition – commit to writing one measure of music every day
posted Friday, January 30, 2015 4:00 PM
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.
2014 – It Was a Year
posted Saturday, December 27, 2014 4:00 PM
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:
Neverending Nightmares – a review
posted Sunday, September 28, 2014 5:00 PM
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.