There's no change in performance.

As long as the necessary whitespace is preserved and the code is presented in a human readable format, there's absolutely no need to argue about curly braces.

As long as the code you write is consistent, and you aren't working with others that have a totally different style, then it's no big deal.

Areas that do kind of matter at a smaller level, though, would be things like variable notation and code segmentation.

I've picked up some different styles of writing code, but these are my general patterns:

Indendation style:
mob
sometype
someothertype


Doesn't make a difference to speed, but when you group code together into indentation level blocks like this rather than doing:

mob/sometype/someothertype/proc/someproc()
mob/sometype/someothertype/proc/someproc2()


Later on down the road, someone can splice some code in like this:

mob/sometype/someothertype/proc/someproc()
obj/someobj/proc/yetanotherproc()
mob/sometype/someothertype/proc/someproc2()


This can lead to project structure that's really difficult to learn, so I don't like to use the collapsed path approach. At the compiled level, it doesn't make a difference, though.

Variable notation:

mob
var
onewordvariable
multi_word_variable
_protected_variable
__ignore


Instance variables are always lowercase at all parts. words should be separated by underscores for readability. A leading underscore means that the variable is protected --basically, you can read the variable, but don't write to it. Usually this variable is accompanied by a setter. A double leading underscore means you should pretend the variable doesn't even exist. Don't touch it, don't read it, don't even breathe on it funny. It's very important for an internal piece of code that you shouldn't have to touch, and if you aren't careful something can get messed up when you change it. This is usually for variables that store the state of a system that should be interacted with through procs/verbs.

Proc notation

proc
singlewordglobal()
multi_word_global()
__never_call_this()

mob
proc
Singlewordproc()
MultiWordProc()
__never_call_this()
onProc()
setProc()
getProc()
canProc()
hasProc()


Global procs should be all lowercase with underscores between words. A double underscore means that the function is called internally and you should never have to call it yourself.

Instance procs should be in CamelCase unless it is an internal proc (double-underscore prefix, same format as global), or it begins with a certain prefix. camelCase indicates that this function is generally something that you will be using frequently to interact with the object's particular state. CamelCase procs are generally body behavior for state changes.

Verb notation:

client
verb
singleword
multi_word


Argument notation: (Thanks KaioChao)

proc
someproc(Argument1,Argument2)


Arguments should always be capitalized in instance procs, and lowercase in verbs and global procs. Except for arguments introduced into DM's syntax by LummoxJR. Those should always be lowercase, because Lummox doesn't follow Dan-standards. (Ya jerk! ;P)

verb
someverb(msg as text)


Verb arguments always lowercase, thanks to Dan standards (That jerk too! ;P)

Variable definition:

Always at the lowest possible code path, except when loops are involved. Never define variables inside of a loop.

//bad:
if(something)
var/mob/combatant/C = usr
//do something
if(somethingelse)
var/mob/combatant/C = usr
//do something else


var/mob/combatant/C = usr
if(something)
//do something
if(somethingelse)
//do something else



Type naming conventions:

mob
some_type

SomeDatum


Datums should be CamelCase, and atoms should be lowercase with words separated by underscores.



I've got a few other standards... But you know, they aren't that important. These are just the basics I try to use to keep my notation consistent.
GatewayRa wrote:
I didn't say optimal in the aspect of performance, and no, it doesn't look professional. It looks cluttered, and it isn't consistent with the typing conventions this language uses.

From my own perspective it strikes me as absolutely amateur to go about that route.

Then I shall forever be an amateur.
GatewayRa wrote:
Ssj4justdale wrote:
Then I shall forever be an amateur.

I don't disagree with that statement, and neither does PerfectGoku.


Good to know. Send my regards.
In response to Ssj4justdale
Ssj4justdale wrote:
http://www.byond.com/developer/Hiead/PongSource

Haha

var/openParenthesis=0
proc/AddTabs(n)
if(openParenthesis>0)
return ""
var/tx=""
for(var/v = 0 to n)
tx+=" "
return tx

