Tattooshop Posted July 14, 2020 Posted July 14, 2020 Hello! How to "beautify" a script? I have seen a scripts with beautiful headers, something like //////////////////////////////////////////////////////////// ////////// SCRIPT NAME /////////// ////////// SCRIPT DESCRIPTION /////////// ////////// ETC /////////// /////////////////////////////////////////////////////////// ( This one is not perfect lol ) Maybe some other options? Of course this can be done manually but is it possible to do automatically somehow ( generate )?
Wulfie Reanimator Posted July 14, 2020 Posted July 14, 2020 I'm sure there exists lots of text generators for that on the internet. But put some effort into your fancy-schmancy-ness if you're going to do it! 1
Tattooshop Posted July 14, 2020 Author Posted July 14, 2020 15 minutes ago, Wulfie Reanimator said: I'm sure there exists lots of text generators for that on the internet. But put some effort into your fancy-schmancy-ness if you're going to do it! Found one! __ __ __ __ / /_/ /_ ____ _____ / /__ __ ______ __ __/ / / __/ __ \/ __ `/ __ \/ //_/ / / / / __ \/ / / / / / /_/ / / / /_/ / / / / ,< / /_/ / /_/ / /_/ /_/ \__/_/ /_/\__,_/_/ /_/_/|_| \__, /\____/\__,_(_) /____/ 1
Rachel1206 Posted July 15, 2020 Posted July 15, 2020 For publishing scripts, I can see the purpose with beautifying headers, else keep it simple and notice if you use an script optimizer all remarks, none-script related entries are removed. Although this limit can be tampered, the default max size of script code is 65,536 characters, where this is one byte per char (ASCII range). Using Unicode characters will typical use 4 bytes per character, so the beautiful header could use memory, you need for your high complex advanced super script. 1
Pussycat Catnap Posted July 17, 2020 Posted July 17, 2020 https://en.wikipedia.org/wiki/JSDoc - Use that. That is the modern professional standard for coding. Anything else is just making it messy. 1 1
Wulfie Reanimator Posted July 17, 2020 Posted July 17, 2020 (edited) 2 hours ago, Pussycat Catnap said: https://en.wikipedia.org/wiki/JSDoc - Use that. That is the modern professional standard for coding. Anything else is just making it messy. That's a specific format for a specific parser, with actual functionality. It's not "the" standard, or even "a" standard. It's syntax just like the language it surrounds. It's literally used to auto-generate documentation files externally from the code itself. OP is asking about decorations, which while I don't care for, is its own thing. Edited July 17, 2020 by Wulfie Reanimator 1
Pussycat Catnap Posted July 17, 2020 Posted July 17, 2020 (edited) 3 hours ago, Wulfie Reanimator said: That's a specific format for a specific parser, with actual functionality. It's not "the" standard, or even "a" standard. It's syntax just like the language it surrounds. It's literally used to auto-generate documentation files externally from the code itself. That example is referencing a specific parser, but that is the standard across pretty much any language for properly annotating code. Wikipedia underestimates its usage. And yes I know they want to add odd decoration into their script... this is my jab against doing that. You shouldn't be throwing things in there that make the use and understanding of your script more difficult. JSDoc, or some method like it - is for making your script / code understandable. If you're decorating, then you're intending to share that code - so keep it clean. Edited July 17, 2020 by Pussycat Catnap 1
Wulfie Reanimator Posted July 17, 2020 Posted July 17, 2020 (edited) 54 minutes ago, Pussycat Catnap said: That example is referencing a specific parser, but that is the standard across pretty much any language for properly annotating code. Wikipedia underestimates its usage. Yes, the JSDoc format (and ones similar to it) is used in a lot of places, but only in conjunction of another program that benefits from it. External documentation, code hinting in the editor, etc. LSL doesn't benefit from that, unless you use an external editor with a plugin installed. If you only wanted to make an in-source-code comment, you wouldn't format it that meticulously. That's way too much effort unless, again, you're already using a plugin that does it for you on the fly. Does it really matter that it's a multi-line comment (/**/) instead of multiple single-line comments (//)? Do you really need the first line to have two stars (/**)? Does the '@' in front of a parameter mean anything to a human or make it "more clear?" Do the value-types have to be in curly-braces ({ })? All of these exist only because the computer requires it. Not because humans need them to understand the comment. Similarly how for every scripter in SL, keeping global variables before any state, and all events inside of a state, is a standard. It's a standard imposed by external necessity (the compiler) that your opinion/taste can't change. Edited July 17, 2020 by Wulfie Reanimator 1
Profaitchikenz Haiku Posted July 17, 2020 Posted July 17, 2020 Got to say enforcing coding standards, whilst I could see the need for it when I was working on large projects with many coders, is something I dislike. Imagine if they made authors adhere to it in their works of fiction? I should have been a pair of ragged claws, scuttling across the floors of silent seas
Profaitchikenz Haiku Posted July 17, 2020 Posted July 17, 2020 (edited) Readbility and beautification of code is really driven by who needs to see it? If you're part of a team, then all the other members of the team, so there is a justification for a standard. If you're going to present it to all and sundry then there's no defined standard, what you need to aim for is clarity and a structure that helps it make sense. If your style differs from theirs (and it must), let's say you don't prefix all global variables with g, that's less important than you declaring globals before they are used with either an explanatory comment or else a name that is self-explanatory, likewise functions, and where you are compacting expression, a comment often helps. And you can't have too many parentheses so long as they balance. If it's just you, then the main criteria is, when you look at it two years hence, will you still be able to understand it? You are the audience, and so long as it makes sense to you, that's all that counts. Edited July 17, 2020 by Profaitchikenz Haiku 1
Wulfie Reanimator Posted July 17, 2020 Posted July 17, 2020 12 minutes ago, Profaitchikenz Haiku said: Readbility and beautification of code is really driven by who needs to see it? If you're part of a team, then all the other members of the team, so there is a justification for a standard. If you're going to present it to all and sundry then there's no defined standard, what you need to aim for is clarity and a structure that helps it make sense. If your style differs from theirs (and it must), let's say you don't prefix all global variables with g, that's less important than you declaring globals before they are used with either an explanatory comment or else a name that is self-explanatory, likewise functions, and where you are compacting expression, a comment often helps. And you can't have too many parentheses so long as they balance. If it's just you, then the main criteria is, when you look at it two years hence, will you still be able to understand it? You are the audience, and so long as it makes sense to you, that's all that counts. My school has a 5-page mandatory coding style definition. If you don't follow it exactly, your assignments won't be graded. (We have an automatic program that will check that the coding style is followed.) This is because all assignments are graded by multiple other students, so everybody must be able to easily make sense of your coding style and naming-schemes. It's honestly a relief, based on my experience on the internet (and seeing some of their non-schoolwork code), but it still has its issues.
Profaitchikenz Haiku Posted July 17, 2020 Posted July 17, 2020 Yebutt, I left school decades ago. Your example fits perfectly into my "part of a team", it leads to a sort of "Render unto Ceasar" scenario, but here in SecondLife I see no need for conformity to that degree. I admit I'm biased after years of wading through changed code where somebody has done little other than effectively reformat it to their idea of what it should look like, giving a real headache to somebody like me who's looking at the differences between one version and the next to try and spot where the problem has been introduced. 1
animats Posted July 17, 2020 Posted July 17, 2020 If you're serious about sharing code, it should be on Github, Gitlab, or Bitbucket, with a good README.md file and lots of comments. 1 1
Profaitchikenz Haiku Posted July 17, 2020 Posted July 17, 2020 But for how long? A few years ago it would have been Sourceforge or FreshMeat , two years on somebody will come up with a snazzy new name (like MeWe took over from Google+ and Dischord from whatever).
Wulfie Reanimator Posted July 17, 2020 Posted July 17, 2020 8 minutes ago, Profaitchikenz Haiku said: But for how long? A few years ago it would have been Sourceforge or FreshMeat , two years on somebody will come up with a snazzy new name (like MeWe took over from Google+ and Dischord from whatever). As it turns out, you can publish your code in all of them with a single console command if you wish.
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now