Single File Components are Good

I was reading the Vue.js documentation recently, and I came across a very compelling little passage. The passage was explaining the thinking behind single file components. In a single file component, the template, javascript logic, and perhaps even styles, are all collocated in the same file.

Putting all the parts of a component into a single file may seem odd to some programmers. After all, shouldn’t we be separating logic from templates? Shouldn’t we be separating styles from logic too?

And the answer is that the right thing to do is situation dependent, and this is something that a lot of modern programmers don’t understand. A lot of programmers seem to think that there are rules, and you must follow the rules. They don’t realize that rules should only be followed when they are helping you.

So the core question is this: is separating a single view into several files really helping your development process?

Here’s what the Vue documentation says.

One important thing to note is that separation of concerns is not equal to separation of file types. In modern UI development, we have found that instead of dividing the codebase into three huge layers that interweave with one another, it makes much more sense to divide them into loosely-coupled components and compose them. Inside a component, its template, logic and styles are inherently coupled, and collocating them actually makes the component more cohesive and maintainable.

So the argument from the Vue developers is that keeping all the code related to one view inside one file is actually more maintainable than separating them.

I tentatively agree with this.

Obviously, it’s good to separate certain things out into their own files. Foundational CSS styles and core JS helper methods should have their own place. But for all the code that makes a component unique, I think it’s easiest for developers if that is in one file.

Here are the problems I face with breaking a view into multiple files.

1. What is each file called? Where is it located?

When you separate a view into multiple files, it becomes difficult to find each file. It’s fine to have a standard for naming and locating files, but in any large software project, there are going to be situations where the standard can’t be followed for one reason or another. Maybe the view was created early in development. Maybe the view is shared. Or maybe the view was created by a trainee developer and the mis-naming was missed in the code review. Whatever the cause, file names and locations can be stumbling blocks.

At my workplace, we have hundreds of templates named item.js.hamlbars. That’s not very helpful, but what’s more troublesome is when, for whatever reason, a list item couldn’t be named item.js.hamlbars. In that case, I’m left searching for files with whatever code words I can guess.

2. Where is the bug?

When you separate a view into multiple files, you don’t know where a bug may be coming from. This is especially troublesome if you are in a situation where conditional logic is being put into the templates. Once you have conditional logic in the templates, then you can’t know if the bug is in the javascript or in the template itself. Furthermore, it then takes developer time to figure out where to put the fix.

Single File Components are a Bonus

Putting all the code for a single view into a single file is not only logical, but it also doesn’t violate the separation-of-concerns ethos. While the pieces are all in the same file, they each have a distinct section. So this isn’t the bad old days of web development, where javascript was strewn across a page in any old place. Rather, collocating all the code files for a single view is a way to take away some common development headaches.

Don’t Use Amazon’s Forks of Open Source Software

This is a warning. Amazon’s forks of open source software are very poorly supported. If you switch to them, you will create problems for yourself. Here’s my three examples from personal experience.

Amazon Aurora

Amazon Aurora is attractive because it’s compatible with PostGreSQL and MySQL, and it is ready for sharding out-of-the-box. Don’t get sucked in though. The deploy and patching process is a poorly supported nightmare.

Recently, Amazon told us we had to have a forced upgrade patch on our Aurora instance. We don’t do downtime. Ever. But Amazon doesn’t provide a no-downtime version of the patch, and the alternative was too much of a time investment.

Amazon guaranteed us the deploy would only take 3minutes. So we decided to go forward with a little but of downtime. The first time it tried to patch it failed and took the database down for 10 minutes. Then it sat there for 15 minutes during which we could do nothing. Then it tried to patch again, taking the database down for another 10 minutes. And it failed again.

So at that point we were frantically calling Amazon support to try to stop it, but we couldn’t get through to anyone who was at all helpful. So the database went down a third time, and this time, fortunately, it worked.

All told, we had about an hour of downtime after Amazon guaranteed us only 3 minutes. The support was unhelpful, and didn’t really know how to help.

Amazon Linux

Do not use Amazon Linux. If that article isn’t enough to convince you, then here’s my story.

I like to try new technologies. I like to keep up to date with the latest thing. I use AWS in my every day job. So when Amazon started pushing their own version of Linux, I decided to try it on my personal website.

