Writing a Generic Type-Safe ng-bootstrap NgbModal Launcher

I just published my first post on the blog for Oasis Digital, the company where I’ve worked since September 2017: Writing a Generic Type-Safe ng-bootstrap NgbModal Launcher.

I describe how I used TypeScript and Angular types to implement a type-safe general modal dialog generator in ng-bootstrap.

Posted in Programming | Leave a comment

Beyond Tour of Heroes Talk

I gave a talk last week at Angular Lunch, an Angular user group in St. Louis sponsored by Oasis Digital (with whom I will be starting work as a developer and trainer after Labor Day).

In the talk, I start with the Tour of Heroes tutorial as a good example of a small Angular app, but then I show some of the additional steps that would be necessary to go to the next level for an enterprise-scale app, including modularization, replacing Promises with Observables, change detection, and integrating @ngrx.

I’ve posted the code and slides I use in the talk.

Unfortunately, the sound intermittently cuts out for a second or two on the recording, but I hope that the content comes through anyway.

Posted in Programming | Tagged , , | 1 Comment

Using enums to reduce boilerplate in ngrx

I really like @ngrx/store (especially combined with its companion, @ngrx/effects). Before I knew about it, my project team had been struggling to figure out a clean way to manage the data in a large Angular app. Fortunately, we attended a talk on Managing State in Angular 2 by Kyle Cordes, in which he walked through the different approaches to managing state (all state in the main component/splitting state between components/putting state in a service/bucket brigade/etc.) and how each of them fell short. We recognized each of those stages from our attempts to wrangle state in our app. He didn’t detail ngrx or the Redux pattern in that talk, but he pointed us in that direction.

When we started looking into the official ngrx example app as a guide, we liked a lot of what we saw, but we were also frustrated by the amount of boilerplate in the Actions and use of branching instead of polymorphism in the Reducer. I spoke with Rob Wormald at ng-conf 2017 about these concerns, and he said he knew that people didn’t like that about the pattern, but that nothing in ngrx required anyone to use those techniques; there just weren’t enough existing examples of alternatives.

In order to address these issues and provide the community with an alternative approach, I’ve released ngrx-example-app-enums to show how to reduce boilerplate with enums. I’ve also extracted the key files into ngrx-enums, a small library others could use to implement the pattern on top of ngrx.
Continue reading

Posted in Programming | Tagged , , , , | 2 Comments

ts-enums: Bringing Java-style enums to TypeScript

I’ve been working as a developer primarily in TypeScript for a couple years, and I really love the language. When I transitioned from Java to JavaScript in 2014, I loved the freedom and functional programming that JavaScript provided, but I missed the classes and types from Java. TypeScript has been a great intermediate language for me, giving me access to the web and functional programming, but with an optional structure that feels at home.

One area that was missing for me in TypeScript, though, was Enums. TypeScript has an Enum concept, but it’s nowhere nearly as powerful as Java’s Enums. Whereas TypeScript Enums are essentially namespaced groups of numbers (or strings, as of 2.4), Enums in Java are full classes. Not only can you create Java Enums that simply create a collection of namespaced strings, but you can also implement properties and logic for all of the instances (which I used to full effect in an article I wrote for OCI on extending them).

Continue reading

Posted in Programming | Tagged , , , | 1 Comment

Comparison of Angular 2 and React

As part of my employer’s Software Engineering Tech Trends series, I have collaborated with a colleague, Mark Volkmann, to write an article on Comparison of Angular 2 and React. In the article, we started with a small ToDo app that Mark wrote for an Angular Lunch meeting to demonstrate React. I ported the app to Angular 2, and then we compared and contrasted the implementations.
Continue reading

Posted in Programming | Tagged , , , | 1 Comment

Opening Words at the Ethical Society on Skepticism and SkeptiCamp

That’s a quote from a blogger named Angie Jackson, and it has been one of the most important quotes for me in my secular and ethical development. It really helps me consider how three important parts of my worldview interact: Atheism, Skepticism, and Humanism.

Continue reading

Posted in Skepticism | Tagged , , | Leave a comment

“Atheists in America” by Dr. Melanie Brewster

Atheists in AmericaAtheists in America by Melanie E. Brewster

Dr. Brewster’s book is an interesting collection of “testimonies” from non-believers of all walks of life in America. This book isn’t essential reading for an atheist or seeker to understand the relevant philosophical arguments, but it’s good for seeing how non-belief manifests in many aspects of life, with sections focusing on leaving faith, queer atheists, romantic relationships with theists, family and parenting, community, work, and aging.
Continue reading

Posted in Books, Skepticism | Tagged , , , | Leave a comment


新年快乐 – Happy New Year!

We spent the afternoon on Saturday celebrating the Chinese New Year. It was a great afternoon of a dragon dance, songs, and dancing. This isn’t something that’s part of my heritage or my wife’s heritage, so why did J and I do this for the third straight year? Because our boys are students at The Chinese School at the St. Louis Language Immersion Schools (SLLIS). Yep, D and M spend their days learning all their school subjects in Mandarin Chinese.

Continue reading

Posted in Douglas, Grounded Parents, Matthew | Tagged , , | Leave a comment

Good Cheer

Ethical Culture is a bit of an odd duck. It’s a non-theistic religion, or as I like to say, “the religion for people who don’t like religion.” The movement’s founder, Felix Adler, said that it is “religious to those who are religiously-minded and to those who interpret its work religiously, and it is simply ethical to those who are not so minded.” At my congregation, the Ethical Society of St. Louis, we express this as being a “Welcoming Home for Humanists”, where we focus on “Deed Before Creed”.

But what does this mean in practice? I was asked this in an interview for the Ask an Atheist podcast in the summer of 2013, when they visited the Ethical Society of St. Louis. I answered by describing what happens at the Society on a typical Sunday morning. But there’s another aspect of our community that I didn’t mention then, but that I experienced again last week: Good Cheer.

Good Cheer is the Ethical Society of St. Louis’s annual winter festival (other Ethical Societies around the country have different names and different specifics). We have several seasonal festivals throughout the year, and we also have a Thanksgiving Festival, but Good Cheer is our biggest seasonal event. That’s probably because it is closely analogous to Christmas, the biggest holiday of the year for the majority of American culture. So, what does Good Cheer mean for us? Food, Fellowship, Fun, and Festivities
Continue reading

Posted in Grounded Parents, Humanism | Tagged , , , | Leave a comment

“Contact” by Carl Sagan

ContactContact by Carl Sagan

Without even noticing, just as astronomy entered a golden age most people cut themselves off from the sky.

I saw the movie based on this book when I was a teen and it was in theaters, and I’ve been getting more into Carl Sagan the past few years. I’ve enjoyed watching Sagan’s Cosmos series (and Tyson’s sequel to it), and I’ve read some of Sagan’s non-fiction before. This was the first time I had read any of Sagan’s fiction, and I found it interesting – it has given me a lot to think about.
Continue reading

Posted in Books, Skepticism | Tagged , | Leave a comment