Barbarian Meets Codingbarbarianmeetscoding

WebDev, UX & a Pinch of Fantasy

What is New in Knockout.js 3.0 Lightning Round

I have been writing so much about Knockout.js lately that I thought it would be a disservice not to write about the release of its latest version, Knockout.js 3.0. I will write a lightning version, a fast and brief summary if you will, as better in-depth blog posts have already been written (see links below :) ). Without further ado, this is what is new in Knockout.js 3.0:

  1. Multiple bindings that affect the same element are evaluated independently, that is, changes in an observable no longer trigger updates in bindings that do not directly depend on it.
  2. Ordered bindings. The execution of some bindings is now done in a particular order to avoid WTF bugs. For instance, the binding value: selectedValue, options: choices would not work in Knockout 2.3, and debugging it would be a pain. This feature works for all built-in bindings and can be defined for custom bindings.
  3. You can now add an arbitrary pre-processing function to built-in and custom bindings. This function will be given the unadultered binding value before it is evaluated.
  4. Likewise, you can now add a node pre-processing function to the binding provider that will be executed for each node within the document before it is processed for bindings. (This is used in knockout punches to add support for handlerbars syntax).
  5. Knockout now supports dynamic binding handlers. You can override the new ko.getBindingHandler function that determines which binding handler to use and add bindings on the fly.
  6. New checkedValue binding that extends the functionality in the checked binding to support objects (the latter did only support the input’s value property, that is a primitive)
  7. An experimental version of observable view models, that is, switch the entire view model and update each individual binding separatel.
  8. The options binding now generates a change event, if changed (as when we remove the selected item), it will trigger updates in other bindings such as value or selectedOption.
  9. New arrayChange event that makes it super easy to figure out has an observable array has changed.
  10. Support for binding to detached nodes
  11. Support for arrays of observables in addition to observable arrays.
  12. The optionsCaption binding is now HTML encoded.
  13. Is fully (very) backward compatible

In summary, new and awesome extensibility points, performance improvements and minor yet nice bug fixes and usability improvements.

Note that much better blog posts by most experienced people have been written about this new version, so, if you have some more time to spare, please check Steven Sanderson’s Knockout.js 3.0 RC and Knockout.js 3.0 Beta blog posts and Ryan P. Niemeyer’s blog for more in-depth information and a very good screencast.

Barbarian Meets Knockout: Knockout.js Computed Observables

The “barbarian meets” series are a collection of articles that intend to introduce and explain useful libraries, frameworks, tools and technologies in simple and straightforward terms. These new series will focus on Knockout.js, the popular JavaScript MVVM library

Hi everyone! Time to continue learning knockout.js! This time I will write about computed observables, a special kind of Knockout.js Observables that allow you to calculate values in the client from other properties of your view model with one nifty special feature: A computed observable will listen for changes in the observables it depends of and recalculate its value when these observables change.

Read on →

Barbaric October: Writing an iOS Game With SpriteKit

Barbaric Monthly is my attempt at building/improving a coding project per month so that I can experiment with old and new technologies, learn ad infinitum, remain excited about the craft and nurture my passion for software development. This Barbaric Monthly is about practicing Objective-C and iOS development building a game using SpriteKit.

Hello people! Time for some coding fun XD

Taking advantage of the fact that I am going to be coordinating the development of an iOS app at Medius, I decided that it was the perfect time to learn me some Objective-C and iOS development. So after looking at some courses at Pluralsight and the CodeSchool, I think I am going to build something to imprint all these fleeting knowledge in my head and typing muscles, before it vanishes for ever.

The idea is to build a game and an app and publish them in the App Store before the end of the year (good luck dude XD). I am going to start with the game and use SpriteKit, a brand new game development framework released with iOS7 that comes with all the goodies one needs to build a 2D game: asset management, physics and particle engines, etc.

After doing some short brainstorming (and feeling inspired by the Jumping Into SpriteKit tutorial) I have decided to go with the cute-human-like-space-ship-stranded-in-the-void-searches-for-home-and-finds-earth-that-was-turned-to-cinders theme. Here is some concept art:

Concept art for iOS SpriteKit game

The game dynamics will be based on some sort of free-exploratory-space-shooter of sorts. Check the first ever screenshot of the game (and be merciful):

iOs SpriteKit game screenshot

Ok, let’s get to it, wish me luck :)

P.S. for the people at work: Yes… I know you people from work feel sad that I have abandoned the Cat-Zez game xD but be patient xD I will write that Cat-astrophic game in the future, as my second iOS game ;)

