Software Architecture for Roblox Programming - A quick guide

Introduction

For most software development companies, there’s a full-blown team of people to help the company build high quality software - and one of the key components that they decide on before writing any code is the architecture they’re going to use. Having a well-defined architecture is extremely valuable for these large companies, but its purposes can also be really useful inside Roblox and can make your games much easier to work on as they move along in their development.

What is Software Architecture?

Software Architecture is basically a way of planning the organization of your code. It’s an idea that you think about long before writing any code & it’s something that you keep in mind throughout the entire process. It’s as if you were storing clothes inside a dresser - you may have a shelf for your pants, for your shirts, etc. Using a software architecture, you’re building up the shelves for your code.

Why should I bother?

Having a specialized organization in mind for your code not only means that it may run better, but it also means that you’re prepared when you need to make changes. In regular programming, your code can get larger and larger until it’s too complicated to touch. If you plan it out using an architecture from the start, your code can grow without ever getting too complicated.

When should I use it?

Anything that you’ll be spending a lot of time with or looking to make changes to in the future would be worth implementing within the constraints of an architectural pattern. On the other hand, if you’re only expecting to write a piece of code once & never touch it again, the benefits aren’t worth your time - so you should just write the code as you normally would, outside the constraints of a given architecture.

Getting Started

Deciding on a pattern

The first step to deciding on your architecture is to figure out your use case and what’s important. Each pattern will have its own benefits and use cases, so you should look through them and plan ahead for which would be most useful.

Rather than listing all of them & discussing their use cases here, I’m going to link to an article which has already been written on the subject:

Deciding on an Architecture Pattern

You can also find many of them just by googling “Software Architecture patterns”. It’s worth spending some time looking through them to find one you like.

Implementing the Pattern

Each pattern has its own set of constraints & things to keep in mind. Before even considering the structure of your code, you should go through and make sure you fully understand how the pattern works - so that you can implement your code with that organization in mind.

Before you start writing your code, you should plan out how to structure it to best fit within the guidelines of your pattern. This would involve tasks like listing the purposes for each of your objects, the functions they’ll have, how they’ll all interact, etc.
One technique for doing this is to use UML Diagrams. If you’re interested, I’ve included a guide on that below:

UML Diagrams Guide

Finally, once you’ve planned out the system & have everything ready to go, you can start writing your code. As you go along, try to fit within the design you laid out previously & within the constraints of your architecture; that way, you can keep your code clean and achieve the benefits of the pattern.

Further Reading

Benefits of Software Architectures
Guide to Software Architectural Patterns
Game Programming Patterns

  • Note: Credit to GoldenStein64 for this last one. He mentioned it in a thread a few days ago & it’s a very good resource.
8 Likes

This topic was automatically closed after 1 minute. New replies are no longer allowed.