Clean Code is the best Mode
MOHAMED SAID IBRAHIM
Software Test Engineer | Test Analyst | Test Automation | Flutter | ISTQB? CTFL| cypress | Postman | K6 | Javascript
The French philosopher Blaise Pascal famously wrote 'I would have written a shorter letter, 'but I did not have the timea,?
Why is writing clean code so crucial?
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler.
Thus, Our code should be (Simple, Standardized, Readable, Testable, Searchable, Maintainable, meaningful, Has Root Idea)
Why is it a problem??
Well, in 1996 the Ariane 5 space rocket self-destructed seconds after lift-off due to a single software bug?
that had been inadvertently copied over from the software used for the Ariane 4 launches.?
This may be an extreme example - the explosion caused an estimated loss of $370m - but problems with complex or
?inaccessible code can cost countless hours and significant resources at any business.?
Best practices for writing clean code
1. Keep it simple, not duplicated.
2. Use meaningful names (standardized, Searchable, pronounceable).
3. Respect the Single Responsibility Principle (SRP) ( Every class, function, or method should have a clearly defined goal).
4. Use comments, but sparingly.
5. Include Unit-Tests (Test-driven development (TDD))
a.You may not write production code until you have written a failing unit test
b.You may not write more of a unit test than is sufficient to fail, and not compiling is failing
c.You may not write more production code than is sufficient to pass the currently failing test.
6. Keeping striving for improvement (Start Working From Now and get help from professionals).