• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What Makes Good Code?

Status
Not open for further replies.

Kyrbi0

Arena Moderator
Level 44
Joined
Jul 29, 2008
Messages
9,487
Hello all; quick question that will help finalize the proposed Hero Contest

As you can see, it's a Contest that heavily features "Coding" as one of it's primary disciplines; the question is, how to Judge it? Upon what Criteria shall "good code" be sifted from "bad"?

As you can see, there is already a pretty good, comprehensive set of "Coding Criteria", but you'll notice what I noticed in previous Contest(s) where it was implemented: There's not much room for minimalist/GUI coders. (Basically, a Judge looks at the code & says "welp, not robust 0/10, not portable 0/10, not ..." etc)

~~~

So:

Question #1:
Is there a set of Criteria that's "one-size fits all"; could be used to Judge equally between (v)JASS & GUI (& others I guess)?

Question #2:
If not, what are a good set of Criteria for alternative coding styles (given that what we have is pretty good for (v)JASS, I'd say)? Also, in order to ease things, they should be equivalently strong (i.e. no matter how you Code, you are judged out of X points (50? 100? etc)).

I know I don't know enough about this, so I turn to the experts! If you can help, I'd greatly appreciate it.! : )
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Good code is code that you can read and understand.
Code that you know what it does and can change even though you see it for the first time.
Code that is optimized so no redundant calls or ineffective calls are made (in GUI, using Blizzard.j functions is an exception for that).
Code may not leak memory storage or bug out by any means of known issues.

GUI Triggers are limited to triggers (hence the name), which in my opinion is the worst thing of it.
Efficiency and stuff are a matter of how can we improve it without making it less readable/modifyable.
That level also exists in GUI coding.
vJASS is simply easier to use once you understand how it works, but the criteria for it is much tougher.
If you code in GUI, the feedback and criteria are mostly based on avoiding stupid things that GUI has.
If you code in vJASS, you will have to deal with perfectionism... and me :p
 

Kyrbi0

Arena Moderator
Level 44
Joined
Jul 29, 2008
Messages
9,487
Thank you all for your help.

As it turns out, I also went ahead & asked a programmer/web-developer friend of mine, and he gave me some really fascinatingly simple insight into a way that works for both GUI & (v)Jass simultaneously.

Basically he said "good code should interface well with the user, and interface well with the computer". As I have reasoned, that pretty much covers everything; leaks & bugs, speed & efficiency, robustness & cleanness, etc.

Check out the results here. : )
 

pyf

pyf

Level 32
Joined
Mar 21, 2016
Messages
2,985
well, code have nothing to do with creativity.

** edit **
Ken Silverman's favorite optimization: "sub eax, 128" -> "add eax, -128"
http://advsys.net/ken/add-128.htm

[...] As it turns out, I also went ahead & asked a programmer/web-developer friend of mine, [...]

Basically he said "good code should interface well with the user, and interface well with the computer". As I have reasoned, that pretty much covers everything; leaks & bugs, speed & efficiency, robustness & cleanness, etc.

http://www.emulators.com/docs/nx37_seriously.htm (hardware-related)
http://www.emulators.com/docs/nx38_staticopt.htm (software-related ; a must-read imho)
http://www.emulators.com/docs/nx39_dynopt.htm
 
Last edited:
Level 19
Joined
Dec 12, 2010
Messages
2,069
bruh, did you ever saw dota's code? it's most popular map of whole wc3 history. yet it's based on poor gui and pretty much requires dozen things to be readable. again, code have nothing to do with creativity, ideas and stuff. there's normally only one person who should be able to use it. if you will start talking about NON-JASS world then ok, code quality means a bit.
but again, it sounds pityful to stand at "you have to write clean code from the sstart". no sane person will ever do that. code should work in the first place.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"code have nothing to do with creativity, ideas and stuff."
Code can be written on a billion different ways, while doing the exact same thing.
One's creativity makes the difference between good code and perfect code.

"if you will start talking about NON-JASS world then ok"
That is bull shit.
Coding in JASS is equal as coding in Java, C#, C++, Python, PHP, Javascript... ow no, not Javascript.
When you write code, you must keep a standard, you must maintain readability and clarify its functionalities... aka documentation.
If not, that code will be lost into oblivion after a few years. JASS is the same.
JASS has one advantage, that it wont really recieve updates at this point. (As far as I can see.)

