Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何提升自己的代码质量 #2

Open
SoftSheepp opened this issue May 17, 2021 · 5 comments
Open

如何提升自己的代码质量 #2

SoftSheepp opened this issue May 17, 2021 · 5 comments

Comments

@SoftSheepp
Copy link

如题

@woohs
Copy link

woohs commented May 17, 2021

写的时候,多想想自己3个月后回来再维护现在的代码,能不能看懂

@yygmind
Copy link
Contributor

yygmind commented May 18, 2021

Github 是最丰富的开源库,这里面可以学到的东西非常非常多,还有就是有很多很便宜又高质量的教程,这些都可以提高编码质量。总归一句话,多看多学多写。

@iNorthIsle
Copy link

🤚 可以从以下几个方面反向思考:

  • 我的代码是否具有良好的编程风格与规范?
  • 我的代码是否易读、易理解?是否简单、逻辑清晰?一段时间后还能看懂吗?其他人接手的人是否也能很轻易的读懂你的代码?
  • 我的代码是否具有拓展性?是否可以在不修改或少量修改原有代码的情况下,通过扩展的方式添加新的功能代码?
  • 我的代码是否具有复用性?是否能达到减少重复代码的编写的目的?
  • 我的代码是否很容易编写单元测试?提高代码的可靠与稳定?

途径:

  • 学习设计思想、设计原则、设计模式、编码规范、重构技巧等;
  • 优秀的开源项目,他们的 commits 和 PR 中的 conversations 有很多能让你学到很多优秀的实践和技巧;
  • 优秀的社区,多逛逛,多看看,你会发现让你眼前一亮的东西;

@SoftSheepp
Copy link
Author

谢谢大佬们的解答呀

@fantingsheng
Copy link

如何提高代码的质量,就要知道什么样的代码是好代码。其实越往上走,可以从代码的效率,代码的结构设计等方面考虑。代码的效率就要从算法,语言特性出发,设计自然就要了解运用各种设计模式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants