All posts by David Saltares

Book review: Clean Code

clean code uncle bob

I recently had the pleasure to attend a few lectures by Robert C. Martin, also known as Uncle Bob. He’s a software consultant, speaker and fierce advocate of agile methodologies as well as TDD. Not only were the talks entertaining, but also deeply inspirational.

Seeking more information on his ideas, I decided that it would be good to take a look at his flagship book, Clean Code.

And so I read it.

It has definitely changed me as a developer. I cannot look at code the same way anymore.

Clean Code offers a set of very simple guidelines to help us improve the quality of our codebases little by little.

You start by looking at that unholy class nobody dares to touch. Once you get the gist of it, you realise some methods and variables should be named differently, for clarity’s sake. Immediately after, you identify some duplication and factor that out into a different function. Later on, you decide that a particular method is too big and it should be broken down. Maybe this class is doing too many things, lets split it up into smaller classes that do one thing and one thing only.

Oh my God, suddenly that monolithic satanic pile of garbage has been tamed. Future developers (including yourself) will be able to understand it and work with it much better.

Hang on! How can we make sure that it still works?

Unit tests!

As developers, it is very much our professional duty to work in such a way that allows us to thrive in the long run. We can only deliver and maintain a large project if we keep things under control. Doom is certain if we do things quick and dirty and absent discipline.

Clean Code is far from being the panacea but it does provide us with quite a few tools to work towards that goal. Uncle Bob exposes the reader to several practical exercises. A piece of bad code is listed, studied and refactored step by step until it becomes a much readable, cleaner and correct chunk of work.

I personally loved the book as it is fun, positive and tremendously useful, cannot recommend it enough.

By the way, you can ready more by Uncle Bob on the 8th Light blog.

Libgdx at Kingston University

kingston phones

Last Monday 24th of November I delivered a small lecture about Libgdx at Kingston University of London. This complements Alberto’s Libgdx workshop at Cadiz University last week as part of a series of activities to promote Libgdx and our recently released book.

I talked about what Libgdx can offer developers as well as the advantages of using open source tools as opposed to proprietary technologies, especially when it comes to students. Just like in Alberto’s talk, we gave two copies of our book away to a couple of lucky students!

Sadly, no pictures were taken this time round, you’ll have to take my word when I say that quite a few people showed up. Thanks for that!

As promised, here are the slides in case anyone is interested.

Libgdx workshop at Cadiz University

flappy plane

Alberto Cejas, colleague and co-author of Libgdx Cross-platform Game Development Cookbook delivered a Libgdx workshop at Cadiz University (Spain) last Friday 21st of November.

During a 2 hour session, the students put together a bunch of pieces to build Flappy Plane, a Flappy Bird clone originally developed by Mario Zechner. Moreover, there was free stuff! Alberto did a small raffle and gave two copies of our book away.

javaw 2014-11-25 19-57-44-35

We’re really happy with the turnout, just take a look at the gallery below!

If you’re interested in an easy introduction to Libgdx, feel free to check the GitHub repo where we’ve uploaded everything: slides, code and exercises.

Many thanks to everyone who turned up!

Ashley 1.3.2 released


More features, bug fixes and improvements for Ashley entity framework on this new release.

  • API addition: we now use a builder pattern to create Family objects. More about it on the wiki.
  • API addition: new SortedIteratingSystem by Lusito.
  • API addition: now ImmutableArray implements the Iterable interface, which makes it a lot easier to iterate over entity collections.
  • Bug fix: avoid double entity removal by accident.
  • Bug fix: fixes StackOverflowError when processing entity operations.
  • Bug fix: fixes freeze when calling removeAllEntities().
  • Improvement: we made a bunch of changes that increase performance.

The new nightly dependency is com.badlogicgames.gdx:ashley:1.3.3-SNAPSHOT.

Big thanks to our awesome community!

Upcoming talk at Kingston University


I’ll be delivering a small presentation to the games development students at Kingston University of London on Monday November 24th. The reason behind the talk is the recent publication of our Libgdx Cookbook, which is why I will be giving away two hard copies! Come along to hear me preach about all Libgdx things.

Naturally, I’ll post the slides here for whoever’s interested.