Week 3, "Architecture, Performance, and Games"
Software architecture refers to organization of a set of code that allows it to be more easily understood by the programmer. In relation to making a game in Unity, it is particularly important when taking part in group projects, so that each member of the group can edit the code without wasting too much time on simply interpreting it. This is in contrast to prototyping when working on a project alone, where software architecture tends to go out the window. In prototyping, the focus is usually on getting the code to work by any means necessary, regardless of how sloppy it may be. Depending on the size of the project, it can be wise to try to organize the code after achieving a working prototype. This often involves decoupling, which is the process of removing the links between pieces of code such that they can be edited independently. This allows for future changes to be made with minimal effects on the rest of the program, which is central to the idea of software architecture. An example of a good software architecture practice that I often forego is assigning variables rather than changing them individually each time they need to be tweaked. To illustrate this point as simply as possible with pseudocode, imagine a piece of code that moves an object left or right at the same speed. One way to write this would to say that the object goes at a speed of 10 when moving left and at a speed of 10 when going right. This would work just fine, but if it needed to be changed later the value of 10 would need be me changed at both locations in the code. The better way to write it would be to set a speed variable at 10, and set both directions to the speed variable. This way, only the speed variable needs to be changed when iterating.