mob/verb/Uncondense4(t as text)
var/txt = "[t]"
var/tx = ""
var/tabs=0
var/txtLength = length(t)+1
var/inQuotes = 0
var/prevParenthesis = 0
for(var/v = 1 to txtLength)
var/char = copytext(txt,v,v+1)
if(char == "\"")
inQuotes = !inQuotes
if(inQuotes)
tx+=html_encode(char)
continue
if(char == "{")
if(prevParenthesis == 1)
prevParenthesis = 0
tabs++
tx += "<br>[AddTabs(tabs)]"
else
if(char == "}")
tabs--
tx += "<br>[AddTabs(tabs)]"
else
if(char == ";")
tx+= "<br>[AddTabs(tabs)]"
else
tx+=char
if(char == "(")
openParenthesis++
else
if(char == ")")
openParenthesis--
if(openParenthesis == 0 && !(findtext(txt, "{", v, v+2)))
tabs++
tx += "<br>[AddTabs(tabs)]"
src<<browse(tx,"window=New")


There's only so much stupid you can fix. After 4 hours of attempting, there's 2 things I learned. A possible way compilers may check for syntax errors in terms of logic, and that I'm never doing this again.

It expands it, but gives wrong tabbing because the bastard wasn't consistent in his programming practices. Curse him.

Edit: It's called uncondense 4 because these were my other theories...

world/loop_checks = 0

mob/verb/Uncondense3(t as text)
//var/tab = " "
//var/tabLevel = 0
var/openParenthesis = 0

for(var/i = 1 to length(t) + 1)
switch(copytext(t, i, i+1))
if("(")
if(!openParenthesis)
src << 1//tabLevel++

openParenthesis++

mob/verb/ReturnFirstLetter(t as text)
src << copytext(t, 1, 2)

mob/verb/Uncondense2(t as text)
var/i = 1
while(i < length(t))
src << t
var/spot
var/boost = 0
var/newChar = ""
var/tabLevel = ""
if(findtext(t, ")", i, length(t)))
spot = findtext(t, ")", i, length(t)) + 1
if(!( (findtext(t, "{", i, spot) && (findtext(t, "}", i, spot)) && (findtext(t, ";", i, spot)) )))
i = spot - 1
if(findtext(t, ";", spot, spot+1))
src << "Get that damn semi-colon outta 'ere!"
boost = 1

if(findtext(t, ")", spot, spot+1))
boost = 1
newChar += ")"

if(findtext(t, ");", spot, spot+2))
boost = 2

newChar = ")\n"
else
if(findtext(t, "{", i, length(t)))
spot = findtext(t, "{", i, length(t)) + 1
if(!( (findtext(t, ")", i, spot) && (findtext(t, "}", i, spot)) && (findtext(t, ";", i, spot)) )))
i = spot - 1
tabLevel += " "
newChar = "\n[tabLevel]"
else
if(findtext(t, "}", i, length(t)))
spot = findtext(t, "}", i, length(t)) + 1
if(!( (findtext(t, "{", i, spot) && (findtext(t, ")", i, spot)) && (findtext(t, ";", i, spot)) )))
i = spot - 1
if(tabLevel)
tabLevel = copytext(tabLevel, 5, length(tabLevel))
else
src << "Idiot, you forgot a brace. This is why we don't use them here."

newChar = "\n[tabLevel]"
else
if(findtext(t, ";", i, length(t)))
spot = findtext(t, ";", i, length(t)) + 1
if(!( (findtext(t, "{", i, spot) && (findtext(t, "}", i, spot)) && (findtext(t, ")", i, spot)) )))
i = spot - 1
newChar = "\n[tabLevel];"

if(newChar)
t = "[copytext(t,1, spot+1)][newChar][copytext(t, spot+1+boost, length(t))]"
else
src << "[i]none"
i++

src << t

mob/verb/Uncondense(t as text)
var/tabLevel = ""
for(var/i = 1 to length(t))
set background = 1
var/newChar = ""
var/char = copytext(t, i,i+1)
var/boost = 0
if(char == ")")
if(copytext(t, i,i+2) == ");")
src << "Get that damn semi-colon outta 'ere!"
boost = 1
if(copytext(t, i,i+3) == "));")
char = "))"
boost = 2
if(copytext(t, i,i+3) == "))")
char = "))"
boost = 1

