how i can improve our code quality and write clean code. if i write a unclean ugly code then how i can migrate as a good code (beautiful and clean).
- use stylecop
- refactor the code
- rewrite if you can't fix it.
- most importantly: write good code from the start.
Everyone finds it's own way of what clean code means, BUT there are few things you might want to know, which will help to reach that level/others understand your code (because in this world practically everything have it's own standards).
- Each Class/Method should be responsible just for one thing/task (OOP).
- Use best-practices:
- Comment your code, but not too much, just make it simple to understand.
- Use readable variable names, no more x1s, tempC.. etc...
- Do "big image" optimizations first, others latter.
- Read some open source projects code.
- Use Unit Testing or in best case TDD.
- Learn and use Design Patterns, C# implementations.
There are standards of writing the code read more about Design Engineering (talks about abstraction, architecture, patterns ... etc),
if you already have a spaghetti code Never Ever Ever Rewrite it. the golden rule is if it is not broken don't fix it. you have to design the interfaces and reshape the classes and just move the code carefully and test it. and to make clean code you need to make standard coding practices like naming conventions (as example) and follow the coding practices and standards at start of a project.
Read a book like cleancode,implementation patterns.They help a lot in understanding how to write clean code