on openBook

I’ve been a speaker on LiveCode conferences multiple times speaking about many topics such as web development, game design and application organization. The talk that received the best feedback was the one about application organization during RunRevLive 2013. I remember the smiles from the audience as I moved away from the speaker microphone. That mental image and the kind words received as I left the stage kept rumbling on my mind for a while as I tried to understand why that session was so well received while other sessions were less memorable, then one day late at night, I grokked it!

Even though Web development and Game design are very interesting topics, they are not the most common activities in our community. When I gave sessions on web development, those doing that kind of work really enjoyed the session, but those that whose work is not related to the Web were not all that impressed. The same thing happened with game design. Still, application organization is a topic that affects everyone. All LiveCoders, from desktop application developers, to WebMasters, to Game Designers, start with the same felling: “LiveCode is so easy that I don’t really need to organize my stuff!” and then, like instantaneous karma, the regret for not having a defined organisational method comes right back at us while we wonder: “Where did I placed that handler?”.

We enjoy throwing stacks around while we’re learning the language. I have stacks so badly designed that they try to hurt you when you look at the code. Those stacks from the early spaghetti days are a huge contrast to what I try to build now. My aim with this book is to codify what I’ve learned as I figured out that my code needed to better organization. I needed it to become easier to maintain, a crucial skill to win in the freelance market. Let us label this improvement of skills going from hobbyist to pro.

From hobbyist to pro

If you pick the average sample code contribution by new developers that are learning LiveCode as their first computer programming language and compare it with what the seasoned developers who have business built around the language and have been shipping applications for several years, you will notice a huge difference in both code clarity and organization.

Going from hobbyist to pro is not the act of building a business or shipping commercial software, but the act of working using best practices. This book is about exactly this, picking knowledge from seasoned developers and moving so we stop shipping spaghetti code.

I don’t claim that I invented the techniques presented here, and lots of seasoned developers will recognize their style throughout the chapters. This book has many techniques in it and while I try to present them as a solid and cohesive architecture, remember that you can tweak things to suit your application. You should tailor the methods shown here to your own needs and not the other way around. With that in mind, lets review the book’s objectives.

If I do my job right, I will

Present a solid architecture for building application using LiveCode using an MVC-like approach. By the end of the book (if you read everything) you should be able to:

  • Name your variable and handlers with meaningful names.
  • Correctly place code in stacks.
  • Divide your application into logical units such as models, views, controllers and libraries.
  • Have a clear picture where things should be.
  • Create code that is easy to change as your application scope evolves.
  • Reuse more and more code as you build more applications.

This book roadmap

To achieve our aim, we’ll follow a hero’s journey and begin with nothing and work towards a simple address book application by the end of the book. We’ll begin talking about code conventions and then move to explain the programming pattern called MVC. Each chapter begins with some theory explaining the topic at hand and then moves to a practical section where we apply what we learned to building the address book application.

Even though I am organizing this book as a brief journey, you will still be able to cherry pick chapters and learn specific topics out of order since your needs or interests may not be in the same order as presented here. Just be aware that I build the sample code with the book order in mind and code from the middle of the book may depend on code from earlier chapters.