What is clean code?
Is it a code that is legible with indentation, comments and all or is it a code that works more efficiently?
[Part 1 of 2] Wow! 😱 I am shocked that of all the duplicate questions provided, the one from Tibor Santa in this post is the first to refer to Clean Code and Clean Architecture as we think of these terms in professional environments. This is the problem with having a community where answers are overwhelmingly provided by learners who really have no idea what the context of this question might be referring to. A few key aspects of Clean Code include: - Keep functions short and focused - Use meaningful names - 3 or less function args - Minimal comments... code should be clear enough to understand without comments... most of the time. - DRY - Don't Repeat Yourself - SOLID Principles - 5 character mnemonic acronym for 5 different principles that should be second nature for any senior developer.
[Part 2 of 2] But these are just scratching the surface for what's involved with Clean Code. I'd say that new developers become overly obsessed with the compliance of every aspect of Clean Code, while seasoned developers know how, when, where, and why to strike a balance between the dogma of the concepts vs the practical application of those concepts. To learn more, Google the following and immerse yourself for a while. "Clean Code" "Clean Architecture" "SOLID Principles" "Test Driven Development" "Continuous Integration" "Agile Methodology"
Clean Code is the name of a book, written by Robert C. Martin, one of the most influential authors of software design. The book is about a set of principles and guidelines, to enable developers to write code, that is maintainable and sustainable on the long term. Highly recommended read, and if you ever find any videos or lectures by Robert Martin online, don't miss them, they are a treasure chest of great ideas.
"Goodbye Clean Code", by a programmer : https://www.sololearn.com/post/223948/?ref=app
Tibor Santa Thank you so much for the recommendation. I'll definitely give it a read.
Clean code is 1. Elegant Straightforward, concise, svelte. It looks like the language was built for the problem. 2. Efficient Performant, effective, reliable. It works. It solves the problem. Exceptions are handled. 3. Intuitive Expressive. Understandable. No gotchas. No antipatterns. Does not need a lot of comments. 4. Maintainable Readable, Scalable, Testable. It should be easy to change or extend. The risk of breaking something should be low. There should be automated tests, low coupling and high cohesiveness. You can give it a mnemonic. R - Reliable I - Intuitive S - Scalable E - Elegant
David Carroll I know what Clean Code means. It is a book written by Robert C. Martin. I have read that. But that is not what the question is about. I think. I interpreted the question as "what does it mean for code to be considered clean?". That is why I spelt it as "Clean code" not "Clean Code". So yes, it is an Ore original even though much of what I said has already been covered in the book.
Ore I like the Ore Original 😜👌 Just be aware that Clean Code has become quite ubiquitous in the industry with the points that have emerged from Martin's books. So much so, that we refer to Clean Code as concepts rather than as talking points from a book of the same title. It would be like someone asking what is agile programming and receiving answers about being nimble and flexible and organically changing code along the way. While the above response could be loosely aligned with Agile... it falls short of explaining the formal objectives, methodologies, and practices behind Agile. The responses I posted in the link above speak specifically to Clean Code concepts and disciplines that can be searched upon to further understand the tangible practices and guidelines around achieving Clean Code principles. I'm just trying to minimize any potential for confusion if not clearly stated how these correlate to the formal Clean Code practices and concepts which can be cross referenced with other sources. 👌
Please use the search bar option before posting a question in the Q&A. https://www.sololearn.com/discuss/298791/?ref=app https://www.sololearn.com/discuss/1948614/?ref=app https://www.sololearn.com/discuss/293521/?ref=app https://www.sololearn.com/discuss/211929/?ref=app https://www.sololearn.com/discuss/2496141/?ref=app https://www.sololearn.com/discuss/2119892/?ref=app https://www.sololearn.com/discuss/1555223/?ref=app https://www.sololearn.com/discuss/858713/?ref=app
Ore Is this an Ore original or are you referring to a known mnemonic? I'm not sure you are aware, but Clean Code has a very specific meaning in the industry and this explanation could lead to some confusion.
Ore It's all good. 👌 We should start our own movement and call it Dirty Code. 😂🤣
Thanks for pointing that out. I did not mean to confuse anyone or to contend with the original ideas of Uncle Bob.
This is Informative.