写代码的艺术
文章平均质量分 89
Dreamer who
=== Happiness isn't something you experience; it's something you remember.
展开
-
ArchUnit在代码检测方面的应用
1、为什么做代码检测功能 不管使用哪种语言,哪种框架,只要你编程,都会遇到些所谓的“坑”,只能靠代码检测工具自动发现这些问题,因为人脑或者是人并不总是最靠谱的。也行你已经用了阿里的检查插件P3C,或者SonarQube、JArchitect、checkstyle或者findbugs等等工具来检测来避免,现在介绍一款java的基于字节码的我们可以自定义的,比较通用的检测工具。2、ArchUnit 使用这个工具的目的,其实想利用java反射的方式,基于字节码解析...原创 2021-04-26 11:30:44 · 1084 阅读 · 0 评论 -
Google首席工程师Joshua Bloch谈如何设计优秀的API
Google首席工程师Joshua Bloch谈如何设计优秀的APIHow to Design a Good API and Why it MattersWhy is API Design Important?APIs can be among a company's greatest assets_ Customers invest原创 2016-07-24 19:45:48 · 3163 阅读 · 1 评论 -
java SPI 与cooma(dubbo 微容器改良品)--2 之Cooma SPI
java SPI 与cooma(dubbo 微容器改良品)--2 之Cooma SPI Cooma是一个极简、灵活的开源Java微容器(microcontainer)实现,其实现源于dubbo的spi(它来源于java spi)。让我们看一下简单的demo:概念:Extension Point,扩展点,要扩展的接口。提倡面向接口的编程,这些接口定义就变成原创 2016-07-25 23:38:01 · 2561 阅读 · 3 评论 -
java设计模式之单例模式(Singleton pattern)
java设计模式之单例模式(Singleton pattern)单例模式的定义:Singleton pattern restricts the instantiation of a class and ensures that only one instance of the class exists in the java virtual machine. The singlet原创 2016-08-01 12:42:32 · 1879 阅读 · 0 评论 -
REST API 设计规则
REST API 设计规则URIsREST API用URI(Uniform Resource Identifiers )来表示资源。例如: http://api.example.restapi.org/france/paris/louvre/leonardo-da-vinci/mona-lisa下面的URI就可读性很差: http://api.example.r原创 2016-11-06 18:55:03 · 3108 阅读 · 0 评论 -
Effective Java
Effective Java1.考虑使用静态工厂方法而不是构造函数例如:Integer类中的: public static Integer valueOf(int i) { if (i >= IntegerCache.low && i <= IntegerCache.high) return IntegerCache.cache[i + (-原创 2016-11-09 00:21:03 · 1005 阅读 · 0 评论 -
高效能程序员的修炼
高效能程序员的修炼一、永远都是你的错在怨天尤人之前,我们应该自我反省、努力把自身的问题解决了。、代码产权的另一方面是代码责任。无论你的软件出现什么样的问题--甚至最开始错的地方根本就不是你的代码-你也应该总是假定问题出在你的代码里,并且根据这个假设采取行动。二、大道至简你永远都有简化的空间。作为一个软件开发者,你就是自己最大的敌人。你越早认识到这点,你的境况就会原创 2017-02-12 15:46:59 · 1072 阅读 · 0 评论 -
分层架构之间的调用关系
为了美感和欣赏!艺术家们提出了设计即化妆!为了有共同的语言交流,就制定了化妆规则! 代码记得分层,为了避免循环依赖,上层只能调用下层,严格的只能调用临近的下层,而不能跨层。如果跨层,可以用事件的方式(后门,但不能随便乱用啊)。 注:同层之间最好不要相互调用,因为也会带来循环依赖!https://msdn.microsoft.com/en-us/library/ee658109...原创 2018-04-05 16:42:40 · 2041 阅读 · 0 评论 -
利用Swagger Maven Plugin生成Rest API文档
利用Swagger Maven Plugin生成Rest API文档Swagger Maven PluginThis plugin enables your Swagger-annotated project to generate Swagger specs and customizable, templated static documents during t原创 2016-03-06 23:49:21 · 18595 阅读 · 5 评论 -
Building Maintainable Software-java篇之 Write Clean Code
Building Maintainable Software-java篇之 Write Clean CodeWriting clean code is what you must do in order to call yourself a professional.—Robert C. MartinGuideline:• Write clean code.原创 2016-02-16 23:16:10 · 1947 阅读 · 0 评论 -
Building Maintainable Software-java篇之Write Simple Units of Code
Building Maintainable Software-java篇之Write Simple Units of Code Each problem has smaller problems inside. —MartinFowlerGuide原创 2016-02-12 14:46:05 · 1095 阅读 · 0 评论 -
Building Maintainable Software-java篇之Write Code Once
Building Maintainable Software-java篇之Write Code OnceNumber one in the stink parade is duplicated code.—Kent Beck and Martin Fowler,Bad Smells in CodeGuideline:• Do not copy code.原创 2016-02-13 12:45:55 · 1750 阅读 · 0 评论 -
Building Maintainable Software-java篇之Keep Unit Interfaces Small
Building Maintainable Software-java篇之Keep Unit Interfaces SmallBunches of data that hang around together really ought to be made into their own object. —Marti原创 2016-02-13 13:18:41 · 1614 阅读 · 0 评论 -
Building Maintainable Software-java篇之Separate Concerns in Modules
Building Maintainable Software-java篇之Separate Concerns in Modules In a system that is both complex and tightly coupled, accidents are inevitable.—Charles Perrow’s Normal Accidentstheory in原创 2016-02-13 14:24:55 · 1677 阅读 · 0 评论 -
Building Maintainable Software-java篇之Couple Architecture Components Loosely
Building Maintainable Software-java篇之Couple Architecture Components LooselyThere are two ways of constructing a software design: one way is to make it so simplethat there are obviously no de原创 2016-02-15 23:41:24 · 1555 阅读 · 0 评论 -
Building Maintainable Software-java篇之Keep Architecture Components Balanced
Building Maintainable Software-java篇之Keep Architecture Components BalancedBuilding encapsulation boundaries is a crucial skill in software architecture. —George H. F原创 2016-02-16 00:00:16 · 1601 阅读 · 0 评论 -
Building Maintainable Software-java篇之Keep Your Codebase Small
Building Maintainable Software-java篇之Keep Your Codebase SmallProgram complexity grows until it exceeds the capability of the programmer who must maintain it.—7th Law of Computer Programming原创 2016-02-16 22:36:56 · 1743 阅读 · 0 评论 -
Building Maintainable Software-java篇之Automate Tests
Building Maintainable Software-java篇之Automate TestsKeep the bar green to keep the code clean.—The jUnit mottoGuideline:• Automate tests for your codebase.• Do this by writing autom原创 2016-02-16 22:58:19 · 1072 阅读 · 0 评论 -
Building Maintainable Software-java篇之Write Short Units of Code
Building Maintainable Software-java篇之Write Short Units of CodeAny fool can write code that a computer can understand. Good programmers writecode that humans can understand.原创 2016-02-12 12:05:22 · 1654 阅读 · 0 评论