从学通信的博士到从事IT行业的工程师 从原华为项目经理,到现任职公司架构师
发布时间:2012-12-23 20:37:22
是糟糕的代码毁掉了公司吗?不是代码,而是无穷无尽的需求和无法逃避的交付时间毁掉了代码和公司。停止增加新代码,代码质量才能得到提升。我们当然需要高质量代码,但那需要时间,如果只看到交付时间,最终肯定是糟糕的代码。这里最了解问题的是程序员,他/她应该说明实情,只重眼前利益(需求+交付时间),那么等于慢性自杀。唯一有效的解决方法是自始至终保持代码的清洁。编写整洁代码需要许多小技巧,编写整洁代码的程序员是艺术家。Bjarne Stroustrup的整洁标准:优雅高效,逻辑直接了当,减少依赖关系以利于维护。。。,整洁的代码只做好一件事。破窗理论:破了一扇窗户后如果没人管,那么所有窗户都会完蛋整洁的代码如......【阅读全文】
发布时间:2012-12-23 20:35:22
Observer is also known as dependents or publish-subscribe. When the object changes its state, its dependents will be notified and updated automatically. The key objects in this design pattern are subject and observer. A subject can have any number of observers. All observers will be notified on......【阅读全文】
发布时间:2012-12-23 20:33:33
Template method lets abstract base class (this is the class to implement the algorithm) to implement invariant algorithm. The subclasses can redefine the algorithm when necessary. By this mechanism, we can reuse the code.Normally, factory method is used by template to get instance of concrete s......【阅读全文】
发布时间:2012-12-23 20:29:27
chain of responsibilityWhen one object does not know which specific object will handle its request, the chain of responsibility can be used to forward request among all possible receivers to get final destination. The receivers are normally from same class hirarchy whose base class is one action-han......【阅读全文】
发布时间:2012-12-23 20:26:23
Factory method is virtual method to create local-specific object in the class hierarchy. The base class may or not implement it.If a parameter is passed to create method to create product by calling its virtual methods.this is abstract factory. The client can get all components from abstra......【阅读全文】