What are some things a developer can do to make code look beautiful, clean, & professional? | SoloLearn: Learn to code for FREE!

+6

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

5/24/2019 1:49:14 AM

MissNebula

5 Answers

New Answer

+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.

+8

By using meaniful variables and defining meaniful functions and if python... Read on import this module

+5

Just make it simple and easily understandable.

+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

+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