Herding Code 178: Async, C# Syntax, AngularJS, Document Databases, Podcast Hosting, A New Job and Summer Vacations

The guys chat about Async, .

Download / Listen:

Herding Code 178: Async, C# Syntax, AngularJS, Document Databases, Podcast Hosting, A New Job and Summer Vacations

Show Notes:

  • Async: Our Generation’s Goto Statement?
    • (00:19) Jon introduces a listener question referring to .
    • (00:52) Kevin says he thinks the Callback Hell problem is overblown. In the Node world, there are flow control libraries like Async and good practices.
    • (01:51) Scott K agrees – using named rather than anonymous functions solves a lot of problems he sees. He asks if things would be better if everything was Async by default. Jon says he thinks Async-creep and Async by default push you down a better path most of the time. Kevin says since Node’s always forced that pattern it’s been simpler.
    • (04:40) Kevin says he Async / Await only address simple cases where you want a series of steps. Flow control libraries allow for more complex flow, parallel operations, etc. Jon talks about how multiple async operations can get complex pretty quickly – dealing with error conditions, timeouts, etc. and Scott K points out the difference between parallel processing and async.
  • C# Syntax and Xamarin Speculation
    • (07:42) Jon says there’s room for a lot more syntactic sugar in C# – not just async, but dynamics, chained null checking, etc. Jon and Scott K talk about the benefits and limitations of the null coalescing operator (??).
    • (10:50) Scott K says async may be the next TDD in terms of driving good design.
    • (11:47) Kevin wonders when Xamarin will cut the cord and begin innovating on C# separately from Microsoft. The guys discuss some of the things they’ve been doing – repl, SIMD support, etc., but Jon points out that it’s all innovation at the compiler level, not on the language. Scott K talks about how our recent interview with Jon McCoy talked about modifying IL, and wonders if Xamarin will get into doing that kind of thing. Kevin asks what benefit Xamarin gets from keeping compatibility with Microsoft. Jon doesn’t buy it.
    • (15:01) Scott K wonders if the C# spec or compiler were open enough that people could innovate on it. Jon thinks Roslyn could do that, but he’s just making stuff up.
  • AngularJS – K Scott’s impressions
    • (16:36) Jon asks K Scott about his recent experiences with Angular. K Scott says that most things are easy, but hard things get complex, so he’s been reading the source code. He says the source code is mind bending. There are a lot of different ways to accomplish something – binding, watching, raising events, etc. – and it’s hard to know what’s going to work.
    • (18:33) Jon refers to the Ember / Angular Cage Match at NDC and how Angular worked great until it was time for a directive, and that got trickier. K Scott says there’s room for some polish on the Angular API. For instance, there are 3 or 4 ways to register a service.
    • (19:40) Jon asks K Scott if he’s used Ember and how he’d compare them. K Scott says he’s invested Angular and hasn’t had time to dig into Ember. He says Ember seems to provide more of a path for users, whereas Angular seems more tacked together.
    • (21:02) Kevin asks how much people become locked into a front end framework. K Scott say
    • (22:00) Scott K says most of the complaints about Angular are around changes to the API and documentation over time.
    • (22:48) Scott K says it seems like Ember examples generally require more code. The guys discuss the balance of declarative code vs. magic that sometimes goes off the rails.
    • K Scott says he sometimes gets flashbacks to ASP.NET Web Forms controls. Kevin mentions HTCs in Internet Explorer and Jon says it seems like things are coming back around to that kind of thing with web components. K Scott says there are pretty good separation of concerns to directives, but directives can be really hard to extend – you want to tweak one thing and pretty soon you’re reimplementing a lot more than you wanted to.
  • Document Databases
    • (26:36) Jon says he got to use Redis on a project and talks about his experiences. K Scott’s been using Mongo for a hospital system. Kevin says he hears people complain about Mongo, K Scott says performance and diagnostics can be frustrating.
    • (28:53) Kevin’s used it for Greater Than Parts and at his new job. He says the biggest mind shift is in how you model things. Jon says that was the biggest thing he learned – it’s not just a pile of documents, you still need to model things. K Scott says migrations and configuration management are important.
    • (31:39) Kevin asks K Scott how they’re working with lack of transactional integrity. K Scott says fortunately not, everything’s bulk loaded in this application.
  • Kevin’s new job at Brandcast
    • (32:26) Jon asks Kevin about the new job. Kevin’s working at Brandcast. Their mission is to make it really easy for people to set up a web presence that works well on multiple devices without any technical background. It’s a small shop running Node and Backbone. Kevin’s gone from being the young guy at his old company to the old guy at the new job.
    • (33:47) Jon asks Kevin about the process and structure there. Kevin says there’s a test server, but they’re pretty aggressive with continuous deployment.
    • (34:39) Jon asks if they’re using frameworks on top of Backbone. Kevin’s used Marionette, They’re using Backbone Layout Manager and Supermodel.
  • HerdingCode.com Operations Report
    • (35:36) Jon gives an update on the Herding Code website and hosting setup. We’ve been running for over five years on an el cheapo WordPress account.
    • (37:00) Jon’s been using CloudFlare to do some front-end caching and security blocking.
    • (37:50) Jon talks about some of the security things he’s set up, including a plugin to lockout IPs after incorrect logins, long password and OpenID login.
    • (38:33) The new release of WordPress uses MediaElement.js to use HTML5 audio with Flash / Silverlight fallback, and Jon extended that using some JavaScirpt to show a play indicator in the browser tab when audio elements are playing.
    • (39:51) There’s a WordPress plugin to show a mobile friendly theme.
    • (40:50) Kevin says the times we’ve run into trouble have been CPU related. Jon talks about the different layers of caching – Cloudflare on the front end, W3 Total Cache on the backend.
    • (44:12) Scott K asks about what kind of value adds a podcast app could add, beyond just an audio player.
    • (45:58) Jon says that the only thing that does change on the site is comments, so he’s outsourced that to Disqus. Scott K and Kevin talk about how Disqus has been heading downhill by inserting stupid ads, or "climbing douchebag mountain" in Kevin’s words.
  • Summer Report
    • (49:30) Kevin asks what everyone’s done with their summers.
    • (49:37) Scott K had to update a Monorails site using the Brails engine. The biggest frustration was that in the latest rewrite, they pulled all the documentation and source for old versions – even the NuGet packages. Kevin says that’s why he’s not a fan of including package managers in deployment – things can disappear from the feed and you’re screwed. Jon tells an old story about a stored procedure that called a COM object to split comma delimited strings.
    • (53:42) Kevin got a new job and travelled to Paris and Switzerland and San Diego.
    • (54:02) Jon went to NDC, then worked on Scott Hanselman’s keynote demo at BUILD, then went on some family vacation time in New Jersey.
    • (55:21) K Scott worked a lot but says he’ll have exciting stories later. The guys congratulate him on all the press about his Pluralsight courses.

