Week 14 – Strings, Lists and Dictionaries

Weekly Learning

This was a very interesting week. I think we ran a bit ahead of ourselves when we built our game and it meant we didn’t have much of an opportunity to add more lists and dictionaries. I don’t think that was necessarily bad, but it gave me the opportunity to also cleanup some of the code and make smarter choices. I got to also see some of the solutions from my classmates. Some of them introduced already classes, and other very nice structures into their games. I don’t think that is a bad idea, but i do think it’s not necessarily as useful in a context as small as this game. It could certainly make things easier for some of the manipulations we’re doing like keeping track of user inventory. But to me, more important than classes, is make sure the code is highly maintainable and scalable. On that, I’ve been doing a lot of a reflexion. Without a loader or storage, class data structures are limited on what they can do in the scope of this game. So you end up essentially replicating the same functionality that a dictionary would have with the added overhead and complexity of a class.

Dictionaries and lists are less than ideal as well, but in this case, they are just good enough to make the code highly maintainable and scalable. The small changes we made to add better inventory management, and cleanup event handling proved it right to some extent as the refactor was swift and effective.

I think one of the most important lessons I got from this game exercise is that abstraction for the sake of abstraction is not a good pattern. Abstraction must aim to solve specific problems, and those problems must be derived from the data that is being used. In this case, things like Rooms, and Inventories, and Hero states are the data, so our abstractions were to make that data manipulation easy, effective and expandable. Mike Acton puts it far more succinctly in his presentation on Data Oriented Design presentation.

The second exercise of text parsing and word counting was equally interesting. I have always had a special place in my heart for parsers and I wrote an xml and html parser many years ago. This was a bit different, we just wanted to get the headlines, and since structures didn’t need to be kept or maintained, a lot of those learning didn’t really need to apply. But it’s always fun trying to solve those sort of puzzles. Trying to find the start and end of a tag, and run searches over strings is an interesting task as you unravel what is useful and how it’s useful.

I love the topics of this class. I wish it was a bit longer of we spent more time or used better tools for each specific issue. JES is so limited on what it can do, and python is less than efficient for things like image manipulation. But I believe that overall the point of the class is to get us to understand why and how this files and systems work and on that, it’s done a great job at peaking my interest.

This entry was posted in CST-300, CSUMB. Bookmark the permalink.