Image for post
Image for post

When I first started working with Go, I wrote a blog post on “bypassing Go’s lack of constructors”, or initialisers as they’re known in Go.

Go doesn’t support traditional default constructors, but it does provide constructor-like factory functions useful for initialising types.

This post is effectively a part II where I basically do a 180 on my original idea in the post linked above. But first, why the original post?

Avoiding nil pointers

Go has a lot of strengths as a language, from a simple userland concurrency API to being very quick to set up a microservice communicating over HTTP with only the built-in webserver, which is production ready, or very easily over RPC with other microservices with something like protobuf. …


Image for post
Image for post

I’ve been writing Go for around a month now as for me it was a requirement that I get to learn it as a part of my new role at Sixt. One of the more interesting or frustrating aspects of the language, coming from a PHP background, is the ability to initialise objects in an invalid state.

Coming from an OO language, I am used to the ability to define constructors on objects — static methods that are an entrypoint into building an object. …


Image for post
Image for post

It’s been a while since I wrote a blog post, (actually, this is my first, I have no excuses!), but I really wanted to touch upon asynchronous programming in Swift. Most of the code you write in Swift must at least take asynchronicity into consideration at some level. When updating the ui after some computation that typically does not belong in the controller layer, even then you have to think about where the correct place for this piece of code should be.

Updating UI on a thread other than the main thread is a common mistake that can result in missed UI updates, visual defects, data corruptions, and crashes.

About

James Mallison

English Software developer. I love Golang, PHP, Swift, Open Source. Conference Speaker.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store