9 things every React.js beginner should know

I've been using React.js for about 6 months now. In the grand scheme of things that's not very long at all, but in the ever-churning world of JavaScript frameworks, that just about qualifies you as a bearded elder! I've helped out a few people lately with React starter tips, so I thought it would be a good idea to write some of them up here to share more broadly. These are all either things that I wish I'd known when I started out, or things that really helped me 'get' React.


Server-Side Rendering with React

Over the last 6 months I've been using React in a single page app project, and I've fallen in love with it. Of course, a big part of what makes React great is the magic it does in the browser with its Virtual DOM, but even for simple static pages it has some properties that make it ideal for server-side rendering:


Rust: Passing a closure to a trait object

I have an object which is a &SomeTrait, and I want to create a closure and pass it into a method on that trait. How do I make the types work?

In this post I'm going to go through my process of eventually figuring out the answer to this question, starting with a much simpler problem. If you just want the answer, then scroll right to the bottom of this post. Otherwise, read on!


Take it away and see

A project manager friend recently revealed to me their one rebellious streak - not writing reports. Working at a company where standard (and expected) practice was to provide x number of reports to y number of people, every single iteration, this PM was convinced that most of them went totally unread, and so writing them was both a waste of time, and adding noise.

So they just stopped writing the reports. Nobody noticed.


Highlights from Yow! 2014 - Day 2

This is the second half of my Yow! write-up, the first of which can be found here.

'Stop Treading Water: Learning to Learn' - Edward Kmett

I found the day two keynote a bit disappointing, to be honest. One interesting point that Edward had was that it's OK to have several topics that you're learning simultaneously, and to bounce between them, often covering the same ground multiple times, but going a little deeper at each visit. Re-learning the basics consolidates your knowledge, and you can approach the new material with a fresh perspective.

However, that was only 5 or so minutes out of an hour long talk, and the only part that was really about 'learning to learn'. Most of the rest of the talk felt a bit bit self-indulgent, with Edward just covering whatever material was most interesting to him, rather than what might be interesting or useful to the audience.

'The Lean Enterprise' - Jez Humble

Jez does a great job of pinpointing what smaller companies do a lot better than larger ones, and why it doesn't have to be so! He also gave a name to a phenomenon I've encountered before - Water-Scrum-fall. I plan to dedicate a separate blog post to this topic, but it refers to teams that take on 'agile practices' like standup meetings, without changing the waterfall core of their approach to software.


Bug Fixes for Christmas

Merry Christmas everyone! After all the lovely presents, food, and company I've had over the last few days, I decided to give myself one last gift - bug fixes!

When I put up my last post, I noticed some weird stuff happening with the post dates on the site. They seemed to be spontaneously changing, usually to the current date, and looking directly at the database, some posts were missing dates altogether! I wasn't able to nail down exactly what was happening, but I'm pretty sure it was something to do with my use of a default value on my mongoose schema, like this. My theory is that I was somehow ending up with existing posts getting into memory without their creation date, which was then causing the schema's default value to be applied upon a save. Or maybe it was because I was trying to do partial updates when I should have been doing a 'full-resource-put', again causing the default date to overwrite the existing data.

Either way, I eventually decided to remove the default value from the mongoose schema, and handle creation dates manually. I think taking out the extra moving part was a good decision, especially seeing as this wasn't the first time it had tripped me up - last time it was the fact that mongoose's Model.findOneAndUpdate maps directly to mongodb's findAndModify, which means that mongoose schema features like defaults and validators are not applied. This makes sense when you read about it, but I think it's surprising to newbies.


Highlights from Yow! 2014 - Day 1

A couple of weeks ago I was lucky enough to attend the Yow! Developer Conference in Melbourne. Here's a summary of my favourite talks from the first day.

'How Did We End Up Here?' - Martin Thompson and Todd L. Montgomery

This was the opening keynote, and it was a bit of a rant on why so many software projects fail, despite all the developments in software engineering over the last few decades. I took a tonne of notes from this talk, but here are my favourite bits:


Hooray for Continuous Delivery!

Continuous delivery is awesome!

The basic idea is that every single commit should be ready to go to production as soon as it's pushed. Continuous deployment takes it a step further, and has every commit immediately go straight to production, as long as it passes successfully through a pipeline of tests. In my opinion, continuous deployment is even better, as long as it suits your application.

So why am I celebrating? I put this blog live only a few hours ago, and just now I finished writing some changes to the underlying code. In order to get that code live, all I had to do was push it to GitHub and wait a minute or so, and I had full confidence that I wasn't going to break the site in the process. So what's necessary to make that work?


Hello, World!

Well here it is! The first release of my new website, powered by my new blogging software! It's all very rough and v0.0.1 at the moment, but I'm just glad to get something up on the internet, rather than just 'working on my machine'. I'm also happy to not be running on WordPress!

About me:

  • I'm Cam Jackson, a software developer/consultant from Melbourne, Australia. Currently working for ThoughtWorks Aus.
  • I always used to say my favourite language was Python, but these days Ruby is rapidly winning me over!
  • I also have a keen interest in DevOps and Continuous Delivery, from both an organisational and technical/tools standpoint.