Flash Friday – A Simple List

The structure of a simple listA few people who’ve worked with me in a programming job may have heard me talk about how a custom list should be done. For performance reasons you don’t want to recreate the visual “cell” n-times. That could lead to all sorts of unforeseen problems. Instead you want only enough cells to be visual during scrolling and as you scroll through the list just bring the “cells” round to the other side.

One of the people I work with, Alec McEachran, wrote a blog post  on just this topic. It is entitled “A Simple List” and I’ll let you read his article and code on the subject. What is interesting about his code  for a list is he does a great job keeping the list class very simple. It keeps to a pretty narrow responsibility. He’s quite good at solutions with well defined class responsibilities.

In our current project, Monster Galaxy, we have used this code in a few places. It has been modified for our purposes but at the base level described in his article the code makes custom list designs easy to implement.

Alec is a very intelligent programmer and has some other great articles on his blog. If you like what you read there you might also like to follow him on twitter (@alecmce). Of course, his twitter feed carries a lot more of his opinions and personality. It’s quite fun though, I promise 😉

Of course, I have a blog as well which you are reading now and thank you for that. If you haven’t done so already, follow me on twitter( @diacre ) to find out about new blog posts as well as my opinions and personality ( which you may or may not find as colorful as Alec’s ). Please let me know in the comments what you think of Alec’s list class. If you have a different solution that you like I’d love to hear that as well. Until next time…au revoir.

 

Advertisements

2 thoughts on “Flash Friday – A Simple List”

  1. Thanks for that! The list is a work in progress (what isn’t?) and any feedback would be really appreciated. We’ve already changed it for our purposes on Monster Galaxy, and I feel that there are further iterations to be made. I will try to feed that back into the github repo once the changes we make are more settled. In the meantime – Daryl and anyone else – please fork it and improve it!

    Oh, and I’d say you are at least as colorful as me Daryl 😉

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s