I’ve been interested in learning more about functional C#, and how it differs from the OOP style C# that I’ve been doing for years. Ed Charbeneau gave a talk on this topic at CodeMash back in January, the main lesson being how to score a poker game using C# and functional principals and the samples. In this blog entry I will be reviewing a few of the functional principals I took away from the presentation— there are many more but here’s a short list: Continue reading “Functional Programming with C#”
Yes, it is that type of blog post. I have been attending conferences for almost 20 years now in varying industries and for the most part, I truly enjoy the experience. However, there are a couple things that simply infuriate me that I keep noticing more and more frequently.
In my Observables in Parallel blog post I discussed how I’ve been moving away from Promises in favor of Observables and how to translate functionality from promise-based solutions to observable-based solutions. The aforementioned blog post discussed how to wait for multiple Observables to complete before performing some action. In that scenario all the Observables were independent of each other, meaning none of the Observables depended on the results of another.
In this blog post I’m going to discuss how to use Observables that do depend on a different Observable to complete before executing – AKA Cascading Observables. One such use case scenario for Cascading Observables is when you need to call a web service to get some data, then use that data to call another web service, all in a single operation.
Every year when I go to CodeMash, I try to do a pre-compiler session on something that makes me uncomfortable or I know little about. This year, it was the Science of Great UI session presented by Mark Miller (@greatui). I am not completely lacking in artistic ability, as I can play quite a few musical instruments well, but when it comes to visual art, I am beyond deficient. I know CSS and if you give me a design I can make it happen, but to say that I do not have an eye for design is a significant understatement. Thankfully, there are folks on our team with better design taste to save me from myself.
Since observables are being heavily pushed in Angular 2 I’ve been spending some time getting acquainted with how to use them. Specifically I’ve been “translating” from a promise-based solution to an observable-based solution for certain functionality I’ve been using promises for. In this blog post I’m going to address how to utilize observables in parallel.
When I say “observables in parallel”, what I mean is multiple observables that are called all at once with the calling code waiting for all the observables to complete their respective actions before continuing. With promises you could create an array of promises, then utilize the Promise.all() function to wait until all the promises have completed before moving on. Each individual promise would utilize the .then() function to do whatever needs to be done with that promises’s results.
We have a Mongo Database and in that database we have an ‘items’ collection which has five string fields and a number of ID fields. We’ve added 250k records to this collection and started testing the time it takes to perform various queries on these fields. Simply adding indexes on the ID fields makes those types of queries lightning fast, however, we had a number of issues dealing with various string queries. This is a record of our findings.