The major headache this has created for me is that the Lets Encrypt Certbot doesn’t work on Amazon Linux. So I can’t do automatic renewal of my SSL certificate. I have to step through the process manually each month.

But there are many other tools and packages that are incompatible too. Don’t use it.

Amazon’s Android

Amazon’s version of Android is awful for the same reasons. It’s extremely poorly maintained.

I loved the first Kindle device. It was perfect. It reduced waste, and allowed me to carry a library around with me. So I bought the initial devices, then carried on into the Kindle Fire and other tablets. That’s when the trouble began.

There are major bugs and performance issues on Amazon’s version of Android that have gone unaddressed for years.

The bug that caused me to switch to a Samsung tablet is one where, when I clicked on my most recent media item, it wouldn’t actually open my most recent item. So, for instance, if you are watching a show or reading a book, or switching between two things, then you are constantly opening the wrong thing. Because the performance is so poor, this is a problem that often takes minutes to resolve by clicking around and hoping it opens the correct item.

That seems like a critical bug to me. It should be one that gets fixed immediately, right? Well it existed for years.

Don’t Use Amazon’s Forks of Open Source Software

Don’t do it. That one feature they add isn’t worth it. Use the open source alternative.

Encores 2 by Nils Frahm, and the Joy of Live Music

It’s difficult to unpack my feelings about Nils Frahm as an artist. I remember, a few years back, hearing rave reviews about one of his albums. I can’t recall which album it was. I listened to it, and it reminded me of the type of “scholarly” music that is being produced at every college music department with an electronic music program in the country. It didn’t strike me as anything special.

Then I listened to The Noise Pop Podcast, or maybe it was Switched on Pop, and one of the hosts was overwhelmed by Frahm’s 2018 album All Melody. So I listened to that, and I felt about the same.

Maybe it was a sign that I was cynical, jaded, or just plain old. Or maybe Frahm and I went through similar music educations. Maybe he was the most successful version of all the dudes making quiet, semi-ambient electronic music at all the schools I attended. Although, glancing through his wikipedia, I don’t see any references to universities. So maybe that isn’t the case either.

But as of last year, my general feeling toward Frahm was a qualified “meh.”

Still, when I saw he was playing at a club that was walking distance from my house, I had to buy tickets. I invited my friend Brian along, and we caught him at The Ritz in San Jose.

It was at that concert that my feelings toward Frahm changed.

The Ritz is a fantastically intimate venue. It’s compact enough to reach out and touch the performer from the front of the audience. It’s small enough to only hold maybe two hundred people standing.

Frahm had an absolutely massive setup. He had several antique organs, numerous synthesizers, and enormous old fashioned amps the size of small cars.

But he had no band and there was no opening act. He came out alone. He performed alone, and the show was about him and his music. It was pure, and almost sacred in its tone at first. But as it went on he got more and more loose.

Frahm has a charming on-stage personality. Between each track he talked about his music and his writing process. He opened up his soul a little bit, and opened up about his music a lot. He got more talkative as the show progressed, until by the end he was talking about chord progressions and audience expectations. For people with a little bit of musical training, which I suspect was most of the audience, it was a magical night where we jointly worshipped at the altar of music.

On January 25th, 2019, Frahm released a new EP titled Encores 2. Does it feel like his show? Would his magical show change the way I perceived his music?

No. The album is more slow, quiet sonic meditations that owe a great debt to Brian Eno. It’s still an enjoyable album to listen to while at work, or on the train, or perhaps while making dinner.

But if you get the chance, you should definitely catch him live.

Remember Nina Simone

I recently read But What If We’re Wrong?: Thinking About the Present As If It Were the Past by Chuck Klosterman. The premise of the book is to predict the future by looking at how past predictions were wrong, and how they could have been right. As usual Chuck Klosterman takes on sports and culture, with some random asides about The Real World.

The most compelling section was where he tried to predict the future of Rock. He looked back at music of the past, pointing out that most people remember one person from each era of music. So most people know Bach from the baroque, Mozart from the classical, and Beethoven from the romantic era. He made the interesting point that surviving history is about being recognized by people who know nothing about the subject, rather than by people who are specialists. Specialists can name several playwrights from the 1500s, for example, but most of us can only name Shakespeare.

