Functions
F1: Too Many Arguments
Functions should have a small number of arguments. No argument is best, followed by
one, two, and three. More than three is very questionable and should be avoided with prejudice.
(See “Function Arguments” on page 40.)
F2: Output Arguments
Output arguments are counterintuitive. Readers expect arguments to be inputs, not outputs.
If your function must change the state of something, have it change the state of the
object it is called on. (See “Output Arguments” on page 45.)
F3: Flag Arguments
Boolean arguments loudly declare that the function does more than one thing. They are
confusing and should be eliminated. (See “Flag Arguments” on page 41.)
F4: Dead Function
Methods that are never called should be discarded. Keeping dead code around is wasteful.
Don’t be afraid to delete the function. Remember, your source code control system still
remembers it.
my note: in my opinion, flag isn't that beautiful, should not be used. especially those flag as function arguments.
Java
J1: Avoid Long Import Lists by Using Wildcards
J2: Don’t Inherit Constants
This is a hideous practice! The constants are hidden at the top of the inheritance hierarchy.
Ick! Don’t use inheritance as a way to cheat the scoping rules of the language. Use a static
import instead.
J3: Constants versus Enums
分享到:
相关推荐
### ALGOL的核心理念与影响 #### 一、引言 ALGOL 60作为编程语言设计领域中具有里程碑意义的语言,不仅在理论上产生了深远的影响,在实践中的应用也极其广泛。本文旨在深入探讨ALGOL的核心原则,并通过构建一个...
essence_of_time
一篇经典的论文,描述了algol语言设计的一些基本属性,适用于对plt感兴趣的读者
《系统分析与设计的精髓:一种习题式方法》是Priti Srinivas Sajja所著的一本关于系统分析与设计领域知识的书籍。系统分析与设计是一门关注于理解用户需求并设计系统以满足这些需求的学科。这本书可能采用习题式的...
### 敏捷的本质——迪恩·莱芬威尔 #### 知识点一:敏捷方法的概念与实践 **概念概述:** 迪恩·莱芬威尔在《敏捷的本质》中提出,从概念上讲,敏捷是非常简单的。它改变了软件开发和项目管理的方式。...
• Representative latest commercial MEMS (inertia sensors, pressure sensor, microphone and timing oscillator) were briefly reviewed, and key technologies used in them were explained. ...
### C++ 的本质 本文档由C++之父Bjarne Stroustrup撰写,主要探讨了C++语言的核心概念及其如何与其他编程语言区分开来。文章深入分析了C++的各种特性,尤其是C++11和C++14版本中引入的新特性,并探讨了这些特性如何...
抽象精品ppt模板essence_of_time113
《三相交流到交流转换器系统的核心》 在电力电子系统实验室,位于苏黎世的瑞士联邦理工学院,J. W. Kolar、T. Friedli、F. Krismer和S. D....本文首先介绍了常用的电压型和电流型直流环节(DC-link)转换器系统,这些...
### 敏捷的本质 #### Henrik Kniberg 的关键演讲 本次关键演讲由敏捷与精益教练 Henrik Kniberg 在 2010 年 10 月 8 日于乌克兰基辅举行的“敏捷东欧”大会上发表。Kniberg 通过一系列实例与分析,探讨了敏捷方法...
本文主题是观测相对论,即“Observational relativity”,文章作者阮晓钢探讨了信息波速度的不变性和广义洛伦兹变换,通过这两者的推导,建立起观测相对论,并试图统一爱因斯坦的狭义相对论和德布罗意的物质波理论。...
"C_language_example_of_the_essence.rar_The_Essence"这个压缩包显然是一个聚焦于C语言核心概念的资源集合,旨在帮助学习者理解和掌握C语言的精髓。在这个压缩包中,我们可以期待找到一系列精心挑选的编程示例,...
而s book consists of six chapters, which can be grouped ... This implies that if you want to understand the essence of Deep Leaming, you have to know the philosophy behind Machine Leaming to some extent.
### No Silver Bullet: Essence and Accidents of Software Engineering #### 概述 《No Silver Bullet: Essence and Accidents of Software Engineering》是一篇由Frederick P. Brooks Jr.撰写的经典论文,首次...
华硕Xonar Essence STX声卡是一款面向高端用户群体的HiFi级声卡产品,其主要面向那些追求高品质音频体验的用户,支持64位Windows操作系统。用户手册详细介绍了声卡的包装内容、系统需求、规格参数、安装步骤以及声卡...
linux入门精华-主要介绍Linux安装,Linux命令,Linux网络,Linuxsamba服务
A pioneer of artificial... It is the essence of human and artificial intelligence. And just as Pearl's discoveries have enabled machines to think better, The Book of Why explains how we can think better.