---
title: "编写程序原则"
author: "freesea"
date: "2010-09-01T09:46:28Z"
tags: []
categories: ["编程语言"]
slug: "untitled"
draft: false
lastmod: "2010-09-01T09:54:08Z"
id: 752365
url: "https://freesea.iteye.com/blog/752365"
---

1、单一责任原则--&gt;一个类只有一个责任或动机

 

2、把方法设计成：要么改变对像的状态，要么返回信息。不要两件事都做。

 

3、消除重复代码

 

4、保证代码是干净和富有表现力的

 

5、将类和方法的数量减到最小