Actually what is a Good and Beautiful Code ? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 4

Actually what is a Good and Beautiful Code ?

Some codes are ugly (JavaScript) and some are beautiful ...but what makes a code really beautiful and faultless ? Any opinion will help .

12th Jan 2017, 2:41 PM
Sun
Sun - avatar
10 Réponses
+ 9
You just said Javascript is ugly... and didn't respond to which is beautiful..... Life can be hard sometimes.... Edit: The beautiful code is the more organize, clean, and the programming language that YOU like.
13th Jan 2017, 3:52 AM
Supercolbat
Supercolbat - avatar
+ 6
EXCUSE ME, DID YOU JUST SAY JAVASCRIPT IS UGLY
12th Jan 2017, 4:14 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 5
I don't see js as ugly code. beautiful code is compartmentalized for a reusable purpose. it follows a logical progression. it executes the desired functionality with as little hang time as possible. it is properly spaced. finally, it is appropriately documented. I don't want to pull the developer aside for instructions, costs too much money.
12th Jan 2017, 2:50 PM
Louis Milotte
Louis Milotte - avatar
+ 5
Java Script is not ugly as you think, it is very useful
16th Jan 2017, 2:46 PM
Deepak
Deepak - avatar
+ 4
"i'm not your senpai".toUpperCase()
12th Jan 2017, 4:19 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 4
Yeah I never stated that this is the answer to your question.
12th Jan 2017, 4:24 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 3
Apparently, there are tons of style guides out there in the thing they call the world wide web. however: your question can be interpreted ambiguously. good or beautiful can't be objective. so lets say you have asked something like: how do I organize/write code the best way? 1.what is your program for? open source or closed source? do you work in a team or by yourself? 2.what language are you working with? (maybe another point:) how do you compile/link/program etc? with an IDE or notepad? (there are other points but im clearly not writing a whole styleguide on my cell phone) 1-if you work in a team, the first (or one of the first) thing (s) you should declare is how your code should look like. its better to have "bad" looking code consistently than having good code only in part of your code. always remember who should read your code and that even if you don't work there anymore, the next developer have to be able to read and understand the code quickly. so, whatever you do, WRITE COMMENTS. you may ask: why in caps? it is that important? in little code, probably not. but when writing 1000 or 10000 or 1000000 lines of codes, you will be lost without commenting. not that no one will understand your code, you wont be able to EXPLAIN your code. that is crucial. if one of my comrades explains his/her code and doesn't know which line does what, there is not enough commentary. I know, you didn't wanted to read that, do here is some example code, how I write my code. (not everywhere tho, mostly in my projects. it always depends on the team) C : int main (int argc, char *argv[]){ //TODO:comment, which says what has to be implemented or thought of here. //brief:initialize random seed srand (static_cast<unsigned int>(time(NULL))); //skipping some code for (uint64_t i=0; i <len; i++) { if (i==0) { //do smth } else { } } } //gosh, I hate writing such long texts on cell phones xd hope this helps, if not, I'll try to answer. (if I see that, dunno how this works)
12th Jan 2017, 8:29 PM
Abraham Soeyler
Abraham Soeyler - avatar
+ 2
For me, beautiful code is code that: - give best performance, - less memory, - reusable code, - easy to develops, - easy to read for developer, and - has good indentation.
12th Jan 2017, 3:29 PM
Fendi Septiawan
Fendi Septiawan - avatar
+ 2
actually I don't dislike JavaScript but it can be more beautiful . its syntaxes are like messed up so many think its ugly .
12th Jan 2017, 4:27 PM
Sun
Sun - avatar
+ 1
sorry if it offenses you but I guess its not the answer of my question
12th Jan 2017, 4:23 PM
Sun
Sun - avatar