Gamemode Script Layout
#8

Quote:
Originally Posted by ******
Посмотреть сообщение
OK, I'm intrigued, those of you who arrange your code by declaration type instead of function, why do you think this is a good way of doing it? And this is an honest question not sarcasm! The fact that a vehicle enum looks a little bit like a player enum doesn't mean that they're related in any way, so why put them together? That seems to me like organising a library by the colour of the book covers instead of the book topics!

As for having separate directories for systems and separate files for the different declarations in those systems - that's getting closer to a good layout but still means you can't use "static" to restrict access to data. Think of "static" as data private to a system - you want all of the system to be able to see that data, but you don't want any other system to see that data because they could start adjusting it in bad way. Instead you just provide a clean API to interact with that data any everyone is happy.

I'm not sure how this is even someone any programmer should wonder:

Number of major open source projects who "organise" their code in one massive file sorted by keyword: 0
Number of major open source projects who organise their code by splitting code up in to separate chunks of related functionality: All of them!

That alone should tell you something. I really suggest you start reading outside of SA:MP - you might learn something! There is a free book out called "The architecture of open source projects volume 2" - look it up. Also, just any generic reading on any generic programming will VERY quickly get on to how to split up code by function.

Finally, why do you think there are separate includes for player functions and object functions? Do you think that maybe says anything about the internal structure of the server's code? And I'm not giving ANYTHING away by saying that because any programmer with more than 10 minutes experience would realise that a large program like the server would split those functions up in that way.
Well that's a nice question you got there, but I can only answer for myself and not for others, so here I go.

In small scripts I tend to organize by "types" and not by "topic" as it's much easyer for me to find things, Ex: I got a 2000k lines file, and I need to remember how I did name an enum object, as I have all of them togeter it's a way faster. May you're right, enums may be for players/vehicles/special types but it's like when you (or at least me) organize your books at university/school, I organize them for years, not by each subject (may when I finish it i'll organize them by subject, but not for now).

And about the systems, I do need them go be conected with each other, not all of them but most of them, that's why I do it this way.
Reply


Messages In This Thread
Gamemode Script Layout - by MP2 - 04.07.2012, 20:36
Re: Gamemode Script Layout - by Kyle - 04.07.2012, 20:38
Re: Gamemode Script Layout - by Vince - 04.07.2012, 21:05
Re: Gamemode Script Layout - by ReneG - 04.07.2012, 22:30
Re: Gamemode Script Layout - by TheChaoz - 05.07.2012, 02:23
Re: Gamemode Script Layout - by MP2 - 05.07.2012, 03:13
Re: Gamemode Script Layout - by [ABK]Antonio - 05.07.2012, 03:51
Respuesta: Gamemode Script Layout - by TheChaoz - 05.07.2012, 04:36
Re: Gamemode Script Layout - by Vince - 05.07.2012, 07:53
Re: Gamemode Script Layout - by MadeMan - 05.07.2012, 16:58
Re: Gamemode Script Layout - by AndreT - 07.07.2012, 15:25
Re: Gamemode Script Layout - by Finn - 07.07.2012, 16:46
Re: Gamemode Script Layout - by Lorenc_ - 07.07.2012, 17:49
Re: Gamemode Script Layout - by ReneG - 07.07.2012, 18:01
Re: Gamemode Script Layout - by Y_Less - 07.07.2012, 23:19
Re: Gamemode Script Layout - by DeathTone - 07.07.2012, 23:22
Re: Gamemode Script Layout - by MP2 - 08.07.2012, 01:37
Re: Gamemode Script Layout - by JoBullet - 08.07.2012, 02:42
Re: Gamemode Script Layout - by MP2 - 08.07.2012, 02:53
Re: Gamemode Script Layout - by Simon - 08.07.2012, 06:23
Re: Gamemode Script Layout - by iggy1 - 08.07.2012, 09:35
Re: Gamemode Script Layout - by eesh - 09.07.2012, 05:47
Re: Gamemode Script Layout - by DiDok - 10.07.2012, 11:01
Re: Gamemode Script Layout - by Ada32 - 04.03.2014, 02:19
Re: Gamemode Script Layout - by ColeMiner - 04.03.2014, 11:05
Re: Gamemode Script Layout - by Ceathor - 11.03.2014, 09:39
Re: Gamemode Script Layout - by [HLF]Southclaw - 11.03.2014, 09:48
Re: Gamemode Script Layout - by ColeMiner - 11.03.2014, 10:35
Respuesta: Re: Gamemode Script Layout - by Gryphus One - 12.03.2014, 02:53
Re: Gamemode Script Layout - by ColeMiner - 12.03.2014, 17:35
Respuesta: Re: Gamemode Script Layout - by Gryphus One - 13.03.2014, 00:19
Re: Gamemode Script Layout - by Bertie - 29.07.2014, 19:49
Re: Gamemode Script Layout - by Y_Less - 29.07.2014, 20:50
Re: Gamemode Script Layout - by Bertie - 29.07.2014, 21:59
Respuesta: Re: Gamemode Script Layout - by Gryphus One - 29.07.2014, 23:45

Forum Jump:


Users browsing this thread: 9 Guest(s)