"you have to write clean code from the sstart"
When you write code, you increase your developing skills, you think of new ways to code the same and you will discover tricks that other people use or that have just been found.
After you finished your "perfect" code, you will rewrite it after a while.
For some programmers, this "while" can be years, for others it can be months, depending on how much time you spent learning the language and programming basics.
But that is irrelevant to write clean code.
Writing clean code is essential.
Ofcourse it wont change the things that the code does, but properly using indents, variable and function names, etc, and you might find it more appropriate to use something else at a later day, but you will have to do something to be able to read your own code later.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
goddamn
https://mortoray.com/2015/04/20/nobody-cares-about-your-code/
https://blog.codinghorror.com/nobody-cares-what-your-code-looks-like/
try to say that for ANY salary programmer. any start-up'er. anyone.
you can code like shit and yet be successful. it's worst idea to measure coding skills when talking about project as is. nobody needs perfect code, people need working code. as far as you won't understand that you will have troubls in your programming life.

quake3 went good not because they used extra-fast quick sqrt function. no project ever was successful because you wasted time opt'ing it. Only reason to optimizing - is a strict directive to do so, like NASA's spaceships with low mem/unupgradable environment4, for instance. Only reason to do it "libraries/stuff/w/e" - if this will be a part of another project for sure and you have to waste your time for that. Any other way - fuck your code, make things works and thats all.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
You can code like shit and earn money.
You can't code like shit and become a good programmer.

There are different kinds of programmers, and most of the times it depend on their employer and the purpose of the code.
If you code to make a program work, you code to make a program work, but if you code to create proper code, you don't care about the program.
Both are serious jobs, but I take one slightly more serious than the other.

I have met both kinds of employers, and in fact, those who only cared about a working program turned out to spent a lot more time and money on their programs than the employers who cared about the quality of the code.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
so it's turning back to "game design" vs "programmer". you can't judge by both normally, since greates idea can be outlined by incredibly simple yet satisfating from the code point skill.
I like to code clean for myself, but time is money, and I have to sacrifice something to get job done in time. Clean code doesnt mean good code, good practices have nothing really to do with reality. It's cool to have some time to do your job good. It's twice as good when you earn for that. And it's totally useless for 99% of other programmers. Thats real life
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"Some of our processes can however mislead us into thinking code is the product. Do we see refactoring as a way to get better code, or to get a better product? Portray it as code improvement and we find no manager ever wants to give us time to do it."
Portray it as code improvement, that will not improve or change the actual product, but instead, it makes the coding of the product easier so we require 2 months less time to make it... not to mention of how we will maintain the program.
And we will find no manager that ever wants to hold you back.

There is more to programming than writing code.

I actually start to think you have never worked together with other programmers on the same product.
If you have a team of lets say 20 to 50 programmers, you are going to get fired if you dont document your code properly.
Employees that spend their time making stuff that gets thrown into the trash can ussually get fired.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
I actually start to think you have never worked together with other programmers on the same product.
If you have a team of lets say 20 to 50 programmers, you are going to get fired if you dont document your code properly.
Employees that spend their time making stuff that gets thrown into the trash can ussually get fired.
where did you see anything of "team work"? JASS isn't team work for sure, and whole this thread is about coding at solo
 

Ralle

Owner
Level 77
Joined
Oct 6, 2004
Messages
10,101
bruh, did you ever saw dota's code? it's most popular map of whole wc3 history. yet it's based on poor gui and pretty much requires dozen things to be readable. again, code have nothing to do with creativity, ideas and stuff. there's normally only one person who should be able to use it. if you will start talking about NON-JASS world then ok, code quality means a bit.
but again, it sounds pityful to stand at "you have to write clean code from the sstart". no sane person will ever do that. code should work in the first place.
Popularity has nothing to do with the quality or ingenuity of the code. It is an aspect that other developers can enjoy. I am not saying that with good quality code comes popular maps/apps/whatever. I am just saying that coding can be an art. You can be really creative with the way you write your code to save lines and re-use in smart ways etc. It's a very creative process if you want it to be.
If you don't care about keeping your code nice, clean and pretty it must look like poop. Everyone expects some kind of code hygiene. In the end result it does not matter, but development time and time for other programmers to understand your code it does, which leads me to think about technical debt.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
Popularity has nothing to do with the quality or ingenuity of the code. It is an aspect that other developers can enjoy. I am not saying that with good quality code comes popular maps/apps/whatever. I am just saying that coding can be an art. You can be really creative with the way you write your code to save lines and re-use in smart ways etc. It's a very creative process if you want it to be.
If you don't care about keeping your code nice, clean and pretty it must look like poop. Everyone expects some kind of code hygiene. In the end result it does not matter, but development time and time for other programmers to understand your code it does, which leads me to think about technical debt.
technical debt rarely applies to wc3 maps whatsoever. goddamn, we are talking about some fun stuff here, doing which gives us pleasure. somebody enjoy his own code only, somebody enjoying player's feedback. my point is - keep newbies aware of meaningless of perfection when it comes to real projects. barely any gamedesigner can code, which heavily restrict the contest contributors
 
Status
Not open for further replies.
Top