Abstract
Development has been several years, read countless code, some people write code logic is clear, the bug is difficult to hide; Minimum dependence, easy to maintain; Error handling is entirely based on a clear policy; Near-optimal performance, avoiding code clutter and unprincipled optimization; The post reading is really enjoyable, like reading an article.
But today I think DIss is some CV bigwigs, and the code that they write is horrible.
Come on, show
Mark bit and global variable too many, see scalp tingle, once there is a place to forget the program will go wrong
Public Result beginBusiness(Map<String, String> requestParmsMap,String myBusinessMessage,String) throws RuntimeException {system.out.println (" started "); // rule scheme ID String businessid = requestParMSmap.get (" businessid"); // Project GUID String myprojectKey = requestParmsmap. get("myprojectKey"); // reportType String reportType = requestparmsmap. get("reportType"); // dataConfigId String dataConfigId = requestParMSmap. get("dataConfigId"); String dataConfigCode = requestParMSmap. get("dataConfigCode"); // Client request ID String clientReqId = requestParmsmap. get("clientReqId"); String clientSymbol = requestParmsmap.get ("clientSymbol"); String startDateStr = RequestParMSmap. get("startDate"); // Data period start time String startDateStr = RequestParMSMap. get("startDate"); Date startDate = null; String endDateStr = requestParMSmap. get("endDate"); Date endDate = null; String isCalYesterday = "true"; try { if("false".equalsIgnoreCase(requestParmsMap.get("isCalYesterday"))) { isCalYesterday = String.valueOf(Boolean.valueOf(requestParmsMap.get("isCalYesterday"))); }} Catch (Exception e) {} // Check whether the time sequence meets the four time ascending relationship String agentTimeCheckEnable = requestParmsMap.get("agentTimeCheckEnable"); try { goodbusinessid = goodbusinessid.trim(); } catch (Exception e) { } try { myprojectKey = myprojectKey.trim(); } catch (Exception e) { } try { reportType = reportType.trim(); } catch (Exception e) { } try { dataConfigId = dataConfigId.trim(); } catch (Exception e) { } try { dataConfigCode = dataConfigCode.trim(); } catch (Exception e) { } try { clientReqId = clientReqId.trim(); } catch (Exception e) { } try { clientSymbol = clientSymbol.trim(); } catch (Exception e) { } try { agentTimeCheckEnable = String.valueOf(Boolean.valueOf(agentTimeCheckEnable.trim())); if("true".equalsIgnoreCase(agentTimeCheckEnable)) { agentTimeCheckEnable = "true"; }else { agentTimeCheckEnable = "false"; } } catch (Exception e) { agentTimeCheckEnable = "false"; } try { startDateStr = startDateStr.trim(); startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startDateStr); } catch (Exception e) { startDate = null; } try { endDateStr = endDateStr.trim(); endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(endDateStr); } catch (Exception e) { endDate = null; } if(stringutils.isblank (goodbusinessid) &&stringutils.isblank (myprojectKey)) {logger.info(" Error, requestParmsMap: {}", JSON.toJSONString(requestParmsMap)); Throw new RuntimeException(" Request parameters are wrong "); } if(StringUtils.isNotBlank(clientReqId) || StringUtils.isNotBlank(clientSymbol) ) { If (StringUtils. IsBlank (clientReqId) | | StringUtils. IsBlank (clientSymbol)) {logger. The info (" request parameter is flawed, requestParmsMap: {}", JSON.toJSONString(requestParmsMap)); Throw new RuntimeException(" Request parameters are wrong "); } List<EngineAchieveRequest> engineAchieveRequestList = this.engineAchieveRequestMapper.findByClientId(null, clientReqId, clientSymbol); If (CollectionUtils isNotEmpty (engineAchieveRequestList)) {logger. The info (" request parameters are incorrect, the customer have request number, repeat, requestParmsMap: {}", JSON.toJSONString(requestParmsMap)); Throw new RuntimeException(" Incorrect request parameters: duplicate customer request number "); }}Copy the code
// 报表类型
List<String> dataTypes = enginegoodbusinessMapper.findDataTypes();
// 有传goodbusinessid
Enginegoodbusiness oneEnginegoodbusiness = null;
try {
if(StringUtils.isNotBlank(goodbusinessid)) {
oneEnginegoodbusiness = enginegoodbusinessMapper.selectByPrimaryKey(Long.valueOf(goodbusinessid));
// 判断是否有效
if(oneEnginegoodbusiness.getStatus().intValue()!=3 && oneEnginegoodbusiness.getStatus().intValue()!=5) {
throw new Exception("规则方案配置未生效");
}
// 判断是否默认配置
if(StringUtils.isBlank(oneEnginegoodbusiness.getmyprojectKey())) {
throw new Exception("默认规则方案不能直接执行");
}
// 初始化ProjectId
if(StringUtils.isBlank(myprojectKey)) {
myprojectKey = oneEnginegoodbusiness.getmyprojectKey();
}
}
} catch (Exception e) {
logger.info("规则方案配置有误,requestParmsMap:{},ex:{}", JSON.toJSONString(requestParmsMap), e);
throw new RuntimeException("规则方案配置有误");
}
// 传了 myprojectKey
List<Enginegoodbusiness> pidEnginegoodbusinesss = null;
if(oneEnginegoodbusiness==null || oneEnginegoodbusiness.getId()==null) {
if(StringUtils.isNotBlank(myprojectKey)) {
if(StringUtils.isNotBlank(dataConfigId)) {
pidEnginegoodbusinesss = enginegoodbusinessMapper.findByCidIdAndPid(Long.valueOf(dataConfigId), myprojectKey);
}else if(StringUtils.isNotBlank(dataConfigCode)) {
DataConfig dc = dataConfigMapper.findByDataConfigCode(dataConfigCode);
pidEnginegoodbusinesss = enginegoodbusinessMapper.findByCidIdAndPid(Long.valueOf(dc.getId()), myprojectKey);
}else {
pidEnginegoodbusinesss = enginegoodbusinessMapper.findByPid(myprojectKey);
}
if(CollectionUtils.isEmpty(pidEnginegoodbusinesss)) {
if(StringUtils.isNotBlank(reportType)) {
pidEnginegoodbusinesss = enginegoodbusinessMapper.findDefaultCngBygoodbusinessDataType(reportType);
}else {
pidEnginegoodbusinesss = enginegoodbusinessMapper.findDefaultCng();
}
}
}
}
// 是否添加默认的配置
List<Enginegoodbusiness> defaultEnginegoodbusinesss = enginegoodbusinessMapper.findDefaultCngsByDataTypes(dataTypes);
List<Enginegoodbusiness> needDefaultEnginegoodbusinesss = new ArrayList<>();
for(Enginegoodbusiness defaultEnginegoodbusiness:defaultEnginegoodbusinesss) {
boolean isNeedAdd = true;
for(Enginegoodbusiness pidEnginegoodbusiness:pidEnginegoodbusinesss) {
// 默认配置已经包含在内,直接跳过
if(defaultEnginegoodbusiness.getId().equals(pidEnginegoodbusiness.getId())) {
isNeedAdd = false;
break;
}
// 默认配置的时间是否重复
if(defaultEnginegoodbusiness.getgoodbusinessDataType().equals(pidEnginegoodbusiness.getgoodbusinessDataType()) && DateUtil.isInDate(pidEnginegoodbusiness.getStartDate(), pidEnginegoodbusiness.getEndDate(), defaultEnginegoodbusiness.getStartDate(), defaultEnginegoodbusiness.getEndDate())) {
isNeedAdd = false;
break;
}
}
if(isNeedAdd) {
needDefaultEnginegoodbusinesss.add(defaultEnginegoodbusiness);
}
}
if(CollectionUtils.isNotEmpty(needDefaultEnginegoodbusinesss)) {
pidEnginegoodbusinesss.addAll(needDefaultEnginegoodbusinesss);
}
// 基本数据校验
List<Enginegoodbusiness> enginegoodbusinesssNeedCk = new ArrayList<Enginegoodbusiness>();
if(oneEnginegoodbusiness!=null && oneEnginegoodbusiness.getId()!=null) {
if(this.checkEnginegoodbusinessIsSimpleOk(oneEnginegoodbusiness, Arrays.asList(Integer.valueOf(3),Integer.valueOf(5)))) {
enginegoodbusinesssNeedCk.add(oneEnginegoodbusiness);
}
}else {
if(CollectionUtils.isNotEmpty(pidEnginegoodbusinesss)) {
for(Enginegoodbusiness dbEnginegoodbusiness : pidEnginegoodbusinesss) {
if(this.checkEnginegoodbusinessIsSimpleOk(dbEnginegoodbusiness, Arrays.asList(Integer.valueOf(3),Integer.valueOf(5)))) {
enginegoodbusinesssNeedCk.add(dbEnginegoodbusiness);
}
}
}
}
// 方案规则
List<Enginegoodbusiness> enginegoodbusinesss = new ArrayList<Enginegoodbusiness>();
// 数据配置校验
try {
for(Enginegoodbusiness filterEnginegoodbusiness : enginegoodbusinesssNeedCk) {
DataConfig dataConfigCk = dataConfigMapper.selectByPrimaryKey(Long.valueOf(filterEnginegoodbusiness.getDataConfigId()));
// 不符合条件的数据模版过滤
if(this.checkDataConfigIsOk(dataConfigCk, Integer.valueOf(1))==false) {
continue;
}
// 不符合条件的规则方案过滤
if(this.checkEnginegoodbusinessIsOk(filterEnginegoodbusiness, Arrays.asList(Integer.valueOf(3),Integer.valueOf(5)))==false) {
continue;
}
enginegoodbusinesss.add(filterEnginegoodbusiness);
}
} catch (Exception e) {
logger.error("数据配置不正确,requestParmsMap:{},ex:{}", JSON.toJSONString(requestParmsMap), e);
throw new RuntimeException("数据配置不正确");
}
if(CollectionUtils.isEmpty(enginegoodbusinesss)) {
logger.error("找不到适合的方案规则,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("找不到适合的方案规则");
}
// 方案规则是否可计算
boolean canCal = false;
for(Enginegoodbusiness enginegoodbusiness : enginegoodbusinesss) {
// 方案为“3:审核通过”、“5:生效”为可计算
if(enginegoodbusiness!=null && (enginegoodbusiness.getStatus().intValue()==3 || enginegoodbusiness.getStatus().intValue()==5)) {
canCal = true;
break;
}
}
if(canCal==false) {
logger.error("找不到适合的方案规则(canCal==false),requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("找不到适合的方案规则");
}
// 按时间过滤规则
if(startDate!=null || endDate!=null) {
enginegoodbusinesssNeedCk.clear();
enginegoodbusinesssNeedCk.addAll(enginegoodbusinesss);
enginegoodbusinesss.clear();
for(Enginegoodbusiness enginegoodbusinessCk : enginegoodbusinesssNeedCk) {
if( (startDate==null || startDate.compareTo(enginegoodbusinessCk.getStartDate())<=0) && (endDate==null || endDate.compareTo(enginegoodbusinessCk.getEndDate())>=0) ) {
enginegoodbusinesss.add(enginegoodbusinessCk);
}
}
}
// 检查规则是否唯一
if (!checkEnginegoodbusinesssIsUnique(enginegoodbusinesss)) {
logger.error("找不到适合的方案规则,规则不唯一,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("找不到适合的方案规则");
}
//判断project是否存在
Proj proj = this.projMapper.getProjIdBymyprojectKey(myprojectKey);
if(proj==null) {
logger.error("项目不存在,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("项目不存在");
}
// 根据结束时间从大到小排序
Collections.sort(enginegoodbusinesss, new Comparator<Enginegoodbusiness>() {
@Override
public int compare(Enginegoodbusiness o1, Enginegoodbusiness o2) {
if(o1==null||o1.getEndDate()==null) {
return -1;
}
int dateCom = o2.getEndDate().compareTo(o1.getEndDate());
if(dateCom==0) {
dateCom = o2.getStartDate().compareTo(o1.getStartDate());
}
return dateCom;
}
});
// 再次校验请求号
if(StringUtils.isNotBlank(clientReqId) || StringUtils.isNotBlank(clientSymbol) ) {
if(StringUtils.isBlank(clientReqId)||StringUtils.isBlank(clientSymbol)) {
logger.info("请求参数有误,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("请求参数有误");
}
List<EngineAchieveRequest> engineAchieveRequestList = this.engineAchieveRequestMapper.findByClientId(null, clientReqId, clientSymbol);
if(CollectionUtils.isNotEmpty(engineAchieveRequestList)) {
logger.info("请求参数有误,客户请求号有重复,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("请求参数有误:客户请求号有重复");
}
}
EngineAchieveRequest engineAchieveRequest = new EngineAchieveRequest();
engineAchieveRequest.setRequestId(CommissionUtil.buildgoodbusinessId("Req"));
engineAchieveRequest.setCaltype(0);
engineAchieveRequest.setStatus(3);
engineAchieveRequest.setMessage("初始化");
engineAchieveRequest.setClientRequestId(clientReqId);
engineAchieveRequest.setClientSymbol(clientSymbol);
this.engineAchieveRequestMapper.insertSelective(engineAchieveRequest);
// 再次校验请求号,防止并发重复的问题
if(StringUtils.isNotBlank(clientReqId) || StringUtils.isNotBlank(clientSymbol) ) {
if(StringUtils.isBlank(clientReqId)||StringUtils.isBlank(clientSymbol)) {
logger.info("请求参数有误,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("请求参数有误");
}
List<EngineAchieveRequest> engineAchieveRequestList = this.engineAchieveRequestMapper.findByClientId(null, clientReqId, clientSymbol);
if(CollectionUtils.isNotEmpty(engineAchieveRequestList)&&engineAchieveRequestList.size()>1) {
logger.info("请求参数有误,客户请求号有重复,requestParmsMap:{}", JSON.toJSONString(requestParmsMap));
throw new RuntimeException("请求参数有误:客户请求号有重复");
}
}Copy the code
What is this big mess,
// 异步执行
final String finalRequestId = engineAchieveRequest.getRequestId();
final Long finalEngineAchieveRequestId = engineAchieveRequest.getId();
final String finalClientRequestId = clientReqId;
final String finalClientSymbol = clientSymbol;
final String finalAgentTimeCheckEnable = agentTimeCheckEnable;
final List<Enginegoodbusiness> finalEnginegoodbusinesss = enginegoodbusinesss;
final String finalmyprojectKey = myprojectKey;
final String finalIsCalYesterday = isCalYesterday;
final Map<String, String> reqMap = new HashMap<String, String>();
reqMap.put("myprojectKey", finalmyprojectKey);
reqMap.put("isCalYesterday", finalIsCalYesterday);
enginegoodbusinessServiceExecutor.execute(() -> {
StringBuilder sb = new StringBuilder();
sb.append("1.enginegoodbusinessServiceExecutor-finalmyprojectKey="+finalmyprojectKey+"\r\n");
sb.append("1.enginegoodbusinessServiceExecutor-finalRequestId="+finalRequestId+"\r\n");
sb.append("1.enginegoodbusinessServiceExecutor-finalClientRequestId="+finalClientRequestId+"\r\n");
EngineAchieveRequest preEngineAchieveRequest = this.engineAchieveRequestMapper.selectByPrimaryKey(finalEngineAchieveRequestId);
preEngineAchieveRequest.setMessage("运行中");
preEngineAchieveRequest.setStatus(2);
this.engineAchieveRequestMapper.updateByPrimaryKeySelective(preEngineAchieveRequest);
Enginegoodbusiness enginegoodbusinessNow = null;
try {
// 成功
Map<String, EngineAchieveRequestResult> sucessAchieveRequestResults = new HashMap<>();
// 失败
Map<String, EngineAchieveRequestResult> failAchieveRequestResults = new HashMap<>();
// 一次执行一条规则内容
for(Enginegoodbusiness enginegoodbusiness : finalEnginegoodbusinesss) {
sb.append("2.enginegoodbusinessServiceExecutor-enginegoodbusiness="+enginegoodbusiness.getId()+","+enginegoodbusiness.getgoodbusinessName()+"\r\n");
try {
EngineAchieveRequest eAchieveRequest = new EngineAchieveRequest();
eAchieveRequest.setRequestId(finalRequestId);
eAchieveRequest.setCaltype(0);
eAchieveRequest.setStatus(2);
eAchieveRequest.setMessage("运行中");
eAchieveRequest.setClientRequestId(finalClientRequestId);
eAchieveRequest.setClientSymbol(finalClientSymbol);
eAchieveRequest.setgoodbusinessId(enginegoodbusiness.getId());
this.engineAchieveRequestMapper.insertSelective(eAchieveRequest);
enginegoodbusinessNow = enginegoodbusiness;
String batchNo = null;
// 方案为“3:审核通过”、“5:生效”为可计算
if(enginegoodbusiness!=null && (enginegoodbusiness.getStatus().intValue()==3 || enginegoodbusiness.getStatus().intValue()==5)) {
// 转换对象
ClassUtil<EnginegoodbusinessVo> classUtil = new ClassUtil<EnginegoodbusinessVo>(EnginegoodbusinessVo.class);
EnginegoodbusinessVo enginegoodbusinessVo = classUtil.changeTo(enginegoodbusiness);
// 根据规则配置,组建数据对象EngineFactVo
List<EngineFactVo> engineFactVos = goodbusinessEngineHandler.buildEngineFactVos(enginegoodbusinessVo, reqMap,sb);
// 开始处理数据
if(CollectionUtils.isNotEmpty(engineFactVos)) {
logger.info("EngineFact数据库查询,List<EngineFactVo> engineFactVos,Size:{},enginegoodbusinessVo:{},reqMap:{}", String.valueOf(engineFactVos.size()), enginegoodbusinessVo, reqMap);
List<EngineFactVo> dualEngineFactVos = new ArrayList<EngineFactVo>();
// 需分批处理数据,防止内存使用过大
int engineFactVosIndex = 0;
for (EngineFactVo engineFactVo : engineFactVos) {
engineFactVosIndex++;
dualEngineFactVos.add(engineFactVo);
if(engineFactVosIndex%this.goodbusinessEngineHandler.Batch_Engine_Cal_Size==0||engineFactVos.size()==engineFactVosIndex) {
List<EnginegoodbusinessVo> egoodbusinessVos = new ArrayList<EnginegoodbusinessVo>();
egoodbusinessVos.add(enginegoodbusinessVo);
// 加载引擎规则
KieContainer kieContainer = goodbusinessEngineHandler.getKieContainer(egoodbusinessVos);
goodbusinessEngineHandler.factExcute(kieContainer, dualEngineFactVos);
dualEngineFactVos.clear();
}
sb.append("4.2-for.end engineFactVo.getHitgoodbusinessMessage().getEnginegoodbusinessid()="+engineFactVo.getHitgoodbusinessMessage().getEnginegoodbusinessid()+" \r\n");
}
sb.append("4.3-for循环engineFactVos \r\n");
int mathSize = 0;
for(EngineFactVo engineFactVo : engineFactVos) {
// 设置其时间顺序是否满足四个时间依次递增关系
engineFactVo.getgoodbusinessOtherMessage().setAgentTimeCheckEnable(finalAgentTimeCheckEnable.trim());
// 计算匹配的数目
if(engineFactVo.getHitgoodbusinessMessage()!=null&&StringUtils.isNotBlank(engineFactVo.getHitgoodbusinessMessage().getHitgoodbusinessExpressionPosition())) {
mathSize++;
}
}
// 数据处理引擎的结果
String batchRequestId = String.valueOf(finalRequestId);
DealEngineFactDataResult dualResult = this.dealEngineFactData(enginegoodbusiness, engineFactVos, null, null, batchRequestId,sb);
batchNo = dualResult.getBatchNo();
// 处理结果信息
List<EngineAchieveRequestResult> dualAchieveRequestResults = dualResult.getDualAchieveRequestResults();
if(CollectionUtils.isNotEmpty(dualAchieveRequestResults)) {
for(EngineAchieveRequestResult engineAchieveRequestResult : dualAchieveRequestResults) {
if(engineAchieveRequestResult!=null && engineAchieveRequestResult.getStatus()!=null && StringUtils.isNotBlank(engineAchieveRequestResult.getPk1())) {
if(engineAchieveRequestResult.getStatus().intValue()==1) { // 处理成功
sucessAchieveRequestResults.put(engineAchieveRequestResult.getPksKey(), engineAchieveRequestResult);
failAchieveRequestResults.remove(engineAchieveRequestResult.getPksKey());
}else { // 处理失败
if(!sucessAchieveRequestResults.keySet().contains(engineAchieveRequestResult.getPksKey())) {
failAchieveRequestResults.put(engineAchieveRequestResult.getPksKey(), engineAchieveRequestResult);
}
}
}
else
{
}
}
}
else
{
}
// 计算报表
goodbusinessReportTypeEnum rrtEnum = goodbusinessReportTypeEnum.getByKey(enginegoodbusiness.getgoodbusinessDataType());
if(goodbusinessReportTypeEnum.Agent.equals(rrtEnum)) {
this.agentCommisionToReportService.ToReport(batchNo, reqMap.get("myprojectKey"));
}
}
else
{
}
}
else
{
}
eAchieveRequest.setMessage("成功");
eAchieveRequest.setStatus(1);
eAchieveRequest.setCalcommissionbatchno(batchNo);
this.engineAchieveRequestMapper.updateByPrimaryKeySelective(eAchieveRequest);
} catch (Exception e) {
logger.error("计算处理失败,exception:{}", e);
}
}Copy the code
Be entangled with death
List<EngineAchieveRequest> newEegAchieveRequests = this.engineAchieveRequestMapper.findByReqId(finalRequestId); if(CollectionUtils.isNotEmpty(newEegAchieveRequests)&&newEegAchieveRequests.size()>1) { this.engineAchieveRequestMapper.deleteByPrimaryKey(preEngineAchieveRequest.getId()); } if(MapUtils.isNotEmpty(sucessAchieveRequestResults) && CollectionUtils.isNotEmpty(sucessAchieveRequestResults.values())) { List<EngineAchieveRequestResult> sucessResults = new ArrayList<>(); sucessResults.addAll(sucessAchieveRequestResults.values()); this.engineAchieveRequestResultMapper.insertBatch(sucessResults); } if(MapUtils.isNotEmpty(failAchieveRequestResults) && CollectionUtils.isNotEmpty(failAchieveRequestResults.values())) { List<EngineAchieveRequestResult> failResults = new ArrayList<>(); failResults.addAll(failAchieveRequestResults.values()); this.engineAchieveRequestResultMapper.insertBatch(failResults); } sb.append("6.2 finish \r\n"); Logger. The info (" end computing, enginegoodbusinessServiceExecutor. The execute (), finalEnginegoodbusinesss: {}, reqMap: {}", JSON.toJSONString(finalEnginegoodbusinesss), JSON.toJSONString(reqMap)); } catch (Exception e) {sb.append(' 7.1 computing Exception '+ LLDB etMessage()+' r\n '); List<EngineAchieveRequest> errAchieveRequests = this.engineAchieveRequestMapper.findByReqId(finalRequestId); String errMsg = e.getMessage(); if(errMsg.length()>200) { errMsg = errMsg.substring(0, 200); } if(CollectionUtils.isNotEmpty(errAchieveRequests)) { for(EngineAchieveRequest errAchieveRequest : errAchieveRequests) { errAchieveRequest.setMessage(errMsg); errAchieveRequest.setStatus(0); this.engineAchieveRequestMapper.updateByPrimaryKeySelective(errAchieveRequest); } } if(CollectionUtils.isNotEmpty(errAchieveRequests)&&errAchieveRequests.size()>1) { this.engineAchieveRequestMapper.deleteByPrimaryKey(preEngineAchieveRequest.getId()); } logger.error(" enginegoodBusiness: {}, exception: {}", enginegoodbusinessNow, e); } finally { logger.info(sb.toString()); }}); Logger. info(" calCommonCommission(), requestParmsMap: {}", json.tojsonString (requestParmsMap)); Result result=new Result(); result.setStatus(StatusCode.SUCCESS); Result.setmessage (" Commission calculation request successful "); result.setData(engineAchieveRequest.getRequestId()); return result; / / to the end. And you're done. }Copy the code
Show the completion of
This is real code that I worked with at the company, just to list a few problems
- Too many flag bits and global variables
- Logic not simple enough
- The function is not properly designed
- Poor readability (you may only understand it yourself)
- Repeat judgments without comments
As a qualified programmer, such code should not appear in our production, strict project manager, architect will let you refactor, we have to write codes with their own style of specification you meet the strange code also comment out
Public number: program Zero world (C0W1024) for more article information