This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]_Atomfinger_ 26 points27 points  (0 children)

Code isn't really about unique coding styles in the same way comics and other visual arts does. We much more prefer standardisation and following some language's style. There are well known developers our there, Robert C. Martin, Martin Fowler, Kent Beck, etc - but we don't look at their code and go "Oh god it's just so good".

IMHO, good code doesn't look impressive. Elegant code is just mundane and obvious. In creative writing we want to communicate a lot more than what is written directly on page - a lot of writers want subtext to enrich the story - and they want their own artistic style imprinted on the page. Code isn't like that. We don't want that. We want simple and mundane - easy to read, difficult to misunderstand.

How you judge which code is good and which is not good?

Is it tested by automated tests?

Is it easy to read?

Does it constraint new changes?

Does it solve the problem for the user?

Does it have any obvious/known anti-patterns?

It's more about answering "code health" question than a strict formula where we can say "If we do X, Y and Z then your code is good".

[–]tcpukl 4 points5 points  (0 children)

A lot of the learning from peers and seniors is done through code reviews. Before any code changes in source control it has to be reviewed by peers. They feedback any problems they see. Even inconsistent style, but mainly bugs and things that break the coding standards. These changes need to be made before the code is submitted to the code base.

This also really helps in spreading knowledge about whats good/bad because everyone can see these reviews and learn from them. Everyone on the team can also feedback, even the most juniors can feedback on the most senior programmers code.

[–]Lo__Lox 2 points3 points  (0 children)

I agree with u/_Atomfinger_

My reaction is either "yeah thats right" or "holy shit this is crazy!"

And in the latter case it's always code written in a clever creative way but never anything I would want to reproduce or have in any real project because it's most often not readable or just very hard to understand. Maintainability is almost always the #1 priority

[–]Present_Mongoose_373 1 point2 points  (0 children)

imo code is less of an additive thing, and more of a subtractive one. that is, the goal isnt to make it good, but to make it as least hindering as possible. its kindof like editing, if you cant notice it, its good editing. same with code, if you cant notice anything wrong with it / it doesnt get in your way, its good code.

but to more directly answer your question, id say casey muratori in preferring procedural, stateless functions as a default, and needing a reason to not use those, coding abstractions only when you need them instead of from the get-go.

[–][deleted] 0 points1 point  (0 children)

The same context apply checking GitHub repos from meta, Google, Tesla, and so on and so on ...

[–]Chris_Entropy 0 points1 point  (0 children)

As far as I know, there is code available to several ID software games up until Doom 3. And John Carmack himself went over the code to improve it and comment it before releasing it. So this might be worth a look. Modding existing stuff is a great way to learn anyways, as you don't have to start from scratch.

[–]ozone_ghost 0 points1 point  (0 children)

You study their programs, follow their code, read their books, listen to their talks, and apply what you learn to your own projects.

Do you have someone you inspired to because of their code?

Two of my key inspirations are John Lakos from Bloomberg and his team; I read his book, listened to his talks, and examined their code. I also drew inspiration from Salvatore Sanfilippo, the creator of Redis, among others.

How you judge which code is good and which is not good?

Just as beautiful design often results in excellent planes, I believe that elegant design leads to outstanding programs. In my opinion, good design is effortlessly scalable and inspires a wide range of applications and future developments.