Some great resources to begin learning node.js

For a while now I have had one eye on node.js, looking in the distance and oftentimes thinking hmm… it would be cool to find some time to take a look at that technology :)… but never actually doing anything at all. A couple of months ago however, and with the excuse of participating in east sweden hack, I found the perfect opportunity to start dabbling in node. (yey! ftw!)

After some experience with node, and with the fresh eyes of a newbie that hasn’t yet bumped into those painful areas that every technology has, I must say I love it. I love the vim/cli combo, the speed (or perceived speed) of development, the culture of automation and the rich library ecosystem. So much so, that I am looking forward to continue learning node and will definitely use it in my upcoming side projects.

Ok, to the meat of the blog post. Here are some of the resources I used to learn what little I know about node.js.

  • Real Time Web with node.js at CodeSchool provides the easiest and most straightforward way to start learning node since you don’t need to install any tooling. As usual, they provide a friction free, interactive learning experience where you just need to watch a series of videos and complete the different challenges in their web-based editors. This course is probably your best bet as a beginner in node.js.
  • Introduction to node.js at Pluralsight covers more or less the same content as the previous course, but with an awesome addition: all course demos are shown using the awesome Cloud 9 IDE. This means that, with this course you are going to get more of a taste of how to develop real node applications feels like, but still without actually needing to install anything on your machine.
  • Web Development with ExpressJS at Pluralsight provides an introduction to developing web applications with the Express.js framework using the Jade template engine, the Stylus css preprocessor and JetBrains WebStorm as IDE. Probably the most practical course of these last three.
  • Let’s code Test-Driven JavaScript was a great surprise. Being the fan of TDD that I am, it was great to find a reference of this discipline in JavaScript, since it has been giving me some headaches when coming from TDDing in C#.
  • Yeoman is not a resource per se but it is so awesome that I could not resist to add a reference to it here:

Yeoman is more than just a tool. It’s a workflow; a collection of tools and best practices working in harmony to make developing for the web even better.

Our workflow is comprised of three tools for improving your productivity and satisfaction when building a web app: yo (the scaffolding tool), grunt (the build tool) and bower (for package management).

Check this video for an illustrative introduction to how to use yeoman:

Finally, you can find a super extensive list of resources contributed by the node.js community at StackOverflow.

Packed September: Paris, Kraków and my first hackathon: East sweden Hack

Wo! This year’s September has been crazy! I think I have never ever done so many stuff in a month before: travelled to Paris with Malin, participated in my first hackaton, travelled to Poland as part of my job at Medius (the Kraków office is freaking awesome btw), rid horses, ran races… uff XD

East Sweden Hack

East Sweden Hack 2013

As I said above, this month I had the opportunity to participate in my first hackathon and I must say that it completely blew my expectations out of the water by being unbelievably awesome :). The venue, the food, the organizers who did an outstanding job, coaches, my teammate, the other teams, everything and everyone was great. If you ever get the chance to join one of these events, don’t hesitate; you are going to have a blast. If you are going to remember something after reading this blog post, let it be just that :).

Kristofer Gustafsson and Jaime Gonzalez, Team Inspirr

As you may know, hackathons usually have a topic, which oftentimes is related to using some API or technology provided by the sponsors of the event. In this case, the city of Linköping, the county of Östergötland and diverse state related entities provided a series of open data APIs to help us improve, in some way, the lives of the inhabitants or the occassional visitors of this area of Sweden. So, with that premise in mind, and the limitations imposed by the perhaps a little bit uninteresting APIs we decided to build a local recommendation engine, which we called Inspirr.

So, following our own personal agenda, which was to geek out and tinker with new technologies, we went and built Inspirr with the MEAN stack (as in MongoExpressAngularNode) or to be more accurate the -EAN stack, since we did never get the chance to setup a DB xD. Below is the result for you to see and try:

Inspirr Screenshot

The hack in itself was a blast, we performed the kind of development that I love (or almost, we did abandon TDD quite fast due to our limitations in this completely new stack and the time constraints XD), being laser focused on our MVP, growing the application as if it was a living entity, iterating fast, deploying to production (heroku) every hour…

Here is our final pitch. Beware of my dreadful Swedish xD.

As I was cycling home, I couldn’t help but to think that I had taken part in something special. ^_^

It’s looking like October will be a much calmer month and one ideal for programming! :) I am looking forward to start working on a new side project. I’ll keep you updated. Good night!