What makes a code good for you?

| Hey, I'm the guy from >>thread/593580, currently writing an add-on to the guide that tells newbies how to write clean and well-structured code.

I'm hitting a wall, so I'm asking you, the good people of /tech/, what does good code look like?

For me as long as it a) works, b) readable, c) not a dumb resource hog, it's good.

| Whoops messed up the link.

| lol ok I messed up again

Here's the guide in question: https://nononsensebasicjs.rtfd.io/

| >>>593580

| wat

| >>>tech/thread/593580

| https://en.wikipedia.org/wiki/Indentation_style#K&R_style
speaks for itself

| It depends on many things. Usually, it's a maintainable code. But there are various visions. For example, in Python the idea is that code should be readable, even if it's more tedious. In other languages, maintainability is about comments, or code structure before the rest.
Also, code needs to be adapted to the language, and a good C code will be crap if translated directly into Python for example.
So I'd say good code is adapted to the language, and maintainable,whatever it means.

| Well first of all. Organization. When I make my websites I put a few enters between the diffrent sets of code. Other then that idk.

>1 error bad, no error 250 warning COMPILE

| Comments for everything that can't be understood from code, or sections that are critical for code that is far away from said section.
If your code tells it, comments shouldn't repeat.
Optimization always comes last, so code should be readable at first.

It really depends on the scale you will cooperate at, and the overall scale of the project, what level of abstraction we're at, if the code actually has to be maintained at all...

In the end, there's no universally great code.

| Comments, understandable variable names, indentation and optimization etc. etc.

| If it works and is easy to maintain it's good enough
There are factors that turn good enough into excellent but good enough is what you should do first and foremost, all else can be enhanced later

| When only the original coder understands what thr fuck it does.
P.S. Short "if"

| ^ this is called job security

| >>594511 nope, it's called old fart mentality
The collaborative approach not only helps others but it also makes you get a good reputation and gives you better chances of getting a promotion or a new job, unless you work at a shitty mega corporation such as IBM, then you MUST male cryptic code to protect your position

| >>594511
We have a policy where if you are basically the only one who can maintain your own code, you get fired.
Now good luck securing something.
That's quite a debatable policy, but it works.
We've yet to fire someone.

| >>594581 in my workplace we have something a little less radical, no code goes to production without passing on the code review by at least two peers, it works pretty well

| >>594583
That's probably why we haven't fired anyone yet... no one really works alone.

| >>594517 wait you mean you dont comment your code?

| >>594608 I do comment my code, but comments aren't always enough, gotta keep that code nice and understandable too

| Readable code that can be parsed by a human easily, inline comments about what particular blocks of code are are doing, explainations for anything that looks like garbage code, and documentation.

Good code vs bad code is generally a non-technical issue, Unity3D (for example) is a good game engine plagued by incomplete documentation.

Total number of posts: 21, last modified on: Tue Jan 1 00:00:00 1567796357

This thread is closed.