ID:2116827
 
Hey guys I've been programming for a few months and as I zoom around the forum, mostly the Developer Help section, I notice some people reply to others post saying that their code is jumbled, unorganized, or is hard to look at. I am not trying to say that these replies are mean or anything, just that I do not understand what makes codes and such unorganized so that I don't end up screwing everything up in the long run. I know don't do stupid things like have all your procs, verbs, and variables in on DM. or other things that make sense, but I want to know if it would be smart to have sections of types of variables separated by ///////. Is there a such thing has to many folders and when it comes to verbs how could I separate that. Most of the time I see people saying the unorganized codes are like NPC coding where they have the A.I attacks and procs. I would like to say that I am not copying those examples and are trying to do my best with organization, but need helpful tips from experienced people. I also would love to not have to rearrange or decipher any codes months from now regretting where I put what.
There really is no right answer to this. Generally though, when you are using a language, you usually want to work with the language's syntax, conventions, and what-have-you. One of the main reasons for this is because it makes reading the code simple for an outsider looking in.

Some other practices that can make your code harder to read:
  • Using proc names that do not achieve self-description.
  • Designing your procs in such a way that the variable names used do not describe the proc at all, i.e. simple names such as var/a.
  • Not using an appropriate amount of white-space to make your code easy on the eyes. Be aware that there is a such thing as too much white-space.


But in short, what's important is to do what makes your work space comfortable for you, because after all, you'll likely be working with the code the most.

I personally long-type my code and remain descriptive at all times. If I cannot look at something and easily determine its orientation, then I was not descriptive enough. This ensures that any amount of time could pass and I can say "Oh, this has to do with this!" at a glance.

Also, I wouldn't say there is a such thing as too many folders, but your project structure should make some logical sense. Finding your balance is what counts. Let me show you how I currently organize my project: