Sign in to follow this  
Followers 0
Topher

Coding style hints

2 posts in this topic

#1 ·  Posted (edited)

I'm finishing up a game and have an eye toward posting it on the appropriate forum.

I figure I should 'pretty it up' a bit.

Flesh out the comments, that sort of thing.

My question is, is there any sort of convention for the order of functions in a script?

Also any other styling tips would be appreciated.

Edited by Topher

[left][hr]
$mood = "whimsy"
$mode = "confused"
$randomChaos = True
Do
Something()
Until $Tired
[/left][left]Reflex (Arcade game)[/left][left]IX (Board game)[/left][left]The Word Game (Word game)[/left][left]Plastic Sliding Squares Puzzle (Puzzle)[/left]

Share this post


Link to post
Share on other sites



A good Question ! A place to start is the Standard UDF's library to see the structure, syntax & layout/formatting.

Everyone has a style of their own, it's usually pretty unique and is the result of out previous programming knowledge & experiences. Some organizations have specific rules for coding format, conventions & % of Comment to Code ratios but that is all subjective. I personally code in several languages & script systems and each has it's own points but I have 2 styles myself which generally apply to anything I write;

* Style-1 = short $vars, classed & catagorized, 10% comment ratio, used for Non Opensource.

* Style-2 longer $vars, funcNames etc with descriptive names catagorized & classed (English like naming makes them a tad long) 20-25% comment ratio used for OpenSource / Educational code.

Function Headers, Action comments, etc...

Func _mySuperFunction($var1, $var2)

; description here

EndFunc

One habit I picked up over the yrs which stuck while working with X-Platform stuff is CamelCasing. That in some circles is considered evil & in other circles as almost mandatory.

Hmmm I wonder how well Hungarian Notation would go in AU3... might be a tad too confusing for some LOL.

I suppose the bottom line IMO, is whatever way your comfortable with it, that it applies to your workflow process and that it's "something you will recognize & understand after 12 months of not looking at the code you wrote" (which is likely one of the most important reasons to comment yoru own code & write it clearly).

Hope it helps.


~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0