DEV Community

loading...

Discussion on: Writing Clean Code

Collapse
kayis profile image
K

You are totally right!

Coding style is a pretty big thing, but most developers get this right in the first year. Some languages even come with their own tools to enforce style guides. Using Pettier in my JavaScript projects really helped me to stop worrying.

Naming things is generally a bit harder, I think, but many developers really use bad names for things. Strange abbreviations or single character variables just because they think a 10 char name would be ugly... because they want to reduce package size, etc. So while I think naming is sometimes really hard, 80% of all code can really benefit from simply writing out everything.

Avoiding nesting is really important and often not followed by even experienced developers. Probably because, as you get better, you think you can handle things better, haha. I think it should be kept in mind over the whole process, not only for conditionals or functions, but also for objects and general software architecture.

Collapse
wmhilton profile image
William Hilton

Coding style is a pretty big thing, but most developers get this right in the first year.

I think this depends heavily on company culture. I know plenty of PHP developers who have been at it for well over a decade who don't take coding style seriously.

Collapse
kayis profile image
K

Ah yes, I saw some 'nice' PHP codebases in my time too :)