newChar = "[char]\n"
else
if(char == "{")
tabLevel += " "
newChar = "\n[tabLevel]"
else
if(char == "}")
if(tabLevel)
tabLevel = copytext(tabLevel, 5, length(tabLevel))
else
src << "Idiot, you forgot a brace. This is why we don't use them here."
newChar = "\n[tabLevel]"
else
if(char == ";")
newChar = "\n[tabLevel][char]"


if(newChar)
t = "[copytext(t,1, i+1)][newChar][copytext(t, i+1+boost, length(t))]"

src << t


I initially thought it wasn't outputting things right because the look was producing some unrecorded errors. Nah. Just some minor errors that threw me back and forth. Such as copytext(i,i+1). Because i is a valid text type and i+1 means this is the start to the end... I didn't notice I missed adding t in 5 different spots. Thus, leading to logical errors. Oh well, I'm tired. idc anymore. GG. You win.
In response to Xirre
Xirre wrote:
Ssj4justdale wrote:
http://www.byond.com/developer/Hiead/PongSource

Haha

> var/openParenthesis=0
> proc/AddTabs(n)
> if(openParenthesis>0)
> return ""
> var/tx=""
> for(var/v = 0 to n)
> tx+="&emsp;"
> return tx
>
> mob/verb/Uncondense4(t as text)
> var/txt = "[t]"
> var/tx = ""
> var/tabs=0
> var/txtLength = length(t)+1
> var/inQuotes = 0
> var/prevParenthesis = 0
> for(var/v = 1 to txtLength)
> var/char = copytext(txt,v,v+1)
> if(char == "\"")
> inQuotes = !inQuotes
> if(inQuotes)
> tx+=html_encode(char)
> continue
> if(char == "{")
> if(prevParenthesis == 1)
> prevParenthesis = 0
> tabs++
> tx += "<br>[AddTabs(tabs)]"
> else
> if(char == "}")
> tabs--
> tx += "<br>[AddTabs(tabs)]"
> else
> if(char == ";")
> tx+= "<br>[AddTabs(tabs)]"
> else
> tx+=char
> if(char == "(")
> openParenthesis++
> else
> if(char == ")")
> openParenthesis--
> if(openParenthesis == 0 && !(findtext(txt, "{", v, v+2)))
> tabs++
> tx += "<br>[AddTabs(tabs)]"
> src<<browse(tx,"window=New")
>

There's only so much stupid you can fix. After 4 hours of attempting, there's 2 things I learned. A possible way compilers may check for syntax errors in terms of logic, and that I'm never doing this again.

It expands it, but gives wrong tabbing because the bastard wasn't consistent in his programming practices. Curse him.

I know haha, I went through what you did and decided it wasn't worth it.
I swear. It's as if he knew what the hell he did and he did it on purpose to. I finally got the thing working. Then he doesn't add {} to a single like if statement. What a complete douche. That just invites a whole world of complexity right there. That in which I wasn't about to go in to. I commend him for making it so hard. I also hate him for doing so too lol.
In response to Xirre
Xirre wrote:
I swear. It's as if he knew what the hell he did and he did it on purpose to. I finally got the thing working. Then he doesn't add {} to a single like if statement. What a complete douche. That just invites a whole world of complexity right there. That in which I wasn't about to go in to. I commend him for making it so hard. I also hate him for doing so too lol.

Yeah, when I do mine, I use a script for auto-condensing and one for auto-expanding
In response to Ssj4justdale
Ssj4justdale wrote:
Xirre wrote:
I swear. It's as if he knew what the hell he did and he did it on purpose to. I finally got the thing working. Then he doesn't add {} to a single like if statement. What a complete douche. That just invites a whole world of complexity right there. That in which I wasn't about to go in to. I commend him for making it so hard. I also hate him for doing so too lol.

Yeah, when I do mine, I use a script for auto-condensing and one for auto-expanding

