The nested factory pattern

When writing code, I try to structure my project in such a way that it’s impossible to misuse. I often run into cases where I need some class to be responsible for instantiating and managing its own resources, such as a message hub (which needs to maintain a list of subscribers) or a tweening engine (which would need to update and dispose of tween control objects according to a timer). In these cases, I like to ensure that these objects can never be created outside the class which manages them.

A simple solution, of course, is to use internal constructors, but I personally prefer to avoid using the internal access modifier whenever possible, as I find it does a poor job of signalling the intent of the code, and in many cases is just a band-aid fix for a poorly planned access scheme. Furthermore, in cases where the class in question will only be consumed within the same project, internal is essentially no different than public.

My solution to this problem is as follows:

Continue reading →

Japanese Reading Report

This week I just read one volume of manga, 怪物事変 vol. 2. Kon is great. I love every scene with her. Shiki and Akari have gotten less annoying too.

Most of my reading was from 雷の季節の終わりに, which I managed to stay on track with this time. The story has picked up and I’m quite enjoying it now; I’ve been feeling compelled to pick it up more often so I’m feeling a lot better than last week. Compared to the other two books I’ve read by this author, it definitely took its sweet time building up the setting and laying the foundation, though I guess that just comes with the territory of long-form fiction rather than the short story format I was used to.

Japanese reading report

This week I read three* volumes of manga and started a new novel.

First up was 古見さん vol. 20, which I really enjoyed (they need to release these faster! seriously there are like six months of chapters that haven’t been collected yet). I think I picked up a bit of skiing-related vocab and that’s about it. I liked how they subverted the typical ski trip disaster and came up with something a bit fresher. Also Hitomi needs to be nerfed.

Next was ヨコハマ買い出し紀行 vol. 5. Still really good. It’s surprising how understated the “post-apocalyptic” elements are; it’s a real slow burn and I have a lot of respect for the way the storytelling and worldbuilding is done.

My last manga of the week was 罠ガール vol. 1 (I’ll actually finish it as I fall asleep tonight). It’s pretty interesting; set in a seemingly realistic 田舎町 and written by an actual farmer apparently. Each chapter has to do with trapping animals in various ways, and then (more often than not) actually killing and eating said animals. It’s definitely not the standard fare for a cute-girls-doing-cute-things manga so the incongruity was a little odd at first, but I’ll probably keep reading it at some point.

My next novel is 雷の季節の終わりに, which I’ve been wanting to read for a while. For some reason I had a really hard time getting started with it though…not sure if it’s just more difficult than I’m used to or if I’m still in a bit of a slump. I was planning to read it at a pace where I would finish it by the second week of April but I decided to slow down and take the whole month. Reducing my daily goal down to 8 pages helped me feel a little less overwhelmed and I actually ended up reading a little over, so hopefully that fixes things. I’m only about 55 pages in, but so far the worldbuilding is interesting and that’s the main appeal of a 恒川光太郎 book to me, so I’m looking forward to the rest of it.

Book review: 京都寺町三条のホームズ vol. 1 (Holmes of Kyoto)

About halfway through my watchthrough of Holmes of Kyoto’s anime adaptation a few weeks ago, I found myself checking Amazon Japan on a regular basis to see if the first book in the series would happen to be listed for free (as occasionally happens for promotional purposes). It got to the point where I literally decided to buy it instead of waiting just because I was getting tired of checking. And so, once I finished 風の道しるべ, I jumped right into this series and finished book 1 in just over two weeks, finally catching up to my novel goal with three books down.

As much as I enjoyed the Holmes of Kyoto anime, the main thing running through my mind as I read the book was “the show did not do this justice”. Between the mysteries and character moments that make up the majority of the screentime, we also get tidbits of local history, descriptions of various locations visited throughout the story, and small vignettes with characters who, despite having no major importance, help deepen the overall experience. The author mentions in the afterword that she started writing this series out of a desire to share the beauty of Kyoto, and it shows.

The anime covers material from the first three books, so naturally there was a lot of review here, but there were also a fair few scenes which I don’t remember from the anime at all; my favorite involved a confession of love, and then a rejection of that confession, both performed through the medium of tanka from the One Hundred Poets where both parties relied on the subtext of each poem, rather than the literal words, to send the desired message.

Before I had finished reading the last chapter, I’d already gone back and bought the next five books, so it goes without saying that I’ll certainly be continuing with this series. There’s also an official English release, which I’m sure is also good; if I’m not mistaken, the translator was chosen during the Manga Translation Battle contest, and the samples I saw looked quite well-done. Heartily recommended.

Japanese reading report

Had a really hard time focusing this week. Theoretically I had a lot of opportunities to read but there were lots of times where I sat down with my book and barely made any headway at all. Fortunately this weekend I was able to do some catchup this weekend and finish 京都寺町三条のホームズ vol. 1 on time. Chapter four gave me a good thrashing since it dug pretty deep into the history behind three historic wall scrolls and their artists, but I persevered. I’ve been enjoying all the 関西弁 quite a bit; thinking I might make a point of reading more of it (I have 極主夫道 and うちの師匠はしっぽがない in my backlog but have been hesitant to start on them since they’re very dialect-heavy). Anyway, I’m glad I stocked up on the next few books because I’m definitely planning on continuing the series in the near future.

Also watched four more episodes of 五等分の花嫁 (9-12) but I don’t really have anything to say about it besides that it’s cool to revisit the series with full knowledge of what’s to come.

Japanese reading report

This week I decided to majorly up my pace through 京都寺町三条のホームズ vol. 1, reading 10 pages per day minimum and bringing me up to 52%. It’s become very obvious throughout that the anime (which I already quite enjoyed) doesn’t really do the book justice. I’m enjoying myself very much and will definitely be continuing the series once this book is finished. Being set in Kyoto there’s quite a lot of 関西弁 at times, but so far it’s been pretty easy to pick up based on just being familiar with similar patterns in standard Japanese.

Right after my last report I read 片腕のエイミー, a really sweet little oneshot that was free on jump+. Don’t really have anything to say about it other than it was great.

Watched five more episodes of 五等分の花嫁 (3-8), which puts me past the point where I initially quit watching the show with subtitles and started reading the manga way back when.

For manga this week I read 僕の心のヤバイやつ vol. 2, which is still weird. It’s less weird than the first volume though. I also read ホクサイと飯さえあれば vol. 1, which captivated me pretty early in the first chapter. I’ve been looking for a good cooking manga and this one seems to fit the bill perfectly.