代码添加注释规范

 没有注释的代码就是一坨屎,又烂又臭。

  在写代码时就应该添加注释,这时在你的脑子里的是清晰完整的思路。

 如果在代码最后再添加注释,它将花费你双倍的时间。

  1、对每个类添加注释:包括摘要信息,作者信息,最近修改日期等;

复制代码
  
  
// AppReviewAlertView.h
// iSuzhouCity
//
// Created by Chen Nan on 5/24/11.
// Copyright 2011 Yulong. All rights reserved.
//
// Utility classes
// Prompts users to rate the app via App Store,
// if they have use the app for defined days and defined times.
//
// Revision History
// 2011-05-24 | Charles | First draft.
// 2011-06-29 | Charles | 设置产品化的参数.
复制代码

  2、对每个方法添加注释:包括用途、功能和返回值。

复制代码
  
  
/*
Must Call this method at the end of app delegate's
application:didFinishLaunchingWithOptions: method.

The rating alert
can also be triggered by appEnteredForeground: and userDidSignificantEvent:
(as long as you pass YES for canPromptForRating in those methods).
*/
+ ( void )appLaunched:(BOOL)canPromptForRating;
复制代码

  3、对一些变量添加注释;

  4、用TODO标签表示该段代码还未完成;

  
  
// TODO: implement the datepickview
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值