code review如何提高質(zhì)量_第1頁
code review如何提高質(zhì)量_第2頁
code review如何提高質(zhì)量_第3頁
code review如何提高質(zhì)量_第4頁
code review如何提高質(zhì)量_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

BestpracticeofcodereviewusingGit/Gerrit

AgendaCodeReview案例學(xué)習(xí)如何推廣、實(shí)施CodeReview如何提高review質(zhì)量2CaseStudy–Cisco/CollaboratorCodeReviewCaseStudy:CiscoSystems提高代碼review效率和積極性團(tuán)隊(duì)5人,10月,2500review,3200KLOC線下review協(xié)作,方便交流與bug系統(tǒng)集成(我們是fisheye+jira)直觀、易用、高效3BeforeCodeReview4AfterCodeReview5AgendaCodeReview案例學(xué)習(xí)如何推廣、實(shí)施CodeReview如何提高CodeReview質(zhì)量6大家都想要的7減少RCA、Bug提高代碼質(zhì)量提高開發(fā)水平團(tuán)隊(duì)凝聚力營(yíng)造工程師文化。。。以前的codereview為何執(zhí)行不下去?工具不專業(yè):XX項(xiàng)目請(qǐng)review,哪行改了不知道,自己去找績(jī)效難定義:缺少數(shù)據(jù)分析和KPI,沒法監(jiān)控,領(lǐng)導(dǎo)不好抓各種形式的Codereview,沒工具,沒閉環(huán)。Review了,但代碼沒改SMARTGoalSMARTCodereviewSystemSpecific需要專業(yè)的工具。Relevant不影響開發(fā)效率的流程.Achievable容易操作,容易分享、容易整體提高效率Measureable可度量,可評(píng)測(cè)的KPI(提交85%,完成95%)Timebase一定時(shí)間范圍內(nèi)的考核機(jī)制8首先轉(zhuǎn)變和培養(yǎng)大部分Dev對(duì)代碼質(zhì)量的意思和重視度以我們的經(jīng)驗(yàn),工具/流程/KPI最重要9What&WhyWho主管、經(jīng)理–發(fā)現(xiàn)問題,最終負(fù)責(zé)人不同的角色,review的目的可以不同資深開發(fā)人員–發(fā)現(xiàn)問題資深領(lǐng)域?qū)<舀C發(fā)現(xiàn)問題新人

-學(xué)習(xí)、融入架構(gòu)師

-確保設(shè)計(jì)被正確實(shí)現(xiàn);檢驗(yàn)設(shè)計(jì)是否有偏差When開發(fā)階段,毫無疑問

mit改變的是review子流程,影響review的及時(shí)性和覆蓋率,從而影響質(zhì)量和效率,需要區(qū)別對(duì)待來推廣WhereWeb,IDE看代碼面對(duì)面討論代碼How單人review–簡(jiǎn)單case多人review–復(fù)雜caseReviewmeeting–核心代碼酒店codereview經(jīng)驗(yàn)分享10階段成果:2月試點(diǎn)與優(yōu)化,5月開始酒店全面執(zhí)行已完成600萬行,產(chǎn)生4000條comments測(cè)試反饋:測(cè)試bug少了,代碼質(zhì)量有提高AchievementAgendaCodeReview案例學(xué)習(xí)如何推廣、實(shí)施CodeReview如何提高CodeReview質(zhì)量11如何提高review質(zhì)量如何提高review質(zhì)量Code質(zhì)量Comments質(zhì)量自動(dòng)化預(yù)審核12代碼質(zhì)量指標(biāo)正確性可編譯可讀性可維護(hù)性可復(fù)用性13可讀性

publicSearchHotelDataResponseProcessData(SearchHotelDataResponsesearchHotelResponse,SearchHotelDataRequestsearchHotelRequest,objectstatus=null)