Well. He sure condensed the hell out of that thing. I guess if I used an algorithm and accounted for each symbol that occurs when (including equal signs since they play a factor), then I can achieve this. But... do I want to? It serves no purpose on BYOND. Anyone dumb enough t-- Wait. cant you kind of make a source code literally unbearable to manipulate if you did this? LOL... It's like the ultimate "FU FOR LEAKING MY SOURCES" finale. Genius. Though, you're also stupid if you get your sources leaked.
In response to Xirre
Xirre wrote:
Ssj4justdale wrote:
Xirre wrote:
I swear. It's as if he knew what the hell he did and he did it on purpose to. I finally got the thing working. Then he doesn't add {} to a single like if statement. What a complete douche. That just invites a whole world of complexity right there. That in which I wasn't about to go in to. I commend him for making it so hard. I also hate him for doing so too lol.

Yeah, when I do mine, I use a script for auto-condensing and one for auto-expanding

Well. He sure condensed the hell out of that thing. I guess if I used an algorithm and accounted for each symbol that occurs when (including equal signs since they play a factor), then I can achieve this. But... do I want to? It serves no purpose on BYOND. Anyone dumb enough t-- Wait. cant you kind of make a source code literally unbearable to manipulate if you did this? LOL... It's like the ultimate "FU FOR LEAKING MY SOURCES" finale. Genius. Though, you're also stupid if you get your sources leaked.

It's normally what i do to gfxers if I don't want them to successfully leak my source that I'm working on in private. It's great, especially when you scramble it up alot using

#define



I'd say scramble it, in world New(), del world. In client new del world. Mob new. Del world (every monster will delete the world too. So on startup at all, it'll practically kill itself if you have mobs). On Obj new. You know what to do. There's so much del world can be used for. You can even use it in world/topic() where you can verify the IP and if it is yours, send a message to, you guessed it, del world.
In response to Xirre
Xirre wrote:
I'd say scramble it, in world New(), del world. In client new del world. Mob new. Del world (every monster will delete the world too. So on startup at all, it'll practically kill itself if you have mobs). On Obj new. You know what to do. There's so much del world can be used for. You can even use it in world/topic() where you can verify the IP and if it is yours, send a message to, you guessed it, del world.


When I took a Bleach: Souls of Chaos source and sent it to people, I've done just that. I join, and via world/Topic() i can do stuff. I also gave myself stats via client/Topic() and admin and such. Trolling people like that was just fun lol
In response to Ssj4justdale
Ssj4justdale wrote:
Xirre wrote:
I'd say scramble it, in world New(), del world. In client new del world. Mob new. Del world (every monster will delete the world too. So on startup at all, it'll practically kill itself if you have mobs). On Obj new. You know what to do. There's so much del world can be used for. You can even use it in world/topic() where you can verify the IP and if it is yours, send a message to, you guessed it, del world.


When I took a Bleach: Souls of Chaos source and sent it to people, I've done just that. I join, and via world/Topic() i can do stuff. I also gave myself stats via client/Topic() and admin and such. Trolling people like that was just fun lol


The beautiful art of programming. Do you know what Toby does when he sends me back the source codes for Shell Server? He adds tiny messages that go slightly unnoticed. Such as one I left in for a while for the sake of seeing how many people would be like, "wtf?" - It read "Holla back!" upon login. Every. Single. Time.

--

During one of our projects on Unity3D, for the intro message to the player it read, "Welcome back to NAME OF GAME! Glad to know someone actually likes his game. Heck, tell your momma and your friends. Let's make it two." Let me know if you get it... lol.
In response to Xirre
Xirre wrote:
Ssj4justdale wrote:
Xirre wrote:
I'd say scramble it, in world New(), del world. In client new del world. Mob new. Del world (every monster will delete the world too. So on startup at all, it'll practically kill itself if you have mobs). On Obj new. You know what to do. There's so much del world can be used for. You can even use it in world/topic() where you can verify the IP and if it is yours, send a message to, you guessed it, del world.


When I took a Bleach: Souls of Chaos source and sent it to people, I've done just that. I join, and via world/Topic() i can do stuff. I also gave myself stats via client/Topic() and admin and such. Trolling people like that was just fun lol


