Creating specifications on sa-mp coding
#1

(If you remember me then I'm here only for code. Not messing around with GTA problems.)

Now some of you may remember some projects on making OO "trick" in pawn and these generally known types of add-ons in sa-mp such as Streamers, command handlers, utils...

And well I want to know your opinion on possible standards and specifications to make code portable. (Yes, I know there are some, like _ALS_ by ******, among all his other standards). For example, let's consider a code that creates a turismo and handles everything needed. Now let's say it's a FS. But now if we have 20 such "nice thing" handlers, it would be better if they had universal code, that could be incorporated into GM. And then we need specifications, because not always code will be using the same streamers as you are. Or maybe there are commands....

My solution would be such as making general standards for streamer usage, copy paste GM code (especially handling sa-mp callbacks.. I've got an possibly stretchy idea) and utilities coding.

But as sa-mp community haven't got much attention to some information and useful advices, it should be made somewhat like this :
1. It would be a subforum of Scripting Discussion named ± "<Code> Standards and Specifications" (<optional>).
2. There would be general and local standards, and each standard would have it's topic with further development.
3. For specific every day standards there would be topics that would give a list of them as well as short description.
4. Codes would have [tags] or some fast notation that would state, if there's a GM injection available, what streamers it supports...
5. <Your suggestion here>.


And some discussion about OO functionality in pawn in context of specification (you may just skip it) :
* There should be 2 - 3 OO specifications, that would allow the code to be portable and readable in context of specification.
Macros are fun, but as I'm fighting with basic (I mean plain code, no Visual C++) win32 .again. I'd consider future of flexible and useful OO to stand upon teamwork. Basic idea is that, for example, one who knows the specification in project could form a base for everyone else. (Without need to interrupt their code) It may not sound perfect, but those who would work in a team should gain from it. And those who code alone, they always have the full flexibility and probably will gain far more than they could lose from using it. I'll make a topic about it, when I'll be able to make a class in this style, but in basic words now, it's kind'a like you took, for example, ****** OO framework and forgot the macros. And my dream is to optimize it so that it's for real. Or for just a nicer macro where it's harsh .

Another great option would be RP coding specifications, because, in my experience, cool mods are often made as FS, while absolutely useful for RP. And then again <your RP ideas here>.
Reply
#2

If I've understood you correctly, then I agree. I'd like to see excellent theoretical discussions not get lost. I've always thought this type of discussion should occur in this forum, but it gets flooded out with help requests.

I have some ideas for these topics myself. However, putting the effort into a topic that will inevitably get lost within a day just doesn't seem worth it.
Reply
#3

I have some ideas for large Pawn project management, because it's become apparent to me that Pawn is not a language that scales well when scripts become large. I'm not really sure where it would be best to put such a topic.

In littlewhitey's script I've tried to "modularize" the code by using macro's (to simulate namespaces), making use of the file-system, and the static variables in-built scope "limits". I think this is important for larger projects worked on by multiple people. I may put my ideas down into writing and finish off the tools after I've finished my next project milestone.

I've written a half-assed pre-compiler program in C# which has assisted with my personal standards. It converts made up higher-level ("Pawn+" ) constructs down to Pawn code and then fires it off to the compiler.
Reply
#4

I consider making a "bridge" compiler what as I understood, Simon has already made. Basically translating OO code to pawn code, which then is compiled. 1. Reason - pawn compiler may have an update. 2. Modifying may be a little harder (or easier). So that work now could be going around main topics : 1. High performance translator. 2. Available limits of OO code translating to pawn. (Which I see as - to each OO code we need to make a pawn counterexample which does "the same", for a simple example - struct which is C, but could evolve the whole code further.) And hopefully for people to use this work later, this should be in standard server package, likely as a collection of example codes, default libraries and translator-compiler. So now I'll try to make some "C/++" code into pawn (Let's make a topic only for that?).
Reply
#5

Then I guess we should start with specifying one or more formats for GM add-ons code. Basically like dmodule is for larger projects, we need to make a smaller version, and for now I'll have to review codes that are already made. And in my opinion it should help forming OO, in experience of actual usefulness of split code.
Reply
#6

Well, for now there's a problem with me - I'll be back online in 3-30 days. Anyway, I'm currently working on includes to make simple GM add-ons.
Reply
#7

I'm back, give or take, anyway, in these days I've made huge progress in mine Object Extension (OO simulation) and now I can continue reviewing other work. Pretty much so far I've figured out a stable version of something like C++ style, and when I'll put it together (It will need additional generator of defines/enum). Just so far I can say it uses this style :
Making an object :
Class Object;
Accessing a variable :
Object.variable; or Object.sub_object.variable; (Basically it should support chain)
Using method:
Object.method(parameters); or Object.method1().method2().method3();
Declaring method :
Class::Method(params) - Doesn't have to use unique name!
Declaring variable :
<Currently shapeless, but will be made as easy as possible, because it'll be used by generator> - Don't have to use unique name! (For example : Class1 and Class2 can both have id variables, and they won't clash in any way - usage of tagof() here)
Accessing local vars :
this.variable;
Ok now I'll get back to putting it together. And the main idea of putting this together is evolving some certain applications (or choosing best way of doing them) and specifying them. For the huge section of OO - I think it should combine into main OO syntax, and also have the main directions of OO - C++ way, Java way, and others.

Edit : Ok here's topic for OO currently : http://forum.sa-mp.com/showthread.ph...32#post1270132
Moving back to creating specifications on sa-mp coding - I think we should provide a solid example of very common place which partially "uses" standards thus forcing further extension of it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)