{

Stopwatchsw=null;

try

{

#regionlogic

if(ConfigurationTypeConst.EnableRoomTicketGiftsProcess())

{

sw=Stopwatch.StartNew();

stringsearchtype=searchHotelRequest.SearchTypeEntity.SearchType.ToString();

varRoomTicketGiftsDic=RoomTicketGiftsDataBusiness.Instance.GetAllDataFromNativeCache();

searchHotelResponse.HotelDataList.ForEach(hotelDataList=>

{

intcity=hotelDataList.HotelStaticInfoEntity.HotelBaseInfoEntity.City;

intstar=hotelDataList.HotelStaticInfoEntity.HotelBaseInfoEntity.Star;

Dictionary<int,List<int>>cityTicketIDDict=null;

Dictionary<int,List<int>>starTicketIDDict=null;

Dictionary<int,List<int>>typeTicketIDDict=null;

List<RoomTicketGifts>roomTicketGifts=null;……………….14publicSearchHotelDataResponseProcessData(SearchHotelDataResponsesearchHotelResponse,SearchHotelDataRequestsearchHotelRequest,objectstatus=null)

{

Stopwatchsw=null;

try

{

#regionlogic

if(ConfigurationTypeConst.EnableRoomTicketGiftsProcess())

{

sw=Stopwatch.StartNew();

stringsearchtype=searchHotelRequest.SearchTypeEntity.SearchType.ToString();

varRoomTicketGiftsDic=RoomTicketGiftsDataBusiness.Instance.GetAllDataFromNativeCache();

searchHotelResponse.HotelDataList.ForEach(hotelDataList=>

{

intcity=hotelDataList.HotelStaticInfoEntity.HotelBaseInfoEntity.City;

intstar=hotelDataList.HotelStaticInfoEntity.HotelBaseInfoEntity.Star;

Dictionary<int,List<int>>cityTicketIDDict=null;

Dictionary<int,List<int>>starTicketIDDict=null;

Dictionary<int,List<int>>typeTicketIDDict=null;

List<RoomTicketGifts>roomTicketGifts=null;

List<int>ticketIDsOfCity=null;

List<int>ticketIDsOfStar=null;

//緩存中獲取:送券規(guī)則字典

Dictionary<int,RoomTicketGiftRule>ticketRuleComponent=RoomTicketGiftRuleBusiness.Instance.GetAllDataFromNativeCache();

//這個(gè)字典中如果有值的話,只可能有個(gè)Key=0,Value=Component。所以這里只取key=0的

if(ticketRuleComponent.Count==1&&ticketRuleComponent.ContainsKey(0))

{

cityTicketIDDict=ticketRuleComponent[0].CityTicketIDDict;

starTicketIDDict=ticketRuleComponent[0].StarTicketIDDict;

typeTicketIDDict=ticketRuleComponent[0].TypeTicketIDDict;

roomTicketGifts=ticketRuleComponent[0].RoomTicketGifts;

if(cityTicketIDDict!=null&&cityTicketIDDict.ContainsKey(city))

{

ticketIDsOfCity=cityTicketIDDict[city];

}

if(starTicketIDDict!=null&&starTicketIDDict.ContainsKey(star))

{

ticketIDsOfStar=starTicketIDDict[star];

}

}

List<RoomTicketGifts>roomTicketGifts_temp=null;

if(RoomTicketGiftsDic!=null&&RoomTicketGiftsDic.Count>0)

{

hotelDataList.BaseRoomEntity.ForEach(delegate(BaseRoomEntitybaseRoomentity_temp)

{

baseRoomentity_temp.RoomDataEntity.ForEach(delegate(RoomDataEntityroomListEntity_temp)

{

//是否是返現(xiàn)房型

boolIsHandBackCashRoomType=false;//返現(xiàn)房型(送券,送游票,券返,直返)3

boolIsPrePayDiscountRoomType=roomListEntity_temp.RoomStatusEntity.PriceType==PriceType.PrePayDiscount;//預(yù)付立減房型

4

boolIsPP=roomListEntity_temp.RoomStatusEntity.PayType==PayType.PP;//預(yù)付房型2

boolIsFG=roomListEntity_temp.RoomStatusEntity.PayType==PayType.FG;//現(xiàn)付房型1

List<int>excludeTicketIDsOfType=newList<int>();

#region得到要排除的ticketID

if(typeTicketIDDict!=null&&roomTicketGifts!=null)

{

foreach(RoomTicketGiftsgiftinroomTicketGifts)

{

boolcheckinAfterEnd=DateTime.Now.Date>gift.EndDate;

boolcheckoutBeforeStart=DateTime.Now.Date<gift.StartDate;

boolweekdayMatch=CheckWeek(searchHotelRequest,gift.WeekDayIndex);

//boolpaymentTypeMatch=string.IsNullOrEmpty(gift.PaymentType)?false:gift.PaymentType.Equals(roomListEntity_temp.RoomStatusEntity.PayType.ToString());

//如果已過期,或者星期不匹配,或者支付方式不匹配

if(checkinAfterEnd||checkoutBeforeStart||!weekdayMatch)//||!paymentTypeMatch

{

excludeTicketIDsOfType.Add(gift.RoomTicketGiftsID);

continue;

}

if(IsPrePayDiscountRoomType&&typeTicketIDDict.ContainsKey(4))

{

if(typeTicketIDDict[4].Contains(gift.RoomTicketGiftsID))

{

excludeTicketIDsOfType.Add(gift.RoomTicketGiftsID);

continue;

}

}

if(IsPP&&typeTicketIDDict.ContainsKey(2))

{

if(typeTicketIDDict[2].Contains(gift.RoomTicketGiftsID))

{

excludeTicketIDsOfType.Add(gift.RoomTicketGiftsID);

continue;

}

}

if(IsFG&&typeTicketIDDict.ContainsKey(1))

{

if(typeTicketIDDict[1].Contains(gift.RoomTicketGiftsID))

{

excludeTicketIDsOfType.Add(gift.RoomTicketGiftsID);

continue;

}

}

}

}

#endregion

//只有取到了gift信息才進(jìn)去處理

if(RoomTicketGiftsDic.TryGetValue(roomListEntity_temp.RoomStatusEntity.Room,outroomTicketGifts_temp))

{

List<RoomTicketGifts>roomTicketGifts_temps=newList<RoomTicketGifts>();

//判斷篩選信息是否符合條件活動(dòng)循環(huán)

roomTicketGifts_temp.ForEach(delegate(RoomTicketGiftsroomTicketGifts_temp1)

{

List<RoomTicketGiftsDetail>roomTicketGiftsDetailsList=newList<RoomTicketGiftsDetail>();

//明細(xì)循環(huán)

roomTicketGifts_temp1.RoomTicketGiftsDetail.ForEach(delegate(RoomTicketGiftsDetailroomTicketGiftsDetail_temp1)

{

if(!CheckWeek(searchHotelRequest,roomTicketGiftsDetail_temp1.WeekDayIndex)&&string.Compare(roomTicketGiftsDetail_temp1.TicketType,"Y",StringComparison.OrdinalIgnoreCase)==0)//星期不適用時(shí)不返回

{

return;

}

//日期判斷

if(roomTicketGiftsDetail_temp1.Arrival<searchHotelRequest.PublicSearchParameter.CheckOutDate&&roomTicketGiftsDetail_temp1.Departure>=searchHotelRequest.PublicSearchParameter.CheckInDate&&DateTime.Now.Date>=roomTicketGiftsDetail_temp1.StartDate&&DateTime.Now.Date<=roomTicketGiftsDetail_temp1.EndDate)

{

if(searchHotelRequest.SearchTypeEntity.SearchType==SearchType.PkgResSearch)//度假送券不判支付類型

{

if(string.Equals(roomTicketGiftsDetail_temp1.PaymentType,"FP",StringComparison.OrdinalIgnoreCase)

||(roomListEntity_temp.RoomStatusEntity.IsFGToPP&&string.Equals(roomTicketGiftsDetail_temp1.PaymentType,"FG",StringComparison.OrdinalIgnoreCase))

||string.Equals(roomTicketGiftsDetail_temp1.PaymentType,roomListEntity_temp.RoomStatusEntity.PayType.ToString(),StringComparison.OrdinalIgnoreCase))

{

RoomTicketGiftsDetailroomTicketGiftsDetail_tempCopy=roomTicketGiftsDetail_temp1.Clone()asRoomTicketGiftsDetail;

roomTicketGiftsDetail_tempCopy.CalculateAmount=GetRoomTicketgiftsCalculateAmount(roomTicketGiftsDetail_tempCopy,roomListEntity_temp,searchHotelRequest.SearchTypeEntity.IntlCity,searchHotelRequest.PublicSearchParameter.IgnoreExchange);

AddTicketGiftsDetailWithWirelessChecking(roomTicketGiftsDetailsList,roomTicketGiftsDetail_tempCopy,searchHotelRequest);

//如果是false,說明房型目前還沒有返現(xiàn),需要判斷。如果是true,說明房型已有返現(xiàn),不需要再判斷了

if(!IsHandBackCashRoomType)

{

//Y是平臺(tái)券,非平臺(tái)券既是返現(xiàn)券

IsHandBackCashRoomType=roomTicketGiftsDetail_tempCopy.TicketType!="Y";

}

}

}

else

{

if(searchHotelRequest.PublicSearchParameter.IsRequestTravelMoney

&&(searchHotelRequest.SearchTypeEntity.SearchType==SearchType.OnLineSearch)

&&string.Compare(roomTicketGiftsDetail_temp1.TicketType,"Y",StringComparison.OrdinalIgnoreCase)==0

&&roomListEntity_temp.RoomStatusEntity.PayType==PayType.FG

&&(roomTicketGiftsDetail_temp1.PaymentType=="FP"||roomTicketGiftsDetail_temp1.PaymentType=="PP")

)

{

RoomTicketGiftsDetailroomTicketGiftsDetail_tempCopy=roomTicketGiftsDetail_temp1.Clone()asRoomTicketGiftsDetail;

roomTicketGiftsDetail_tempCopy.CalculateAmount=GetRoomTicketgiftsCalculateAmount(roomTicketGiftsDetail_tempCopy,roomListEntity_temp,searchHotelRequest.SearchTypeEntity.IntlCity,searchHotelRequest.PublicSearchParameter.IgnoreExchange);

AddTicketGiftsDetailWithWirelessChecking(roomTicketGiftsDetailsList,roomTicketGiftsDetail_tempCopy,searchHotelRequest);

//如果是false,說明房型目前還沒有返現(xiàn),需要判斷。如果是true,說明房型已有返現(xiàn),不需要再判斷了

if(!IsHandBackCashRoomType)

{

//Y是平臺(tái)券,非平臺(tái)券既是返現(xiàn)券

IsHandBackCashRoomType=roomTicketGiftsDetail_tempCopy.TicketType!="Y";

}

}

elseif(roomTicketGiftsDetail_temp1.PaymentType=="FP"||string.Compare(roomTicketGiftsDetail_temp1.PaymentType.Trim(),roomListEntity_temp.RoomStatusEntity.PayType.ToString(),StringComparison.OrdinalIgnoreCase)==0)

{

RoomTicketGiftsDetailroomTicketGiftsDetail_tempCopy=roomTicketGiftsDetail_temp1.Clone()asRoomTicketGiftsDetail;

roomTicketGiftsDetail_tempCopy.CalculateAmount=GetRoomTicketgiftsCalculateAmount(roomTicketGiftsDetail_tempCopy,roomListEntity_temp,searchHotelRequest.SearchTypeEntity.IntlCity,searchHotelRequest.PublicSearchParameter.IgnoreExchange);

AddTicketGiftsDetailWithWirelessChecking(roomTicketGiftsDetailsList,roomTicketGiftsDetail_tempCopy,searchHotelRequest);

//如果是false,說明房型目前還沒有返現(xiàn),需要判斷。如果是true,說明房型已有返現(xiàn),不需要再判斷了

if(!IsHandBackCashRoomType)

{

//Y是平臺(tái)券,非平臺(tái)券既是返現(xiàn)券

IsHandBackCashRoomType=roomTicketGiftsDetail_tempCopy.TicketType!="Y";

}

}

}

}

});

if(roomTicketGiftsDetailsList.Count>0)

{

RoomTicketGiftsroomTicketgifts=newRoomTicketGifts();

roomTicketgifts.PlatformPromotionID=roomTicketGifts_temp1.PlatformPromotionID;

roomTicketgifts.RoomTicketGiftsID=roomTicketGifts_temp1.RoomTicketGiftsID;

roomTicketgifts.RoomTicketGiftsName=roomTicketGifts_temp1.RoomTicketGiftsName;

roomTicketgifts.TicketGiftsChannels=roomTicketGifts_temp1.TicketGiftsChannels;

roomTicketgifts.RoomTicketGiftsRealID=roomTicketGifts_temp1.RoomTicketGiftsRealID;

roomTicketgifts.RoomTicketGiftsDetail=roomTicketGiftsDetailsList;

roomTicketGifts_temps.Add(roomTicketgifts);

}

});

#region追加新的送券rule1.2到房型

if(ConfigurationTypeConst.TicketGiftRuleSearchType().Contains(searchtype)&&roomTicketGifts!=null)

{

//先循環(huán)一遍,添加排除項(xiàng)

foreach(RoomTicketGiftsgiftinroomTicketGifts)

{

if(IsHandBackCashRoomType&&typeTicketIDDict.ContainsKey(3))

{

if(typeTicketIDDict[3].Contains(gift.RoomTicketGiftsID))

{

excludeTicketIDsOfType.Add(gift.RoomTicketGiftsID);

continue;

}

}

}

//驗(yàn)證規(guī)則是否完全匹配,匹配的話添加

foreach(RoomTicketGiftsgiftinroomTicketGifts)

{

if(ticketIDsOfCity!=null&&ticketIDsOfStar!=null)

{

boolcityMatch=ticketIDsOfCity.Contains(gift.RoomTicketGiftsID);

boolstarMatch=ticketIDsOfStar.Contains(gift.RoomTicketGiftsID);

booltypeMatch=!excludeTicketIDsOfType.Contains(gift.RoomTicketGiftsID);

if(cityMatch&&starMatch&&typeMatch)

{

if(roomTicketGifts_temps.Find(e=>e.RoomTicketGiftsID==gift.RoomTicketGiftsID)==null)

{

roomTicketGifts_temps.Add(gift);

}

}

}

}

}

#endregion

//送券信息賦值

roomListEntity_temp.RoomStaticInfoEntity.RoomTicketGifts=roomTicketGifts_temps;

}

else

//如果這個(gè)房型原來還沒有關(guān)聯(lián)任何ticket

{

if(ConfigurationTypeConst.TicketGiftRuleSearchType().Contains(searchtype)&&roomTicketGifts!=null)

{

List<RoomTicketGifts>roomTicketGifts_temps=newList<RoomTicketGifts>();

if(roomTicketGifts!=null)

{

foreach(RoomTicketGiftsgiftinroomTicketGifts)

{

if(ticketIDsOfCity!=null&&ticketIDsOfStar!=null)

{

boolcityMatch=ticketIDsOfCity.Contains(gift.RoomTicketGiftsID);

boolstarMatch=ticketIDsOfStar.Contains(gift.RoomTicketGiftsID);

booltypeMatch=!excludeTicketIDsOfType.Contains(gift.RoomTicketGiftsID);

if(cityMatch&&starMatch&&typeMatch)

{

if(roomTicketGifts_temps.Find(e=>e.RoomTicketGiftsID==gift.RoomTicketGiftsID)==null)

{

roomTicketGifts_temps.Add((RoomTicketGifts)gift.Clone());

}

}

}

}

}

roomListEntity_temp.RoomStaticInfoEntity.RoomTicketGifts=roomTicketGifts_temps;

}

}

});

});

}

});

}

#endregion

}

catch(Exceptionex)

{

HelpBusiness.Logger.Error("RoomTicketGiftsProcess",

"RoomTicketGiftsProcess"+"\n"+

ex.Message+"\n"+ex.StackTrace+"\n"

+(searchHotelRequest.StatusisShareStatus?(searchHotelRequest.StatusasShareStatus).RawRequest:"nullrawrequest"),

addinfo);

searchHotelResponse=newSearchHotelDataResponse();

}

finally

{

if(sw!=null)

{

sw.Stop();

PerformanceDataRecorderUtility.AddOrUpdate("RoomTicketGiftsProcess",sw.ElapsedMilliseconds);

}

}

searchHotelResponse.DebugEntity.RoomTicketGiftsProcessTime=Math.Round(sw.Elapsed.TotalSeconds,6);

returnsearchHotelResponse;

}可讀性15

}

#endregion

}

catch(Exceptionex)

{

HelpBusiness.Logger.Error("RoomTicketGiftsProcess",

"RoomTicketGiftsProcess"+"\n"+

ex.Message+"\n"+ex.StackTrace+"\n"

+(searchHotelRequest.StatusisShareStatus?(searchHotelRequest.StatusasShareStatus).RawRequest:"nullrawrequest"),

addinfo);

searchHotelResponse=newSearchHotelDataResponse();

}

finally

{

if(sw!=null)

{

sw.Stop();

PerformanceDataRecorderUtility.AddOrUpdate("RoomTicketGiftsProcess",sw.ElapsedMilliseconds);

}

}

searchHotelResponse.DebugEntity.RoomTicketGiftsProcessTime=Math.Round(sw.Elapsed.TotalSeconds,6);

returnsearchHotelResponse;

}可讀性差而沒有發(fā)現(xiàn)問題可讀性

publicSearchHotelDataResponseProces

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論