In the domain of rock, he said The Beatles are the logical choice to represent rock music. Still, he pointed out that it’s easier to remember a single individual whose story relates to the art itself. So Bob Dylan or Elvis Presley might emerge rather than The Beatles. Then he pointed to arguments for various rock musicians and why they might turn out to be true.

It was all very interesting, but it just got me thinking about jazz. In one hundred years, who might emerge to represent all of jazz?

Nina Simone at the piano

The obvious choice is Duke Ellington. His career spanned most of jazz, even though he retained his own distinct style throughout. He was influential as both a composer and a band leader.

Another choice might be Louis Armstrong. He invented the jazz solo as we know it today, and he performed a few of the most popular jazz tracks ever recorded.

After them, the waters get more murky. Benny Goodman made jazz popular music. Miles Davis sold more records than even Louis Armstrong. Marian McPartland brought jazz into the home long after most people had given up on it. Heck, maybe Johnny Costa will be remembered for his role as the music director of Mr. Rogers Neighborhood.

I think that it will probably be a composer. Prior to the late 19th century, the only recorded history of music was written down on paper. This is why we remember Mozart the composer, rather than the people who performed his music. We still tend to think people who write music are more important than people who perform it, even when we have recordings of great performers. That’s a big reason why it will probably be Duke Ellington who is ultimately remembered.

But this strikes me as wrong. Jazz is the first music that is truly a recorded music throughout its entire history. If humanity is around in one hundred years, then jazz recordings will still exist. So couldn’t it, perhaps, be the greatest performer who survives?

Also the focus of jazz is on the improviser. Jazz is a kind of folk music, where the performer subjugates the composition to his own interpretation. So perhaps the greatest interpreter of jazz will be remembered.

In either case, it has to be Nina Simone. No other performer expressed the full range of human emotions in a single performance. Even Louis Armstrong tended toward jubilation in his performances. He never reached the depths that Nina Simone explored in I Loves You Porgy or Willow Weep for Me.

There are two arguments against Nina Simone. First, that she was closer to a pop singer than a jazz singer. Second, that she isn’t known for her compositions.

Nina Simone wasn’t a pop singer. That’s what we would call her today because her category no longer exists. She was a cabaret singer. When she was unfairly rejected for a scholarship to study classical piano at The Curtis Institute in Philadelphia, she supported herself by playing popular music in bars and restaurants. She would sing and play whatever songs were on the radio. It was a very demanding job, and playing those songs night after night is what molded her into the greatest interpreter both as a vocalist and a pianist.

To the second objection, that she isn’t remembered for her compositions, I can only point to her unforgettable performance of Mississippi Goddamn, a composition of her own. With a cheerful piano accompaniment, and a melody that pushes the piece forward, she managed to write and perform a song that defines courage. The music is a beautiful, confident show tune that carries lyrics about one of the worst tragedies in American history. The effect is a better expression of the black experience in this country than any other performance in jazz.

So please, remember Nina Simone.

Here’s my playlist of Nina Simone’s best tracks to help her cause.

2018: The Year of the EP!

Well, the full length album is dead. It lived a long and brilliant life. Highlights included work from The Beatles, Pink Floyd, Joanna Newsom, Popol Vuh, AC/DC, and Galantis. But the fact is that nobody is listening to full length albums in 2018.

People are listening to playlists on Spotify, which are often made up mostly of singles from disparate artists. With the exception of the one percent of hardcore music listeners, nobody has the patience to listen to a full length album of music. Even the real music fans I know, who go to concerts with me several times a month, do not listen to full length albums.

But people do want more than singles.

So in 2018, we witnessed the explosion of a form that has come to be called “The EP”. It’s an extremely history-laden name for a short collection of music. An EP usually lasts at least ten minutes, and includes no more than seven individual tracks.

For me, personally, it’s what I listened to most in 2018. When I was listening to Discover Weekly and Release Radar on Spotify, I was seeking out experiences that were more than just a single piece of music, but an hour was usually too much music, even for me.

This is a format that works really well for indie musicians. It’s hard to write an hour of cohesive music that is strong from beginning to end. It’s much easier to write ten to twenty minutes of strong, cohesive music. And each EP can be different. EPs allow artists to explore more than singles or full length albums.

So here’s a playlist I made that consists of tracks from EPs I liked this year. It’s mostly indie electronic music, but there’s some Hip-Hop in there as well and a few tracks by well established artists.

