Let’s take the example of unlocking an achievement when a player first kills a rare animal. ObserverĪ simple way to separate different areas of code is to use the Observer pattern. Note that these apply both when thinking about the relationship between mods, and the relationship between areas inside a mod. It’s a very good idea to make sure you have a low amount of coupling, as this means that changing the APIs of certain areas will be more feasible. Low Coupling - keep dependencies between areas as low as possible, and avoid relying on internal implementations.High Cohesion - the area should be closely/tightly related.These programs/areas should have the following two properties: This should be done in such a way that you achieve Separation of Concerns - each area should be distinct and address a separate need or concern. Inside every large program, there is a small program trying to get out. The opposite of this is to design your project as a collection of interacting smaller programs or areas of code. This ultimately makes a project completely unmaintainable, ending in its abandonment. Spaghetti code is characterised by a lack of structure - all the code is thrown in together with no clear boundaries. Without any planning, a programming project will tend to gradually descend into spaghetti code. Cohesion, Coupling, and Separation of ConcernsĬohesion, Coupling, and Separation of Concerns.There is no one good way of designing a mod, and good mod design is very subjective. Please note that this chapter isn’t meant to be prescriptive, but to instead give you an idea of the possibilities. This chapter covers important concepts needed to keep your code clean, and common design patterns to achieve that. This is an especially big problem when using a dynamically typed language like Lua, given that the compiler gives you very little compiler-time help when it comes to things like making sure that types are used correctly. Once your mod reaches a respectable size, you’ll find it harder and harder to keep the code clean and free of bugs. En Intro to Clean Architectures Introduction
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |