HOW-To: Develop your own scripting style - Page 2
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

HOW-To: Develop your own scripting style

Started by pHaTTy, 20 April, 2004, 12:11:22

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NotRabidWombat

First and foremost, I'd like to apologize to phatty for becoming hostile. I am sorry. Being a loud mouthed jerk is what I do best.

Secondly, I'd like to re-illustrate the importance of style in coding for the purposes of sharing code.

So far all of your examples have been simple one liners that can (and usually do) escape the restrictions of style for readability.

But apply something like:
block {
}

-OR-

block
{
}

and you can have problems. Using the latter allows you to line brackets up to ensure you did not forget one, limiting the probability of errors. Also, nesting can also become confusing.

Likewise, adding ( ) around conditions ensures more complex statements are well illustrated.


local something = "\n";
local somethingelse = 1;
local RabidWombat = sumit:sumit()

-OR-

local something = "\n"; local somethingelse = 1; local RabidWombat = sumit:sumit()

The first allows the programmer to insert helpful comments before or with the intializer. Typically, it much easier to read single line statements rather than a combined line.

The only benefit to your example styles is a few less characters to be typed. While all the styles I have proposed are restrictive, they are an attempt to:
a) Limit errors
b) Improve readability
Try reading some C legacy code your company locked away just long enough to let all the original developers leave, who all used different styles (most of them difficult to follow).

I am not trying to put everything into standards. I am merely voicing the commonalties I have discovered in my experience programming.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

pHaTTy

QuoteOriginally posted by NotRabidWombat
First and foremost, I'd like to apologize to phatty for becoming hostile. I am sorry. Being a loud mouthed jerk is what I do best.

np, least it made a hot thread, was sumit todo as well =D
Resistance is futile!

[NL]Pur

OK, i think we can agree on the following things :)


        - if you work on a project involving more then 1 ppl
          try to maintain 1 style.

        - Readablitly is importent not if something is
          short or long.

       
      -  Rabid is in his element when he is a loud
         mouthed jerk


did i forget any points?



/edit> - Nobody has a wrong style

Cyberia


NotRabidWombat

- Nobody has a wrong style,

Trust me, there are wrong styles.

-NotRabidWombat


I like childish behavior. Maybe this post will be deleted next.

pHaTTy

QuoteOriginally posted by NotRabidWombat
- Nobody has a wrong style,

Trust me, there are wrong styles.

-NotRabidWombat

nah i still disagree, altho i think i cudnt cope with

if someone == someoneelse then dosumit() end; if someoneelse == sumit then test = continue() if test == 1 then return 1; else return 2; end; end;

but it stil doesnt make it wrong, just means ya dont like it, and its something that others cant understand or read, the word ya looking for is inapproriate way of styling code
Resistance is futile!

VidFamne

if Some_Standard ~= nil then
	code_style = good
	else code_style = bad
 end

((UKSN))shad_dow

mmm well to me theres only 1 kind of script or spelling style ... hehehe thats simple as in simple to read , simple to spell, simple to syntax check , simple to correct

in other words  ..

 K.i.S or kis or  and now i not calling any body > K.I.S.S or K.I.S.S`s

and na i aint going to spell in full words i let u lot do That . PMFSL x 345345   :D  :D  :D

(was board so no flameing me )
creator of Therapy-X? bot

SMF spam blocked by CleanTalk