Thanks for listening!

Three parallels between E. M. Forster and J. R. R. Tolkien

Forster and Tolkien are not much alike on the surface, but if you peer just a bit deeper, the similarities start popping out.

1. Both served in the First World War

Both served in the war in their own way. Neither wanted to be a soldier. Tolkien was coerced by his relatives to join the army as a matter of honor. Forster knew he wasn’t cut out to be a soldier, so he served the Red Cross as a conscientious objector.

Both men were deeply affected by the war. Some people link the war with Forster’s cessation in novel writing. Everyone can see the cynicism that runs through A Passage to India that just wasn’t as present in the earlier novels. Tolkien wrote primarily about soldiers, at least in The Lord of the Rings. All of the characters serve the war effort, and come back altered.

Tolkien in WWI
Tolkien in WWI

2. Both mixed fantasy with Englishness

In Tolkien’s books, he takes regular English people and puts them into a deep fantasy world. Bilbo Baggins is drafted from his bourgeois, middle class world, into the world of heroes and dragons. In The Lord of the Rings, the four hobbits are transformed from humble country folk to slayers of great beasts.

Forster does the exact opposite. He brings fantasy events into everyday English lives. This is particularly clear in his short stories where English people struggle to deal with fantastical events. Take the mysterious writing on the shaving glass in The Purple Envelope or the posession of a young boy’s body in Story of a Panic.

But fantastic events occur in the novels too, such as when Adela Quested and Ronnie hit an animal with their car. The narrator tells us of all the potential ghosts that may be intervening.

3. Both were academics

Tolkien is still remembered as one of the great philologists, and founders of modern linguistics. He studied medieval European literature and languages and applied that knowledge to his fiction. The great mythology of Middle Earth is built upon very similar tales to those Tolkien studied. In fact, the names of the dwarfs in The Hobbit were stolen from an ancient text.

Forster recieved an Honorary Doctorate from Leidens University
Forster recieved an Honorary Doctorate from Leidens University

Forster did much the same thing, although at a lesser scale. Forster is remembered for his lectures that became Aspects of the Novel, but he didn’t change the academic landscape like Tolkien. Still, he studied classical Greek and Roman mythologies as an undergrad, and populated all his novels with those gods.

It was Phaethon who drove them to Fiesole that memorable day, a youth all irresponsibility and fire, recklessly urging his master’s horses up the stony hill.

Don’t Buy a Kindle. Here’s why.

I’ve been a loyal Kindle user since the beginning. I’ve owned about twelve Kindles, from the initial basic model, through the Paperwhite, to the Fire and all its incarnations.

And the Kindle is still fine for reading books. If you only want to read books, then the Paperwhite is a great experience.

This post is aimed at the tablets. If you want to use your Kindle as a general media device, for movies, email, games, shopping, as well as books, then it is an awful choice.

I haven’t decided on which tablet to buy next. All I’ve decided for sure is that it won’t be a Kindle. Here’s why.

1. Irrelevant notifications that can’t be dismissed

I do not own an Alexa device. I have never deliberately used Alexa in my life. Yet, for three months I’ve had a notification on my Kindle that says “Alexa Accessories.” This notification cannot be clicked. It cannot be dismissed. It’s just there.

2. The Amazon App Store lacks great apps

Amazon has done little to nothing to grow their app store. As such it is a graveyard of shovelware. Do you want the latest game from Nintendo? It’s not on Amazon. In fact very few great apps or games make it to the Amazon App Store. And the ones that do are buggy. The developers aren’t debugging the issues that come up exclusively for Amazon devices. They don’t care about the tiny audience.

3. The Amazon version of Android is buggy and ugly

The ultimate reason not to buy a Kindle tablet is that the operating system is garbage. It’s buggy, slow, and ugly. For months, there has been a bug where if you click a book on your device that isn’t the most recently read book, it will just open the most recently read book. For someone like me, who reads two books at once, this is incredibly frustrating. Also, if you play an audiobook, then power off the screen, the audiobook will continue playing briefly, then stop. When you log in to your device again, a totally different book will be on the screen.

Loyalty punished…

