|
| 14 Dec 2013 10:40 AM |
I plan to release something with Surface UIs and I'm about to code it, but I feel I should make it readable in case the people who take it want to see the code.
Normally I'd set up the variables like so:
local set = { ["numpad1"] = script.Parent.keypad.button1, ["numpad2"] = script.Parent.keypad.button2, ... ["numpad9"] = script.Parent.keypad.button9, ["submit"] = script.Parent.miscButtons.submit, ["clear"] = script.Parent.miscButtons.clear, ["code"] = script.Parent.keypad.code.Value, ["enteredL"] = script.Parent.input.entered, ["enteredC"] = script.Parent.input.enteredCode, ["loc"] = Vector3.new(script.Parent.keypad.teleLocation.Value) }
Should I make it simpler?
~ Trust me, I'm a doctor (@RBX_Dev) ~ |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 10:45 AM |
| If you're making it public domain, you want it universally readable. |
|
|
| Report Abuse |
|
|
HD188753
|
  |
| Joined: 13 Jun 2012 |
| Total Posts: 5021 |
|
|
| 14 Dec 2013 11:25 AM |
For the most part, yes, even if you don't plan on handing it out, its good if you leave the project, and then come back later, so you know what got done, what didn't, ect.
|
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 14 Dec 2013 11:31 AM |
| I tend to stick to the same messy variable naming practices, and I can easily identify what does what, which is why I continue to do so. If you think you will not remember what something does later on or you think you will share it expecting others to edit it, then use more universally understandable names. |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 11:54 AM |
| @Mett: That's a bad habit to get in to if you ever plan on getting a job as a programmer. |
|
|
| Report Abuse |
|
|
RaidenJPN
|
  |
| Joined: 22 May 2013 |
| Total Posts: 6920 |
|
|
| 14 Dec 2013 12:17 PM |
I name my variables crap like 'b', 't', 'hurrdurr', or 'x'
when I do not expect others to read my code. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 14 Dec 2013 12:39 PM |
| I'd definitely try to make it fairly readable especially for yourself. If you go back to it a month later you might be a little lost... That sometimes happens to me when I don't provide proper commenting, so if you're going to do something a bit unusual you may want to explain it with a comment. |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 12:52 PM |
@Oysi
I'm aware. I set it up like that so I can just go set.button1 etc.
Also, my thought was for releasing items here on ROBLOX.
~ Trust me, I'm a doctor (@RBX_Dev) ~ |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 01:10 PM |
You should always make code readable to you. You should almost always make code readable to others.
I use 'a' and 'i' an awful lot for loops. Except those time, all my variable are named for their purpose. I tab and occasionally comment. I should comment a lot more.
To anybody who makes code without tabbing:
You will regret it later on. I did this, and converting all the code is not a nice job. |
|
|
| Report Abuse |
|
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 14 Dec 2013 01:35 PM |
| I know it is a bad practice, and I have no problem with using recognizable variable names, it is just I am too lazy to, and often times with my "all in one" scripts, I end up just using acronym variable names when creating a lot of instances to save time. |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 02:13 PM |
I dont think you need the [" "] there...
Just do
local object={ a = this, b = that, bleh = bloh } |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 02:19 PM |
| It is better to use code which is impossible to read because security thru obfuscation olol. |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 02:49 PM |
@chicken,
if you're worried about that then don't write it poorly, obfsucateted it later |
|
|
| Report Abuse |
|
|
|
| 14 Dec 2013 10:19 PM |
| ah i was just reminded of this: https://www.thc.org/root/phun/unmaintain.html follow it carefully. |
|
|
| Report Abuse |
|
|
Merely
|
  |
| Joined: 07 Dec 2010 |
| Total Posts: 17266 |
|
| |
|
MettaurSp
|
  |
| Joined: 20 Mar 2010 |
| Total Posts: 3179 |
|
|
| 15 Dec 2013 12:13 AM |
| Perfect to give new developers, gonna bookmark it and read again it later if I get bored right now, or just can't stand laughing with my headache anymore. |
|
|
| Report Abuse |
|
|
Jswagge
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 2924 |
|
|
| 15 Dec 2013 10:47 AM |
| I always find the s "function" In [workspace] to give the code some texture in the algorithem of b minor |
|
|
| Report Abuse |
|
|