Author Topic: HOW-To: Develop your own scripting style  (Read 9184 times)

0 Members and 1 Guest are viewing this topic.

Offline NotRabidWombat

  • Lord
  • ***
  • Posts: 384
  • Karma: +2/-0
(No subject)
« Reply #25 on: 26 April, 2004, 03:02:33 »
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.

PtokaX forum

(No subject)
« Reply #25 on: 26 April, 2004, 03:02:33 »

Offline pHaTTy

  • Forum Legend
  • ***
  • Posts: 1 916
  • Karma: +5/-1
(No subject)
« Reply #26 on: 26 April, 2004, 14:30:19 »
Quote
Originally 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

  • Guest
(No subject)
« Reply #27 on: 26 April, 2004, 16:08:58 »
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

Offline Cyberia

  • Double Ace
  • *
  • Posts: 108
  • Karma: +0/-0
(No subject)
« Reply #28 on: 26 April, 2004, 17:19:59 »
lol  :D

Offline NotRabidWombat

  • Lord
  • ***
  • Posts: 384
  • Karma: +2/-0
(No subject)
« Reply #29 on: 26 April, 2004, 17:44:45 »
- Nobody has a wrong style,

Trust me, there are wrong styles.

-NotRabidWombat


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

Offline pHaTTy

  • Forum Legend
  • ***
  • Posts: 1 916
  • Karma: +5/-1
(No subject)
« Reply #30 on: 27 April, 2004, 16:05:17 »
Quote
Originally 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

Code: [Select]
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!

Offline VidFamne

  • Triple Ace
  • **
  • Posts: 173
  • Karma: +2/-0
(No subject)
« Reply #31 on: 27 April, 2004, 16:22:55 »
Code: [Select]
if Some_Standard ~= nil then
code_style = good
else code_style = bad
 end

Offline ((UKSN))shad_dow

  • Triple Ace
  • **
  • Posts: 213
  • Karma: +2/-0
(No subject)
« Reply #32 on: 06 May, 2004, 16:20:14 »
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

PtokaX forum

(No subject)
« Reply #32 on: 06 May, 2004, 16:20:14 »