+ 6

What are some things a developer can do to make code look beautiful, clean, & professional?

24th May 2019, 1:49 AM
MissNebula
MissNebula - avatar
4 Answers
+ 8
I agree with Paul. I'd also add: - Use correct indentation and make sensible use of whitespace (both horizontally and vertically). - Consistently follow guidelines/conventions/best practices throughout your entire codebase. - Avoid comments explaining "what" a certain line/block of code does; prefer explaining the "why" instead. The "what" can almost always be deduced by inspection of the code itself, but the "why" is more deeply connected to the way the programmer thought when actually writing the code (so it's more useful to understand the general mindset). - It's better to write sparse code than nested/monolithic beasts. Code that is too dense in information is harder to debug/maintain/extend and can also be less readable. - Always strive for readability, but don't let it compromise functionality. Code is read a lot more than it's written, but if you find yourself taking too much time to write pretty code, then just don't. Write ugly code that works and perhaps come back to refactor it later.
24th May 2019, 2:52 AM
Eduardo Petry
Eduardo Petry - avatar
+ 5
Just make it simple and easily understandable.
24th May 2019, 2:09 AM
Abhinav
+ 5
- Consistent naming - Single responsibility: your functions should do one thing and it should do it well - Keep your functions short: 30-40 lines max - Documentation shows that you care about your code being easily usable/understandable - Unit-test: they are an easy way to check that a code change didn't modify existing functionality
24th May 2019, 2:17 AM
Paul
+ 4
have a solid workflow setup for your folders and files. each time you write code think of it in the sense of how a good portion of it can be reused for other projects an then just slightly tweak what needs it when the time comes. before you even open a editor. visualize what you actually want to create. think on it for a day or two if time isnt of the essance. once in the flow remain in it until battery dies an break. then reflect
24th May 2019, 12:29 PM
Mike Leonard
Mike Leonard - avatar