Show Links:

  • markheath

    nice show, very interesting as always. BTW I couldn’t get the podcast to play in the widget (using Chrome, Win 7). Play icon does show up in the titlebar though 😉

    • Strange. It’s using MediaElement.js, so it’s just an HTML5 audio element wrapped with some styling elements.

  • Nice show, but I’m surprised to hear no mention of RavenDB in the part on document databases, considering that it’s pure .NET, uses JavaScript for things like migration scripts (and others), and supports the kind of transactions you were talking about missing from MongoDB.

    • TheHulk

      I am guessing they discuss only open source and not commercial ones…

      • RavenDB is dual licensed open source / commercial. But so are MongoDB and MySQL if you want their Enterprise editions. Besides, they’ve talked about SQL Server many times, which is certainly commercial, and they’ve had three shows (83, 154, 159) specifically about or mentioning RavenDB already. It’s not like I expected to hear that whole thing rehashed, but they specifically pointed out pain-points in document databases that RavenDB solves so at least a mention would have been appropriate.

        • K. Scott Allen

          We only talked about MongoDB since Kevin and I are both building products with Mongo. RavenDB is fantastic, we’ve had Oren on to talk about it in shows past.

      • Not at all! We’ve done a few shows with Ayende on RavenDB. This was just a quick discussion of some we’d used lately.

        • That’s cool. The only part that got me going was around 32:23 about transactions. Although now I listen again closely I see this was more about Mongo specifically, so I guess that would be accurate. 🙂

  • Hey, since you touched on async in JavaScript – what do you guys think of Kris Kowal’s q.js lib?

    • K. Scott Allen

      q.js is great. Angular provides something similar (inspired by q, actually, but not as fully featured as q). I can’t imagine not using promises today.

  • Donatas Mačiūnas

    What kind of difficulties are there with not so simple cases with async/await?

    var taskFromDB = db.GetSomethingAsync();
    var taskFromWS = client.CallWSAsync();

    await Task.WhenAll(taskFromDB, taskFromWS); // There is also WhenAny

    DoSomethingWithResults(taskFromDB.Result, taskFromWS.Result);
    This is async as well as parallel and you can also easily wrap it with try/catch block. In short it seemed like you guys didn’t give async/await enough credit 🙂

  • mbergal

    Warning: I am not an expert.

    Monads “glue” computational expressions (functions) into workflows (calculations)
    Maybe monad glues possibly null expressions into workflow (calculation) that returns null or result.

    In C# LINQ from … is a syntactic sugar for monadic workflows (calculations).

  • Vaccano

    Seems that the time stamps listed in the writeup do not match at all. The writeup says :

    (22:00) Scott K says most of the complaints about Angular are around changes to the API and documentation over time.

    But the discussion is centered around the the website’s hosting and Angular is not mentioned.

    I am new to the podcast, am I misunderstanding what the timestamps are supposed to mean?