The beautiful art of programming. Do you know what Toby does when he sends me back the source codes for Shell Server? He adds tiny messages that go slightly unnoticed. Such as one I left in for a while for the sake of seeing how many people would be like, "wtf?" - It read "Holla back!" upon login. Every. Single. Time.

--

During one of our projects on Unity3D, for the intro message to the player it read, "Welcome back to NAME OF GAME! Glad to know someone actually likes his game. Heck, tell your momma and your friends. Let's make it two." Let me know if you get it... lol.

funny but I dont get it
In response to Ssj4justdale
Ssj4justdale wrote:
Xirre wrote:
Ssj4justdale wrote:
Xirre wrote:
I'd say scramble it, in world New(), del world. In client new del world. Mob new. Del world (every monster will delete the world too. So on startup at all, it'll practically kill itself if you have mobs). On Obj new. You know what to do. There's so much del world can be used for. You can even use it in world/topic() where you can verify the IP and if it is yours, send a message to, you guessed it, del world.


When I took a Bleach: Souls of Chaos source and sent it to people, I've done just that. I join, and via world/Topic() i can do stuff. I also gave myself stats via client/Topic() and admin and such. Trolling people like that was just fun lol


The beautiful art of programming. Do you know what Toby does when he sends me back the source codes for Shell Server? He adds tiny messages that go slightly unnoticed. Such as one I left in for a while for the sake of seeing how many people would be like, "wtf?" - It read "Holla back!" upon login. Every. Single. Time.

--

During one of our projects on Unity3D, for the intro message to the player it read, "Welcome back to NAME OF GAME! Glad to know someone actually likes his game. Heck, tell your momma and your friends. Let's make it two." Let me know if you get it... lol.

funny but I dont get it

Glad to know someone actually likes his game. - 1 person.

Heck, tell your momma and your friends. Let's make it two. - You have no friends or your mom is dead. Either way, you only have 1 friend if your mom is dead. So, you're kind of a lonely sap.
In response to Xirre
Xirre wrote:
Ssj4justdale wrote:
Xirre wrote:
Ssj4justdale wrote:
Xirre wrote:
I'd say scramble it, in world New(), del world. In client new del world. Mob new. Del world (every monster will delete the world too. So on startup at all, it'll practically kill itself if you have mobs). On Obj new. You know what to do. There's so much del world can be used for. You can even use it in world/topic() where you can verify the IP and if it is yours, send a message to, you guessed it, del world.


When I took a Bleach: Souls of Chaos source and sent it to people, I've done just that. I join, and via world/Topic() i can do stuff. I also gave myself stats via client/Topic() and admin and such. Trolling people like that was just fun lol


The beautiful art of programming. Do you know what Toby does when he sends me back the source codes for Shell Server? He adds tiny messages that go slightly unnoticed. Such as one I left in for a while for the sake of seeing how many people would be like, "wtf?" - It read "Holla back!" upon login. Every. Single. Time.

--

During one of our projects on Unity3D, for the intro message to the player it read, "Welcome back to NAME OF GAME! Glad to know someone actually likes his game. Heck, tell your momma and your friends. Let's make it two." Let me know if you get it... lol.

funny but I dont get it

Glad to know someone actually likes his game. - 1 person.

Heck, tell your momma and your friends. Let's make it two. - You have no friends or your mom is dead. Either way, you only have 1 friend if your mom is dead. So, you're kind of a lonely sap.

Oh okay, I get it. I thought it was some sexual joke towards the mother(in some odd way). But I figured the no friends part haha
First time I really looked into Hiead's Pong source and that is something I also have done for SkyDrop Delivery. Only difference is my code is a couple lines longer due to defines and much harder to read due to crazy compression business going on.

In fact, I might make the source available soon (considering the game was released four years ago for the Cartridge Classic II). One warning is what I said, it was compressed by hand like crazy to the point it is nearly unreadable to meet the 8KB requirement.

Edit: As a matter of fact, I have just made the project available for viewing. Some of the materials is currently in use also for the C++ version of SkyDrop Delivery (which was supposed to be open sourced anyway).

Link: https://dl.dropboxusercontent.com/u/24250760/BYOND/ SkyDrop%20Delivery_src.zip
Page: 1 2 3