I guess part of what makes this so frustrating is that I have been a loyal customer for so long. I’ve used Amazon devices for over a decade. I’ve purchased movies, TV shows, games, and hundreds of books through Amazon devices. To have the ecosystem devolve into unusability and irrelevance is frustrating. I know I can get the Amazon media apps, and the Kindle reader app on my new devices. That is good, but I am sad to go.

Anyway, I hope this post helps to inform your shopping.

Getting Lost in Pop

I’ve spent so much of my life making legitimately weird music. See my algorithmic music on bandcamp for that. So it’s only natural that at some point I would go completely in the opposite direction, and that time is now.

Lately I have just been loving pop music. I love listening to it. I love making it. It’s just fun. When making music in a pop style it’s really easy to find collaborators. After all, most musicians are trying to make “pop” in one way or another. And the collaborations usually run along predefined lines. e.g. “I’ll make the music, and you do the vocals.”

So that’s what I’ve been doing lately. Tons of collaborations on tons of fun pop songs. Here’s my latest on Spotify with Drizztopher Walken.

And these collaborations push me to explore more of my own ideas too. My daughters started listening to Galantis recently, a group that I fell in love with a few years back. And those two things have pushed me to make fun, danceable pop, and to even try to include my daughters (who are aged 2 and 4). Here’s my latest on SoundCloud with special appearances by both of my daughters.

So what does this say about me? Am I going to make pop for the rest of my life? Do I have bad taste in music? I don’t know. For know, I know that I’m having a lot of fun making pop.

It’s really difficult to write about E. M. Forster

When I started getting into A Room with a View a few years back, I kept reading it over and over again. In each reading, I would find something new. Something would be changed, revealed, or transmuted into something new. It was fascinating. But there were still things that I didn’t understand. Some of the places and artiss were obscure. Some of the referenced literature was very obscure.

I started taking notes on the novel. Whenever I came across something that was obscured by distance, time, or education, I would look it up online and produce a little note to myself about it. Eventually, I had enough of these to think, ‘hey, I should share these with other people!’

That’s where things got tricky. After all, I don’t want to share spurious or incorrect notes. I want to share notes that increase the enjoyment of the book for casual readers and fans. But how can I know if one of my notes is incorrect? How can I be sure that what I’m pointing out isn’t very subjective or obvious?

So I thought I should at least read his other novels to get some context. I read his first novel first. Where Angels Fear to Tread is, in most respects, not a great novel. But it does begin to reveal Forster’s unique approach to realism. Next I picked up The Longest Journey. That book is truly boring. It was a slog to get through, and I don’t know how anyone enjoys it without knowing a lot about Forster’s biography.

Then I read The Machine Stops, which is fabulous and unique and ahead of its time. So I thought maybe Forster had a particular gift for short fiction? So I read all of his short fiction that was in collections (which I know now is not all his short fiction). It was excellent, but there wasn’t very much of it. So I went back to the novels. I finished with Howard’s End, A Passage to India, and Maurice, each of which is a masterpiece in its own way.

Then I went back to my original task. I could finally say something about Forster’s most popular book from a position of authority, right?

Well, no. I soon learned that Forster produced even more essays and non-fiction than he produced fiction. I read his guide to Alexandria, and some of his essay collections. I couldn’t get through it all, and some of his collections are difficult to acquire these days.

Then I thought I should read a biography. So I read Wendy Moffat’s excellent book.

At this point, I’m years away from my original task. I have more or less forgotten that I ever wanted to say anything about Forster and his most famous novel. Still, I’ve realized that he also wrote a lot of letters, and the selected letters are available in bound collections. I’m duty-bound to read them, right?

I read as much of the letters as I could, but I think you can see the problem. It’s really hard to say anything with authority about a writer who produced such a massive volume of words as EM Forster. The novels, essays, non-fiction, lectures, and letters amount to such a vast quantity of work that I would put it up against even the most fecund modern novelists. It’s unbelievable.

Then there’s the critics, biographers, and academics. I can see how a grad student could get very dis-heartened. How can you hope to add to the vast discourse on such a popular, beloved author? …

I don’t know if I will ever finish taking notes on A Room with a View (and now Forster’s other novels too). All I know at this point is that the journey has become the goal. Reading and studying Forster’s work and the work about Forster has become a little hobby of mine. Maybe I won’t ever say anything about Forster, but I’ll have a lot of fun not saying it!